Service request processing method and device, electronic equipment, storage medium and program product

By storing structured data in the database and managing requests using CountDownLatch object, mutex execution of different types of requests and concurrent execution of similar types of requests is achieved, which solves the problem that mutex operations affect data processing efficiency in the prior art, and improves the overall Data processing efficiency.

CN119201496APending Publication Date: 2024-12-27KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411331737.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The prior art is difficult to improve data processing efficiency on the basis of avoiding mutual influence of mutually exclusive operations, especially when processing large batches of data, synchronous processing caused by distributed locks reduces efficiency.

Method used

By receiving business requests and storing structured data in the database, judging mutex requests based on the data, blocking or parallel execution requests, and using JUC's CountDownLatch object asynchronously listens to the message queue, realizing mutex execution of different types of requests and concurrent execution of similar types of requests.

Benefits of technology

On the basis of avoiding mutual influence of mutual exclusion operations, data processing efficiency is improved, and the reliability and efficiency of parallel execution of requests is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201496A_ABST
    Figure CN119201496A_ABST
Patent Text Reader

Abstract

The invention provides a service request processing method and device, electronic equipment, a storage medium and a program product, and the method comprises the steps: receiving a first type of service request sent by a service party, the service request comprising a service data identifier, a request type identifier and information of to-be-processed data, the to-be-processed data is a subset of the service data corresponding to the service data identifier; in response to storage of the structured data corresponding to the business data identifier and existence of a second type of business request which is being executed and mutually exclusive to the first type of business request, blocking execution of the first type of business request, and updating the structured data corresponding to the business data identifier; the structured data comprises business data identifiers, request type identifiers and request state information with levels from high to low, and the request state information comprises a request execution state and the number of to-be-processed requests; and in response to the obtained processing completion message of the service request of the second type, executing the service request of the first type in parallel, and updating the structured data. Mutual exclusion execution of different types of requests and concurrent execution of the same type of requests are realized, and the data processing efficiency is improved on the basis of avoiding mutual influence of mutual exclusion operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a service request processing method, device, electronic device, storage medium and program product. Background Art

[0002] The server receives the business request sent by the business end and processes it accordingly. Depending on the request type, the business request may include mutually exclusive processing requests, which are processing requests that cannot be operated at the same time. For example, if the data deletion operation and the data addition operation are performed at the same time, they will affect each other and cause the final data to be inaccurate.

[0003] The existing solution to business request mutual exclusion is usually to use distributed locks to convert asynchronous operations into synchronous operations. However, since some business requests involve large-scale data processing, using distributed locks to synchronize business processing operations greatly reduces data processing efficiency.

[0004] Therefore, how to improve data processing efficiency while avoiding the mutual influence of mutually exclusive operations has become an urgent problem to be solved. Summary of the invention

[0005] The present invention provides a business request processing method, device, electronic device, storage medium and program product, which are used to solve the defect in the prior art that data processing efficiency cannot be improved on the basis of avoiding the mutual influence of mutually exclusive operations, and realize the improvement of data processing efficiency on the basis of avoiding the mutual influence of mutually exclusive operations.

[0006] The present invention provides a business request processing method, comprising the following steps: receiving a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier; in response to structured data corresponding to the business data identifier being stored in a database, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request according to the structured data, blocking the execution of the first type of business request, and updating the structured data corresponding to the business data identifier; wherein the structured data includes the business data identifier, the request type identifier and request status information in descending order of level, and the request status information includes the request execution status and the number of requests to be processed; in response to obtaining a processing completion message of the second type of business request, executing the first type of business request in parallel, and updating the structured data corresponding to the business data identifier.

[0007] According to a business request processing method provided by the present invention, after the parallel execution of the business request of the first type, the method further includes: in response to the number of pending requests being 0 and there being business requests of the second type to be executed, publishing a processing completion message of the first type of business request to the message queue, and deleting the information of the first type of business request in the structured data; in response to the number of pending requests being 0 and there being no business requests of the second type to be executed, directly deleting the information of the first type of business request in the structured data; wherein the processing completion message includes the business data identifier, the request type identifier and the processing completion identifier.

