Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more apparent, the embodiments of the present application are described in further detail below with reference to the embodiments and the accompanying drawings. The exemplary embodiments and descriptions of the embodiments are provided to explain the embodiments and should not be construed as limiting the embodiments.
The following describes embodiments of the present application in further detail with reference to the accompanying drawings.
Referring to fig. 1, a service processing method according to an embodiment of the present application includes the following steps:
and step S101, receiving a service request.
In the embodiment of the present application, the service request may be any service request of any service processing system, such as a request for a merchant group red envelope transfer of a paypal, such as an electronic coupon issuing request in an electronic coupon issuing system, such as a credit deduction request in a credit system, and the like.
And step S102, performing data model conversion on the data object in the service field model of the service request, so that the new data object obtained after conversion corresponds to each service-related data table in the specified database.
Generally, in the currently used service processing system, a service domain model of a service request is established in advance. In the embodiment of the present application, the data model conversion of the data objects (such as Java class objects related to various services) in the existing service domain model of the service request is mainly aimed at enabling the new data object obtained after the conversion to directly correspond to each service-related data table in the specified database, thereby facilitating the data storage in the specified database.
In an embodiment of the present application, the data model conversion may be, for example, conversion from an Entity Relationship map (ER) to a Relationship model, or the like.
Step S103, after the service request is successfully processed, packing the data in the specified range in the current new data object into a data packet for storage, and returning a service processing result.
Packaging in the embodiments of the present application may be understood as a way to reduce the number of objects to be stored. The main purpose of packing the data in the specified range in the new data object is to compress or merge the data (for example, compress the data that is originally stored in a plurality of data tables into one data table), so that the number of database operations when the service processing system synchronously processes the service request can be reduced, which is very beneficial to reducing the pressure of the service processing system when the service is highly concurrent (for example, when the business is promoted in double eleven).
In an embodiment of the present application, for example, the packing the data in the specified range in the new data object may be in a serialization manner, and specifically includes:
firstly, converting data in a specified range in the new data object into a character string in a serialization mode, for example, converting the data into a text character string through a session protocol;
secondly, the character string is used as an extension field and written into a specified service related data table in the specified database;
finally, the database record status bits (e.g., status or status) in the specified service-related data table are updated.
In other embodiments of the present application, other methods for reducing objects to be stored may also be employed. For example, the data in the specified range in the new data object may be converted into a binary file and stored in another database (e.g., an NOSQL (not Only sql) database) based on a memory, and when the traffic is low (i.e., the traffic is lower than a set threshold), the data is restored, that is, the file information is read from the NOSQL database and the complete data object is restored to the target traffic database.
In this embodiment of the present application, the returning of the service processing result generally refers to returning the service processing result to an upstream caller.
And step S104, when the traffic is lower than a set threshold, fishing out the stored data packet for unpacking processing, and correspondingly inserting the unpacked data into the data table related to each service in the specified database.
When the traffic is lower than the set threshold, the service processing system is currently idle or in a traffic low peak period. At this point, the business processing system may unpack the data floor database details.
In one embodiment of the present application, the fishing may be a timed fishing. In a specific embodiment of the present application, the timed fetching may be triggered by a driver message sent by a middleware (e.g., a task scheduling center) at a fixed time interval, where a trigger of the task scheduling center may call an interface of a service processing system to execute a task, where the task may specifically be to search records in a database according to a specific filtering condition and return database records satisfying the condition, and for the embodiment of the present application, it is to return data records containing packed data information.
In another embodiment of the present application, the fishing may not use a timing task, such as a manual triggering method, but the timing fishing is relatively more convenient to trigger unpacking to recover the data process.
In the above method embodiment of the present application, the unpacking and the packing are corresponding, and if the packing is in a serialization manner, the subsequent unpacking is in an deserialization manner. Among them, protocols such as Protobuf, swift, Hessian, and Kryo, etc. can be used for serialization and deserialization.
In another embodiment of the present application, after step S102, the method may further include:
and if the service request is failed to be processed, directly returning a service processing result. If the service request processing fails, the database does not need to be updated, and therefore data packaging is not needed.
In the embodiment of the application, after receiving the service request, the data object in the service field model of the service request can be subjected to data model conversion, so that the new data object obtained after conversion corresponds to each service-related data table in the designated database; after the service request is successfully processed, the data in the specified range in the current new data object can be packaged into a data packet for storage, and a service processing result is returned; when the traffic is lower than the set threshold, the stored data packet is fished for unpacking processing, and the data obtained after unpacking is correspondingly inserted into the data table related to each service in the designated database. Therefore, at the time of high concurrency, the embodiment of the application can greatly reduce the processing pressure of the business processing system. In addition, the embodiment of the application synchronously processes the service request and returns the processing result, so that the user can obtain the processing result in time, and the user experience is high.
While the process flows described above include operations that occur in a particular order, it should be appreciated that the processes may include more or less operations that are performed sequentially or in parallel (e.g., using parallel processors or a multi-threaded environment).
To facilitate understanding of the present application, a specific application scenario is described below in conjunction with the embodiment of fig. 1.
In the payment treasury merchant red envelope transfer service, after a transfer request of an upstream calling party is received by a fund service processing system of the payment treasury; performing data model conversion on data objects in a service field model of the transfer service request so as to enable new data objects obtained after conversion to correspond to each service related data table in a database; the new data object obtained by the transfer service request in the fund service processing system corresponds to six data tables in the database, and the names of the six data tables are respectively as follows:
a)、CFM_TABLE_MASTER
b)、CFM_TABLE_A
c)、CFM_TABLE_B
d)、CFM_TABLE_C
e)、CFM_TABLE_D
f)、CFM_TABLE_E
the CFM _ TABLE _ MASTER is a service MASTER document, and contains service related data of the remaining 5 data TABLEs; therefore, after the fund service processing system successfully processes the transfer service request, only the CFM _ TABLE _ MASTER can be packaged into a data packet at present for storage, and a service processing result is returned to an upstream calling party; and when the business is low-peak, the fund business processing system catches the stored data packet to carry out unpacking processing, and correspondingly inserts the unpacked data into the six data tables in the database. Statistics show that by adopting the scheme of the embodiment of the application, the database operation of the fund service processing system in the process of synchronously processing the request can be reduced from about 25 times to about 7 times, and the processing pressure of the fund service processing system is obviously reduced.
Referring to fig. 2, a service processing device is configured in a service processing system according to an embodiment of the present application.
As shown in fig. 3a, in an embodiment of the present application, the service processing apparatus may include:
a service request receiving module 31, configured to receive a service request.
In the embodiment of the present application, the service request may be any service request of any service processing system, such as a request for a merchant group red envelope transfer of a paypal, such as an electronic coupon issuing request in an electronic coupon issuing system, such as a credit deduction request in a credit system, and the like.
And the data model conversion module 32 is configured to perform data model conversion on the data object in the service domain model of the service request, so that the new data object obtained after conversion corresponds to each service-related data table in the specified database.
Generally, in the currently used service processing system, a service domain model of a service request is established in advance. In the embodiment of the present application, the data model conversion of the data objects (such as Java class objects related to various services) in the existing service domain model of the service request is mainly aimed at enabling the new data object obtained after the conversion to directly correspond to each service-related data table in the specified database, thereby facilitating the data storage in the specified database.
In one embodiment of the present application, the data model conversion may be, for example, conversion from an ER graph to a relational model, or the like.
And the service data packing module 33 is configured to pack data in a specified range in the current new data object into a data packet for storage after the service request is successfully processed.
Packaging in the embodiments of the present application may be understood as a way to reduce the number of objects to be stored. The main purpose of packing the data in the specified range in the new data object is to compress or merge the data (for example, compress the data that is originally stored in multiple data tables into one data table), so that the number of database operations can be reduced when the service processing system synchronously processes the service request, which is very beneficial to reducing the pressure of the service processing system when the service is highly concurrent (for example, when the business is promoted in double eleven shopping, on a very busy day, etc.).
In an embodiment of the present application, the packaging of the data in the specified range in the new data object may be, for example, in a serialization manner, and in other embodiments of the present application, other methods for reducing the number of objects to be stored may also be adopted. For example, the data in the specified range in the new data object may be converted into a binary file and stored in another database (e.g., an NOSQL (not Only sql) database) based on a memory, and when the traffic is low (i.e., the traffic is lower than a set threshold), the data is restored, that is, the file information is read from the NOSQL database and the complete data object is restored to the target traffic database.
And a first result returning module 34, configured to return a service processing result after the service request is successfully processed. In this embodiment of the present application, the returning of the service processing result generally refers to returning the service processing result to an upstream caller.
And the database asynchronous updating module 35 is configured to, when the traffic is lower than a set threshold, retrieve the stored data packet for unpacking processing, and correspondingly insert the data obtained after unpacking into the data table related to each service in the specified database.
When the traffic is lower than the set threshold, the service processing system is currently idle or in a traffic low peak period. At this point, the business processing system may unpack the data floor database details.
In one embodiment of the present application, the fishing may be a timed fishing. In a specific embodiment of the present application, the timed fetching may be triggered by a driver message sent by a middleware (e.g., a task scheduling center) at a fixed time interval, where a trigger of the task scheduling center may call an interface of a service processing system to execute a task, where the task may specifically be to search records in a database according to a specific filtering condition and return database records satisfying the condition, and for the embodiment of the present application, it is to return data records containing packed data information.
In another embodiment of the present application, the fishing may not use a timing task, such as a manual triggering method, but the timing fishing is relatively more convenient to trigger unpacking to recover the data process.
As shown in fig. 3b, in another embodiment of the present application, the service processing apparatus may further include: and a second result returning module 36, configured to directly return the service processing result when the service request fails to be processed.
As described with reference to fig. 4, the data packing module 33 may specifically include:
a serialization sub-module 331, configured to convert, in a serialization manner, data in a specified range in the new data object into a character string, for example, a text character string through a session protocol;
the data storage submodule 332 is configured to write the character string as an extension field into a specified service-related data table in the specified database;
a status bit updating sub-module 332, configured to update a database record status bit (for example, status or status) in the specified service-related data table.
In other embodiments of the present application, other methods for reducing objects to be stored may also be employed. For example, the data in the specified range in the new data object may be converted into a binary file and stored in another database (e.g., an NOSQL (not Only sql) database) based on a memory, and when the traffic is low (i.e., the traffic is lower than a set threshold), the data is restored, that is, the file information is read from the NOSQL database and the complete data object is restored to the target traffic database.
In the above device embodiment of the present application, the above unpacking and packing correspond to each other, and if the packing is in a serialization manner, the subsequent unpacking is in an deserialization manner. Among them, protocols such as Protobuf, swift, Hessian, and Kryo, etc. can be used for serialization and deserialization.
In the embodiment of the application, after receiving the service request, the data object in the service field model of the service request can be subjected to data model conversion, so that the new data object obtained after conversion corresponds to each service-related data table in the designated database; after the service request is successfully processed, the data in the specified range in the current new data object can be packaged into a data packet for storage, and a service processing result is returned; when the traffic is lower than the set threshold, the stored data packet is fished for unpacking processing, and the data obtained after unpacking is correspondingly inserted into the data table related to each service in the designated database. Therefore, at the time of high concurrency, the embodiment of the application can greatly reduce the processing pressure of the business processing system. In addition, the embodiment of the application synchronously processes the service request and returns the processing result, so that the user can obtain the processing result in time, and the user experience is high.
For convenience of description, the above-described apparatus is described by dividing functions into various modules and separately describing the modules. Of course, the functionality of the various modules may be implemented in the same one or more software and/or hardware implementations as the present application.
Those of skill would further appreciate that the various illustrative logical blocks, units, and steps described in connection with the embodiments disclosed herein may be implemented as hardware, software, or combinations of both. Whether implemented in hardware or software depends upon the particular application and design requirements of the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.
The various illustrative logical blocks, or elements described in this application may be implemented or operated by a general purpose processor, a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The steps of a method or algorithm described in the embodiments herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. For example, a storage medium may be coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC, which may be located in a user terminal. In the alternative, the processor and the storage medium may reside in different components in a user terminal.
In one or more exemplary designs, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media that facilitate transfer of a computer program from one place to another. Storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, such computer-readable media can include, but is not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to carry or store program code in the form of instructions or data structures and which can be read by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Additionally, any connection is properly termed a computer-readable medium, and, thus, is included if the software is transmitted from a website, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wirelessly, e.g., infrared, radio, and microwave. Such discs (disk) and disks (disc) include compact disks, laser disks, optical disks, DVDs, floppy disks and blu-ray disks where disks usually reproduce data magnetically, while disks usually reproduce data optically with lasers. Combinations of the above may also be included in the computer-readable medium.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present application in further detail, and it should be understood that the above-mentioned embodiments are only examples of the embodiments of the present application and are not intended to limit the scope of the present application, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present application should be included in the scope of the present application.