[0008] According to a business request processing method provided by the present invention, after the response stores structured data corresponding to the business data identifier in the database and learns from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, the method further includes: creating a CountDownLatch object of JUC, and using the CountDownLatch object as a parameter to asynchronously listen to the published messages of the message queue; wherein the CountDownLatch object corresponds one-to-one to the business request, and the published message includes a processing completion message of the second type of business request.

[0009] According to a business request processing method provided by the present invention, in response to obtaining a processing completion message of the second type of business request, the business request of the first type is executed in parallel, including: in response to monitoring the processing completion message of the second type of business request published in the message queue, triggering the execution of the corresponding first type of business request by executing the CountDown method of the CountDownLatch object.

[0010] According to a service request processing method provided by the present invention, blocking the execution of the first type of service request includes: blocking the execution of the first type of service request by calling the await method of the CountDownLatch object.

[0011] According to a service request processing method provided by the present invention, the database is a redis database, and the message queue is a message queue implemented based on redis.

[0012] According to a business request processing method provided by the present invention, the structured data is stored via a hash structure of redis.

[0013] According to a business request processing method provided by the present invention, the method also includes: in response to the structured data corresponding to the business data identifier being stored in the database, and knowing from the structured data that there is no second type of business request being executed that is mutually exclusive with the first type of business request, executing the first type of business request and updating the structured data corresponding to the business data identifier.

[0014] According to a business request processing method provided by the present invention, the method also includes: in response to the structured data corresponding to the business data identifier not being stored in the database, newly creating the structured data corresponding to the business data identifier and executing the first type of business request.

[0015] The present invention also provides a business request processing device, comprising the following modules: a receiving module, used to: receive a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier; a blocking module, used to: in response to the storage of structured data corresponding to the business data identifier in a database, and knowing from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, then block the execution of the first type of business request and update the structured data corresponding to the business data identifier; wherein the structured data includes the business data identifier, the request type identifier and request status information in descending order of levels, and the request status information includes the request execution status and the number of requests to be processed; an execution module, used to: in response to obtaining a processing completion message of the second type of business request, execute the first type of business request in parallel and update the structured data corresponding to the business data identifier.

[0016] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the above-mentioned service request processing methods is implemented.

[0017] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the service request processing method described in any one of the above is implemented.

[0018] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned service request processing methods.

[0019] The business request processing method, device, electronic device, storage medium and program product provided by the present invention receive a first type of business request sent by a business party, the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier. In response to the storage of structured data corresponding to the business data identifier in a database, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request according to the structured data, the execution of the first type of business request is blocked, and the structured data corresponding to the business data identifier is updated; wherein the structured data includes business data identifiers, request type identifiers and request status information with levels from high to low, and the request status information includes request execution status and the number of requests to be processed. In response to obtaining a processing completion message of the second type of business request, the first type of business request is executed in parallel, thereby realizing mutually exclusive execution of requests of different types and concurrent execution of requests of the same type, thereby improving data processing efficiency on the basis of avoiding mutual influence of mutually exclusive operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 This is one of the flow charts of the service request processing method provided by the present invention.

[0022] Figure 2 It is a schematic diagram of structured data in the business request processing method provided by the present invention.

[0023] Figure 3 This is the second flow chart of the business request processing method provided by the present invention.

[0024] Figure 4 It is a structural schematic diagram of the service request processing device provided by the present invention.

[0025] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] Figure 1 FIG. 1 is one of the flow charts of the service request processing method provided by the present invention. Figure 1 As shown, the method includes: Step S1, receiving a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier.

[0028] The service request processing method provided by the present invention can be applied to an independent server or any server in a distributed service cluster. The server is used to process the service request of the service party, that is, to execute the corresponding service request.

[0029] The server receives a first type of business request sent by the business party. The business request includes a business data identifier, a request type identifier, and information about the data to be processed. The data to be processed is a subset of the business data corresponding to the business data identifier. The business data identifier is a unique identifier of the business data, and the data to be processed can be part of the business data or all of the business data. For example, in a big data processing task, the business data will be grouped and requested to multiple servers in a distributed cluster for processing. The data to be processed in the business request received by each server is part of the business data. Of course, if the amount of business data is not large, or the processing of business data does not require group processing, the business request can be sent to one server. The first type is the request type of the currently received business request. The request type can be characterized by the request type identifier, that is, the business party needs to tell the server what type of data processing needs to be done, such as deleting data or adding data.

[0030] Step S2: In response to the structured data corresponding to the business data identifier being stored in the database, and knowing from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, the execution of the first type of business request is blocked, and the structured data corresponding to the business data identifier is updated; wherein the structured data includes the business data identifier, the request type identifier and the request status information in descending order of levels, and the request status information includes the request execution status and the number of requests to be processed.

[0031] After receiving a business request, the relevant data of the business request can be stored in a structured manner, that is, stored as pre-set structured data. The structured data includes business data identifiers from high to low levels, request type identifiers, and request status information, and the request status information includes the request execution status and the number of pending requests.

[0032] Figure 2 Schematic diagram of structured data in the business request processing method provided by the present invention. Figure 2 As shown, corresponding to each business data identifier, a request type identifier is stored thereunder, and the maximum number of request type identifiers that may appear is related to the number of mutually exclusive requests that may occur for the business data. Mutually exclusive requests refer to business requests that cannot be processed at the same time, which is related to the request type. One type of business request may correspond to multiple mutually exclusive business requests. The first type and the second type in the present invention do not refer to specific requests, but refer to the request types of any two mutually exclusive business requests. For example, for two mutually exclusive business requests 1 and 2, the first type may be the request type of business request 1, and the second type may be the request type of business request 2. For two mutually exclusive business requests 1 and 3, the first type may be the request type of business request 3, and the second type may be the request type of business request 1.

[0033] For each request type identifier, the structured data stores request status information, which includes the request execution status and the number of pending requests. The request execution status is used to characterize the execution status of the business request of the corresponding request type. The server can receive business requests of the same request type sent by the business party multiple times. The number of pending requests is used to characterize the current accumulated number of pending requests of the business request of the corresponding request type. This number of pending requests can be the cumulative result of business requests of the same request type received by multiple servers.

[0034] The server may receive a second type of service request from the business party before receiving a first type of service request from the business party. The two service requests are mutually exclusive requests. Whether the two mutually exclusive requests should be avoided from being executed at the same time, in addition to considering the request type, it is also necessary to satisfy that the two requests process the same service data. That is, in the structured data, the information of the two service requests is stored under the same service data identifier.

[0035] If there is a business request of the second type currently being executed, the structured data corresponding to the business data identifier contains a request type identifier corresponding to the second type, as well as a request execution status of the business request of the second type and the number of pending requests. Whether the business request of the second type is being executed is determined by the request execution status of the business request of the second type. For example, if the request execution status of the business request of the second type is in execution, it is known that the business request of the second type is being executed.

[0036] If structured data corresponding to the business data identifier is stored in the database, and it is known from the structured data corresponding to the business data identifier that there is a second type of business request being executed and mutually exclusive with the first type of business request, the execution of the first type of business request is blocked, and the structured data corresponding to the business data identifier is updated. Wherein, updating the structured data corresponding to the business data identifier includes adding or updating the relevant information of the first type of business request to the structured data. If the first type of business request sent by the business party is received for the first time after the execution of the second type of business request, there is no information of the first type of business request in the structured data. Then, the information of the first type of business request, the request execution status of the first type of business request and the number of pending requests are added to the structured data corresponding to the business data identifier. Wherein, the request execution status is pending, and the number of pending requests is 1. If the first type of business request sent by the business party is not received for the first time after the execution of the second type of business request, the information of the first type of business request is stored in the structured data. Then it is necessary to update the information of the first type of business request, and updating the information of the first type of business request includes adding 1 to the number of pending requests.

[0037] Step S3: in response to obtaining a processing completion message of the second type of service request, executing the first type of service request in parallel, and updating the structured data corresponding to the service data identifier.

[0038] If a processing completion message of a second type of business request is obtained, the first type of business request can be executed. Since multiple first type of business requests may have been received cumulatively, multiple first type of business requests will be executed concurrently. Of course, if a processing completion message of a second type of business request is obtained, the number of pending requests is 1, that is, only one first type of business request is received, then only the first type of business request can be executed.

[0039] Since the first type of business request has begun to be executed, it is necessary to update the request execution status and the number of pending requests of the first type of business request in the structured data corresponding to the business data identifier. The request execution status of the first type of business request is updated to being executed, and the corresponding number of pending requests is reduced by 1 for each successful execution of a first type of business request.

[0040] The business request processing method provided by the present invention receives a first type of business request sent by a business party, the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier. In response to the structured data corresponding to the business data identifier being stored in a database, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request according to the structured data, the execution of the first type of business request is blocked, and the structured data corresponding to the business data identifier is updated; wherein the structured data includes business data identifiers, request type identifiers and request status information with levels from high to low, and the request status information includes request execution status and the number of requests to be processed. In response to obtaining a processing completion message of the second type of business request, the first type of business request is executed in parallel, thereby realizing mutually exclusive execution of requests of different types and concurrent execution of requests of the same type, thereby improving data processing efficiency on the basis of avoiding mutual influence of mutually exclusive operations.

[0041] According to a business request processing method provided by the present invention, after the parallel execution of the business request of the first type, the method further includes: in response to the number of pending requests being 0 and there being business requests of the second type to be executed, publishing a processing completion message of the first type of business request to the message queue, and deleting the information of the first type of business request in the structured data; in response to the number of pending requests being 0 and there being no business requests of the second type to be executed, directly deleting the information of the first type of business request in the structured data; wherein the processing completion message includes the business data identifier, the request type identifier and the processing completion identifier.

[0042] After executing the first type of business request in parallel, if it is known that the number of pending requests is 0, it means that all the first type of business requests have been executed. Then it is determined whether there are pending second type of business requests. If there are pending second type of business requests, a processing completion message of the first type of business request is published to the message queue, and the information of the first type of business request in the structured data is deleted. If there are no pending second type of business requests, the information of the first type of business request in the structured data is directly deleted.

[0043] Wherein, deleting the information of the first type of business request in the structured data includes deleting the request type identifier of the first type, as well as the request execution status and the number of pending requests of the first type of business request. The processing completion message includes the business data identifier, the request type identifier and the processing completion identifier to identify the processing completion message of mutually exclusive business requests.

[0044] After executing the first type of service request in parallel, if it is learned that the number of pending requests is not 0, it means that although the first type of service request of this server has been processed, there are other servers whose first type of service requests have not been processed, so this server ends the execution.

[0045] The business request processing method provided by the present invention responds to the number of pending requests being 0 and there being a second type of business request to be executed, then publishes a processing completion message of the first type of business request to the message queue and deletes the information of the first type of business request in the structured data. In response to the number of pending requests being 0 and there being no second type of business request to be executed, the information of the first type of business request in the structured data is directly deleted. The processing completion message includes a business data identifier, a request type identifier and a processing completion identifier, thereby realizing the judgment of whether there is a mutually exclusive request and the acquisition of the completion status of the mutually exclusive request.

[0046] According to a business request processing method provided by the present invention, after the response stores structured data corresponding to the business data identifier in the database and learns from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, the method further includes: creating a CountDownLatch object of JUC, and using the CountDownLatch object as a parameter to asynchronously listen to the published messages of the message queue; wherein the CountDownLatch object corresponds one-to-one to the business request, and the published message includes a processing completion message of the second type of business request.

[0047] It is understandable that after the second type of service request is executed, a processing completion message will also be sent to allow the first type of service request to determine its completion status. The completion status of the service request is achieved by monitoring the message queue.

[0048] After knowing that the database stores structured data corresponding to the business data identifier, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request according to the structured data, create a JUC CountDownLatch object, and use the CountDownLatch object as a parameter to asynchronously monitor the published messages of the message queue; wherein, the CountDownLatch object corresponds to the business request one by one, for example, if 10 first type of business requests are received, 10 CountDownLatch objects are created to correspond to the business requests respectively. The published message includes the processing completion message of the second type of business request, that is, the processing completion message of the second type of business request in the monitored message queue. Among them, JUC is the abbreviation of the java.util.concurrent package, which is a toolkit provided by Java for concurrent programming. JUC provides a variety of interfaces and classes for concurrent control of multi-threaded programming.

[0049] The business request processing method provided by the present invention creates a CountDownLatch object of JUC, uses the CountDownLatch object as a parameter to asynchronously monitor the published messages of the message queue, and the published messages include the processing completion message of the second type of business request, thereby realizing effective monitoring of the completion status of the business request.

[0050] According to a business request processing method provided by the present invention, in response to obtaining a processing completion message of the second type of business request, the business request of the first type is executed in parallel, including: in response to monitoring the processing completion message of the second type of business request published in the message queue, triggering the execution of the corresponding first type of business request by executing the CountDown method of the CountDownLatch object.

[0051] If the processing completion message of the second type of business request published in the message queue is monitored, it means that the processing completion message of the second type of business request is obtained, and the first type of business request is executed in parallel. Among them, the execution of the corresponding first type of business request is triggered by executing the CountDown method of the CountDownLatch object. When the CountDownLatch object is used as a parameter to asynchronously monitor the published message of the message queue, the parameter latch value of the CountDown method can be set to 1. When the CountDown method of the CountDownLatch object is executed, the latch value is reduced by 1, and the latch value is 0. A latch value of 0 will trigger the execution of the corresponding business request. Since the CountDownLatch objects corresponding to each business request are used as parameters in the monitoring function when monitoring the published message of the message queue, after monitoring the processing completion message of the second type of business request published in the message queue, the execution of the CountDown method of each CountDownLatch object will be triggered, that is, the parallel execution of each business request is realized.

[0052] The business request processing method provided by the present invention responds to the processing completion message of the second type of business request published in the message queue by monitoring, and triggers the execution of the corresponding first type of business request by executing the CountDown method of the CountDownLatch object, thereby improving the reliability of the parallel execution of the first type of business request.

[0053] According to a service request processing method provided by the present invention, blocking the execution of the first type of service request includes: blocking the execution of the first type of service request by calling the await method of the CountDownLatch object.

[0054] When the execution of the first type of service request is blocked, the execution of the first type of service request may be blocked by calling the await method of the CountDownLatch object.

[0055] It is understandable that the monitoring of the service request processing completion message, the parallel execution of the service request and the blocking of the service request may also be performed by other methods, and the use of JUC is only an optional implementation method.

[0056] The business request processing method provided by the present invention blocks the execution of the first type of business request by calling the await method of the CountDownLatch object, thereby improving the reliability of blocking the execution of the first type of business request.

[0057] According to a service request processing method provided by the present invention, the database is a redis database, and the message queue is a message queue implemented based on redis.

[0058] You can deploy redis on an independent service and use it to store structured data and publish and subscribe to messages in the message queue. An independent server is a server that is independent of the server that receives the business request. The server that receives the business request can access the redis database and subscribe to the published messages of the message queue.

[0059] The business request processing method provided by the present invention improves the convenience and reliability of storage data processing and message subscription and publishing by adopting redis to realize the database and the message queue.

[0060] According to a business request processing method provided by the present invention, the structured data is stored via a hash structure of redis.

[0061] Structured data can be stored through the hash structure of redis. Among them, the business data identifier can be represented by a hash value. Under the business data identifier represented by the hash value, the request type identifier and request status information are represented by a key-value structure. Among them, the request type identifier is the key value, and each key has two values, namely the request execution status and the number of pending requests.

[0062] The business request processing method provided by the present invention stores structured data through the hash structure of redis, thereby improving the convenience and reliability of structured data storage.

[0063] According to a business request processing method provided by the present invention, the method also includes: in response to the structured data corresponding to the business data identifier being stored in the database, and knowing from the structured data that there is no second type of business request being executed that is mutually exclusive with the first type of business request, executing the first type of business request and updating the structured data corresponding to the business data identifier.

[0064] After receiving the first type of business request sent by the business party, if it is known that structured data corresponding to the business data identifier is stored in the database, but it is known from the structured data that there is no second type of business request being executed and mutually exclusive with the first type of business request, for example, the information of the second type of business request mutually exclusive with the first type of business request does not exist in the structured data, then it means that there is no second type of business request being executed and mutually exclusive with the first type of business request, that is, no second type of business request mutually exclusive with the first type of business request is being executed, then the first type of business request sent by the business party can be executed immediately, and the structured data corresponding to the business data identifier is updated. Among them, if there is no relevant information of the first type of business request in the structured data, it is necessary to add the relevant information of the first type of business request to the structured data. If there is relevant information of the first type of business request in the structured data, for example, there is a first type of business request being executed on other services, then it is necessary to update the relevant information of the first type of business request to the structured data, such as updating the number of pending requests.

[0065] The business request processing method provided by the present invention responds to structured data corresponding to the business data identifier stored in the database, and based on the structured data, it is known that there is no second type of business request being executed and mutually exclusive with the first type of business request, then executes the first type of business request and updates the structured data corresponding to the business data identifier, thereby achieving rapid execution of business requests when no mutually exclusive requests are running, and improving the processing efficiency of business requests.

[0066] According to a business request processing method provided by the present invention, the method also includes: in response to the structured data corresponding to the business data identifier not being stored in the database, newly creating the structured data corresponding to the business data identifier and executing the first type of business request.

[0067] After receiving a first type of business request sent by the business party, if the database does not store structured data corresponding to the business data identifier, it means that no business request for the business data corresponding to the business data identifier is being executed. In this case, new structured data corresponding to the business data identifier is created, such as constructing and storing structured data based on the business data identifier and relevant information of the first type of business request, and executing the first type of business request.

[0068] The business request processing method provided by the present invention, in response to the fact that structured data corresponding to the business data identifier is not stored in the database, newly creates structured data corresponding to the business data identifier and executes a first type of business request, thereby realizing the construction of structured data and the execution of the business request when a business request for business data is received when no other business requests for the same business data are currently being processed.

[0069] Figure 3 This is the second flow chart of the service request processing method provided by the present invention. Figure 3 As shown, taking two mutually exclusive requests of deleting data and adding data as an example, the processing flow of the service request processing method provided by the present invention is further explained. Figure 3 As shown, the method includes: The server receives a business request sent by the business party; Determine whether the service request is a deletion request or a new addition request; wherein a deletion request refers to a request to delete data, and a new addition request refers to a request to add new data; If the business request is a deletion request, determine whether a new addition operation is in progress; If a new operation is in progress, the delete request is updated to pending, the delete request count is increased by 1, and the message queue is monitored. If the new operation completion notification is monitored, the delete request is updated to executing and the deletion task logic is executed; If there is no new operation in progress, the delete request count is increased by 1, the delete request is updated to be in progress, and the deletion task logic is executed; After executing the deletion task logic, the deletion request count is reduced by 1 to determine whether the deletion request count is 0; If the delete request count is 0, determine whether there are new requests to be executed; If there are new requests to be executed, a message is published that the deletion request has been processed, and the deletion request related information in the structured data is deleted, and the task is ended; If there is no new request to be executed, delete the deletion request related information in the structured data and end the task; If the delete request count is not 0, the task ends; If the business request is a new addition request, determine whether a deletion operation is in progress; If the deletion operation is in progress, the new request is updated to pending, the new request count is increased by 1, and the message queue is monitored. If the deletion operation completion notification is monitored, the new request is updated to executing and the new task logic is executed; If there is no ongoing deletion operation, the new request count is increased by 1, the new request is updated to be in progress, and the new task logic is executed; After executing the newly added task logic, the newly added request count is reduced by 1 to determine whether the newly added request count is 0; If the count of new requests is 0, determine whether there is a deletion request to be executed; If there is a deletion request to be executed, a message is published indicating that the new request has been processed, and the information related to the new request in the structured data is deleted, and the task is ended; If there is no deletion request to be executed, delete the new request related information in the structured data and end the task; If the new request count is not 0, the task ends.

[0070] The service request processing device provided by the present invention is described below. The service request processing device described below and the service request processing method described above can be referenced to each other.

[0071] Figure 4 Schematic diagram of the structure of the service request processing device provided by the present invention. Figure 4 As shown, the device includes a receiving module 10, a blocking module 20 and an execution module 30, wherein: the receiving module 10 is used to: receive a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier; the blocking module 20 is used to: in response to the structured data corresponding to the business data identifier stored in the database, and according to the structured data, it is known that there is a second type of business request being executed and mutually exclusive with the first type of business request, then block the execution of the first type of business request, and update the structured data corresponding to the business data identifier; wherein the structured data includes the business data identifier, the request type identifier and the request status information in descending order of level, and the request status information includes the request execution status and the number of requests to be processed; the execution module 30 is used to: in response to obtaining a processing completion message of the second type of business request, execute the first type of business request in parallel, and update the structured data corresponding to the business data identifier.

[0072] The business request processing device provided by the present invention receives a first type of business request sent by a business party, the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier. In response to the structured data corresponding to the business data identifier being stored in a database, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request based on the structured data, the execution of the first type of business request is blocked, and the structured data corresponding to the business data identifier is updated; wherein the structured data includes business data identifiers, request type identifiers and request status information from high to low levels, the request status information includes request execution status and the number of requests to be processed, and in response to obtaining a processing completion message of the second type of business request, the first type of business request is executed in parallel, thereby realizing mutually exclusive execution of requests of different types and concurrent execution of requests of the same type, thereby improving data processing efficiency on the basis of avoiding mutual influence of mutually exclusive operations.

[0073] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the business request processing method, which includes: receiving a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier; in response to the structured data corresponding to the business data identifier being stored in the database, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request according to the structured data, then blocking the execution of the first type of business request, and updating the structured data corresponding to the business data identifier; wherein the structured data includes the business data identifier, the request type identifier and request status information in descending order of level, and the request status information includes the request execution status and the number of requests to be processed; in response to obtaining a processing completion message of the second type of business request, executing the first type of business request in parallel, and updating the structured data corresponding to the business data identifier.

[0074] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0075] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the business request processing method provided by the above methods, the method comprising: receiving a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier; in response to the storage of structured data corresponding to the business data identifier in a database, and knowing that there is a second type of business request being executed and mutually exclusive with the first type of business request according to the structured data, blocking the execution of the first type of business request, and updating the structured data corresponding to the business data identifier; wherein the structured data includes the business data identifier, the request type identifier and request status information in descending order of level, and the request status information includes the request execution status and the number of requests to be processed; in response to obtaining a processing completion message of the second type of business request, executing the first type of business request in parallel, and updating the structured data corresponding to the business data identifier.

[0076] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented by a processor to execute the business request processing method provided by the above methods when executed by the processor, the method comprising: receiving a first type of business request sent by a business party; wherein the business request includes a business data identifier, a request type identifier and information about data to be processed, and the data to be processed is a subset of the business data corresponding to the business data identifier; in response to the storage of structured data corresponding to the business data identifier in a database, and knowing from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, the execution of the first type of business request is blocked, and the structured data corresponding to the business data identifier is updated; wherein the structured data includes the business data identifier, the request type identifier and request status information in descending order of level, and the request status information includes the request execution status and the number of requests to be processed; in response to obtaining a processing completion message of the second type of business request, executing the first type of business request in parallel, and updating the structured data corresponding to the business data identifier.

[0077] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for processing a business request, characterized in that: include: Receive a first type of service request sent by a service party; wherein the service request includes a service data identifier, a request type identifier, and information about data to be processed, and the data to be processed is a subset of the service data corresponding to the service data identifier; In response to the structured data corresponding to the business data identifier being stored in the database, and knowing from the structured data that there is a business request of the second type being executed and mutually exclusive with the business request of the first type, the execution of the business request of the first type is blocked, and the structured data corresponding to the business data identifier is updated; wherein the structured data includes the business data identifier, the request type identifier and the request status information in descending order of levels, and the request status information includes the request execution status and the number of requests to be processed; In response to obtaining a processing completion message of the second type of service request, the first type of service request is executed in parallel, and the structured data corresponding to the service data identifier is updated.

2. The service request processing method according to claim 1, characterized in that: After the parallel execution of the service requests of the first type, the method further includes: In response to the number of pending requests being 0 and there being pending business requests of the second type, publishing a processing completion message of the first type of business request to a message queue, and deleting information of the first type of business request in the structured data; In response to the number of pending requests being 0 and there being no pending business requests of the second type, directly deleting the information of the business requests of the first type in the structured data; The processing completion message includes the service data identifier, the request type identifier and the processing completion identifier.

3. The service request processing method according to claim 2, characterized in that: After the response is that the database stores structured data corresponding to the business data identifier, and after it is learned from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, the method further includes: Create a CountDownLatch object of JUC, and use the CountDownLatch object as a parameter to asynchronously monitor the published message of the message queue; wherein the CountDownLatch object corresponds to the business request one by one, and the published message includes a processing completion message of the second type of business request.

4. The service request processing method according to claim 3, characterized in that: The step of executing the service request of the first type in parallel in response to obtaining the processing completion message of the service request of the second type includes: In response to monitoring a processing completion message of the second type of service request published in the message queue, the execution of the corresponding first type of service request is triggered by executing the CountDown method of the CountDownLatch object.

5. The service request processing method according to claim 3, characterized in that: The blocking the execution of the first type of service request includes: The execution of the first type of service request is blocked by calling the await method of the CountDownLatch object.

6. The service request processing method according to claim 3, characterized in that: The database is a redis database, and the message queue is a message queue implemented based on redis.

7. The service request processing method according to claim 6, characterized in that: The structured data is stored via the hash structure of redis.

8. The service request processing method according to claim 1, characterized in that: The method further comprises: In response to the structured data corresponding to the business data identifier being stored in the database, and knowing from the structured data that there is no second type of business request being executed that is mutually exclusive with the first type of business request, the first type of business request is executed and the structured data corresponding to the business data identifier is updated.

9. The service request processing method according to claim 1, characterized in that: The method further comprises: In response to the structured data corresponding to the service data identifier not being stored in the database, the structured data corresponding to the service data identifier is newly created, and the service request of the first type is executed.

10. A service request processing device, characterized in that: include: A receiving module, configured to: receive a first type of service request sent by a service party; wherein the service request includes a service data identifier, a request type identifier, and information about data to be processed, and the data to be processed is a subset of the service data corresponding to the service data identifier; A blocking module, configured to: in response to the structured data corresponding to the business data identifier being stored in a database, and knowing from the structured data that there is a second type of business request being executed and mutually exclusive with the first type of business request, block the execution of the first type of business request, and update the structured data corresponding to the business data identifier; wherein the structured data includes the business data identifier, the request type identifier and request status information in descending order of levels, and the request status information includes the request execution status and the number of pending requests; The execution module is used for: in response to obtaining a processing completion message of the second type of business request, executing the first type of business request in parallel and updating the structured data corresponding to the business data identifier.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the service request processing method according to any one of claims 1 to 9 is implemented.

12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the service request processing method according to any one of claims 1 to 9 is implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the service request processing method according to any one of claims 1 to 9 is implemented.