Data processing method and device, computer device and medium

By receiving and processing multiple data processing requests and using a thread pool to determine and update the total number of resources, the request latency problem caused by the locking mechanism is solved, and efficient data processing is achieved.

CN114265688BActive Publication Date: 2025-12-09BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111442401.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2025-12-09
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

In high-concurrency scenarios, data processing methods based on lock mechanisms cause threads that do not hold locks to be in a waiting state, resulting in request delays and reduced data processing efficiency.

Method used

By receiving multiple data processing requests, the total number of processing resources for the target account is determined and updated based on this total number. The target thread pool is used to split tasks and aggregate results to achieve batch processing and avoid duplicate updates.

Benefits of technology

It improves the efficiency of data processing, avoids request delays, and ensures the accuracy and security of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114265688B_ABST
    Figure CN114265688B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method and device, computer equipment and medium, and belongs to the technical field of Internet. In the present disclosure, when a plurality of data processing requests initiated by a user are received, the total number of processing resources of the plurality of data processing requests is determined based on the number of processing resources indicated by the plurality of data processing requests, and then the number of resources of the user account is updated based on the total number of processing resources. In this way, the effect of updating the account only once based on multiple data processing requests is achieved, and the corresponding data processing of the data processing request does not need to be performed sequentially, thereby avoiding the problem of request delay and improving the efficiency of data processing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of Internet, and particularly relates to a data processing method and device, computer equipment and medium. BACKGROUND

[0002] In the high concurrency scenario of the Internet, an account involving high-frequency operations is generally referred to as a hot account. For example, in a consumption scenario, there may be a large number of requests triggering data processing on an account at the same time, such as updating the balance of the account, at which time the account is a hot account.

[0003] Currently, when a plurality of requests are received, when data processing is performed on an account (hot account) based on a request, in order to ensure that the account is not affected by other requests except the current request in terms of data accuracy, the account is generally locked, only the thread holding the lock can perform data processing on the account based on the corresponding request, and other threads must wait for the lock to be released before performing data processing based on the corresponding request.

[0004] However, in the above-mentioned technology, the lock mechanism is used to implement the one-by-one processing of each request, so that the threads that do not hold the lock can only be in a waiting state, which may cause request delay problems and reduce the efficiency of data processing. SUMMARY

[0005] The present disclosure provides a data processing method and device, computer equipment and medium, which can avoid the problem of request delay and improve the efficiency of data processing. The technical solutions of the present disclosure are as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a data processing method is provided, which comprises:

[0007] receiving a plurality of data processing requests;

[0008] determining the total number of processing resources of a target account based on the plurality of data processing requests;

[0009] updating the resource number of the target account based on the total number of processing resources of the target account.

[0010] In the embodiment of the present disclosure, when a plurality of data processing requests initiated by a user are received, the total number of processing resources of the plurality of data processing requests is determined based on the processing resource numbers indicated by the plurality of data processing requests, and the resource number of the user account is updated based on the total number of processing resources, thereby realizing the effect of updating the account only once based on multiple data processing requests, without sequentially executing the data processing corresponding to the data processing requests, avoiding the problem of request delay and improving the efficiency of data processing.

[0011] In some embodiments, determining the total number of processing resources of the target account based on the plurality of data processing requests comprises:

[0012] Based on the plurality of data processing requests, generating a plurality of data processing records of the target account, wherein the data processing record is used to record event information of a data processing event corresponding to the data processing request;

[0013] Based on the number of processing resources in the plurality of generated data processing records, determining the total number of processing resources of the target account.

[0014] In the embodiments of the present disclosure, when receiving a plurality of data processing requests initiated by a user, a data processing record corresponding to each data processing request is generated to record event information of a data processing event corresponding to the data processing request, and the total number of processing resources of the plurality of data processing requests is obtained, so as to subsequently update the number of resources of the target account based on the total number of processing resources.

[0015] In some embodiments, generating a plurality of data processing records of the target account based on the plurality of data processing requests comprises:

[0016] Encapsulating the plurality of data processing requests into a to-be-processed task, and inputting the to-be-processed task into a target thread pool;

[0017] Generating, by the target thread pool, a plurality of data processing records of the target account based on the to-be-processed task, the target thread pool being provided with a function of splitting processing of tasks.

[0018] In the embodiments of the present disclosure, the plurality of data processing requests are split and processed based on the target thread pool, which realizes batch processing of the plurality of data processing requests, improves the efficiency of processing the data processing requests, and avoids resource consumption caused by thread waiting.

[0019] In some embodiments, generating, by the target thread pool, a plurality of data processing records of the target account based on the to-be-processed task comprises:

[0020] Splitting, by the target thread pool, the to-be-processed task into a plurality of subtasks, the plurality of subtasks being respectively associated with corresponding data processing requests;

[0021] Generating, by a plurality of threads in the target thread pool, a plurality of data processing records of the target account based on the data processing requests associated with the plurality of subtasks, respectively.

[0022] In the embodiments of the present disclosure, the plurality of data processing requests are processed by the plurality of threads in the target thread pool, respectively, which realizes batch processing of the plurality of data processing requests and improves the efficiency of processing the data processing requests.

[0023] In some embodiments, the target thread pool further provides a function of aggregating the processing results;

[0024] The determining the total number of processing resources of the target account based on the number of processing resources in the generated plurality of data processing records comprises:

[0025] The aggregating, by the target thread pool, the number of processing resources in the generated plurality of data processing records to obtain the total number of processing resources of the target account.

[0026] In the batch processing process in the embodiments of the present disclosure, the processing results are asynchronously obtained by multiple threads, and then the aggregation of the processing results is performed, thereby finally realizing the effect of synchronous processing.

[0027] In some embodiments, the updating the number of resources of the target account based on the total number of processing resources of the target account comprises any one of the following:

[0028] If the plurality of data processing requests are withdrawal requests, the number of resources of the target account is updated to a first number of resources, the first number of resources being a number of resources obtained by deducting the total number of processing resources from the number of resources;

[0029] If the plurality of data processing requests are deposit requests, the number of resources of the target account is updated to a second number of resources, the second number of resources being a number of resources obtained by adding the total number of processing resources to the number of resources.

[0030] In the embodiments of the present disclosure, when the plurality of withdrawal requests initiated by the user are received, the number of resources of the user account is updated based on the total number of processing resources of the plurality of withdrawal requests, or when the plurality of deposit requests initiated by the user are received, the number of resources of the user account is updated based on the total number of processing resources of the plurality of deposit requests, thereby realizing the effect of updating the account only once based on multiple data processing requests, avoiding the problem of request delay, and improving the efficiency of data processing.

[0031] In some embodiments, after receiving the plurality of data processing requests, the method further comprises at least one of the following:

[0032] Based on the first password parameter carried by the plurality of data processing requests, the accounts corresponding to the plurality of data processing requests are verified, and based on the data processing requests after the account verification, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed;

[0033] The plurality of data processing requests carries a processing event identifier, and whether the plurality of data processing requests satisfies an idempotency condition is checked based on the processing event identifier, and the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is executed based on the data processing request satisfying the idempotency condition;

[0034] The plurality of data processing requests carries a processing resource quantity, and whether the processing resource quantity satisfies a processing resource condition is checked based on the processing resource quantity, and the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is executed based on the data processing request satisfying the processing resource condition;

[0035] The plurality of data processing requests carries a data processing type, and whether the data processing type satisfies a data processing type condition is checked based on the data processing type, and the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is executed based on the data processing request satisfying the data processing type condition.

[0036] In the embodiments of the present disclosure, the account sending the data processing request is checked to ensure the security of data processing; the idempotency condition of the data processing request is checked to ensure the accuracy and security of data processing; the processing resource quantity carried by the data processing request is checked to ensure the accuracy and security of data processing; and the data processing type carried by the data processing request is checked to ensure the accuracy and security of data processing.

[0037] In some embodiments, the first password parameter is generated by a terminal corresponding to the account based on account information and a communication key provided by a server;

[0038] The checking of the account corresponding to the plurality of data processing requests based on the first password parameter carried by the plurality of data processing requests comprises:

[0039] For any data processing request, a second password parameter is generated based on the account information carried by the data processing request and the communication key;

[0040] If the first password parameter and the second password parameter carried by the data processing request are the same, it is determined that the account passes the check.

[0041] In the embodiments of the present disclosure, the account of the data processing request is checked by judging whether the password parameter carried by the data processing request and the password parameter generated by the server are the same, to ensure the security of data processing.

[0042] In some embodiments, after receiving the plurality of data processing requests, the method further comprises:

[0043] If the number of data processing requests received in a unit time reaches a target threshold, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed.

[0044] In the embodiments of the present disclosure, whether the target account corresponding to the data processing request is a hot account is determined by judging whether the number of data processing requests received in a unit time reaches the target threshold. If the target account is a hot account, subsequent steps are performed for processing. This achieves the effect of updating the hot account once based on multiple data processing requests of the hot account, avoids request delays, and improves the efficiency of data processing.

[0045] In some embodiments, the method further comprises:

[0046] A cache distributed resource proxy object of the target account is constructed, and a threshold judgment code is called through the cache distributed resource proxy object to determine whether the number of data processing requests received in a unit time reaches the target threshold.

[0047] In the embodiments of the present disclosure, a cache distributed resource proxy object of the target account is constructed to call a threshold judgment code based on the cache distributed resource proxy object to perform the judgment process of the target threshold.

[0048] In some embodiments, the method further comprises:

[0049] Based on the receiving order of the plurality of data processing requests, the plurality of data processing requests are sequentially added to a request queue for storing data processing requests to be processed.

[0050] Based on the plurality of data processing requests in the request queue, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed.

[0051] In the embodiments of the present disclosure, the plurality of data processing requests are grouped into a collection by setting a request queue, and then the subsequent batch processing process is performed, which improves the efficiency of data processing.

[0052] In some embodiments, sequentially adding the plurality of data processing requests to the request queue based on the receiving order of the plurality of data processing requests comprises:

[0053] Every target time interval, the plurality of data processing requests received in the target time interval are obtained;

[0054] Based on the receiving order of the plurality of data processing requests received in the target time interval, the plurality of data processing requests in the target time interval are sequentially added to the request queue.

[0055] In the embodiments of the present disclosure, every interval target time length, a plurality of data processing requests in the target time length are added to the request queue, and then the plurality of data processing requests in the request queue are processed in batches, thereby improving the efficiency of data processing.

[0056] In some embodiments, before sequentially adding the plurality of data processing requests to the request queue based on the receiving order of the plurality of data processing requests, the method further comprises:

[0057] adding a read lock to the request queue;

[0058] After sequentially adding the plurality of data processing requests to the request queue based on the receiving order of the plurality of data processing requests, the method further comprises:

[0059] releasing the read lock and adding a write lock to the request queue.

[0060] In the embodiments of the present disclosure, by adding a read lock to the request queue, only the thread that obtains the read lock can execute the process of adding the data processing request to the request queue in response to the data processing request; by adding a write lock to the request queue, only the thread that obtains the write lock can execute the process of generating the data processing record in response to the data processing request, so as to ensure that no new element is added to the request queue.

[0061] According to a second aspect of the present disclosure, a data processing apparatus is provided, which comprises:

[0062] a receiving unit configured to receive a plurality of data processing requests;

[0063] a determining unit configured to determine a total number of processing resources of a target account based on the plurality of data processing requests;

[0064] an updating unit configured to update the number of resources of the target account based on the total number of processing resources of the target account.

[0065] In some embodiments, the determining unit comprises:

[0066] a generating sub-unit configured to generate a plurality of data processing records of the target account based on the plurality of data processing requests, wherein the data processing record is used to record event information of a data processing event corresponding to the data processing request;

[0067] a determining sub-unit configured to determine the total number of processing resources of the target account based on the number of processing resources in the generated plurality of data processing records.

[0068] In some embodiments, the generating sub-unit comprises:

[0069] The input sub-module is configured to encapsulate the plurality of data processing requests into one to-be-processed task, and input the to-be-processed task into a target thread pool which is provided with a function of processing the task in a split manner.

[0070] The generation sub-module is configured to generate, by the target thread pool, a plurality of data processing records of the target account based on the to-be-processed task.

[0071] In some embodiments, the generation sub-module is configured to perform:

[0072] The target thread pool splits the to-be-processed task into a plurality of sub-tasks, and the plurality of sub-tasks are respectively associated with the corresponding data processing requests;

[0073] The target thread pool generates, by a plurality of threads in the target thread pool, a plurality of data processing records of the target account based on the data processing requests associated with the plurality of sub-tasks.

[0074] In some embodiments, the target thread pool is further provided with a function of aggregating the processing results;

[0075] The determination sub-unit is configured to perform:

[0076] The target thread pool aggregates the number of processing resources in the generated plurality of data processing records to obtain the total number of processing resources of the target account.

[0077] In some embodiments, the update unit is configured to perform any one of the following:

[0078] If the plurality of data processing requests are withdrawal requests, the resource quantity of the target account is updated to a first resource quantity, and the first resource quantity is obtained by deducting the total number of processing resources from the resource quantity;

[0079] If the plurality of data processing requests are deposit requests, the resource quantity of the target account is updated to a second resource quantity, and the second resource quantity is obtained by adding the total number of processing resources to the resource quantity.

[0080] In some embodiments, the apparatus further comprises at least one of the following:

[0081] The first verification unit is configured to verify the accounts corresponding to the plurality of data processing requests based on the first password parameter carried by the plurality of data processing requests, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on the data processing requests whose account verification is passed;

[0082] The second checking unit is configured to check whether the plurality of data processing requests satisfy an idempotency condition based on processing event identifiers carried by the plurality of data processing requests, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on data processing requests satisfying the idempotency condition.

[0083] The third checking unit is configured to check whether the processing resource quantity carried by the plurality of data processing requests satisfies a processing resource condition, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on data processing requests satisfying the processing resource condition.

[0084] The fourth checking unit is configured to check whether the data processing type carried by the plurality of data processing requests satisfies a data processing type condition, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on data processing requests satisfying the data processing type condition.

[0085] In some embodiments, the first cryptographic parameter is generated by a terminal corresponding to the account based on account information and a communication key provided by a server.

[0086] The first checking unit is configured to perform:

[0087] For any data processing request, a second cryptographic parameter is generated based on account information carried by the data processing request and the communication key.

[0088] If the first cryptographic parameter carried by the data processing request and the second cryptographic parameter are the same, it is determined that the account passes the check.

[0089] In some embodiments, the receiving unit is further configured to perform:

[0090] If the number of data processing requests received within a unit time period reaches a target threshold value, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed.

[0091] In some embodiments, the apparatus further comprises a judging unit configured to perform:

[0092] The cached distributed resource proxy object of the target account is constructed, and threshold value judging code is called through the cached distributed resource proxy object to judge whether the number of data processing requests received within a unit time period reaches the target threshold value.

[0093] In some embodiments, the apparatus further comprises:

[0094] The adding unit is configured to add the plurality of data processing requests into a request queue in sequence based on a receiving order of the plurality of data processing requests, the request queue being used to store data processing requests to be processed.

[0095] The determining unit is further configured to determine the total number of processing resources of the target account based on the plurality of data processing requests in the request queue.

[0096] In some embodiments, the adding unit is configured to:

[0097] Every interval of a target time length, obtain the plurality of data processing requests received in the target time length;

[0098] Add the plurality of data processing requests in the target time length into the request queue in sequence based on a receiving order of the plurality of data processing requests received in the target time length.

[0099] In some embodiments, the adding unit is further configured to add a read lock for the request queue.

[0100] The adding unit is further configured to release the read lock and add a write lock for the request queue.

[0101] According to a third aspect of embodiments of the present disclosure, a computer device is provided, the computer device comprising:

[0102] one or more processors;

[0103] a memory for storing program code executable by the processor;

[0104] wherein the processor is configured to execute the program code to implement the data processing method described above.

[0105] According to a fourth aspect of embodiments of the present disclosure, a computer readable storage medium is provided, the computer readable storage medium comprising: when program code in the computer readable storage medium is executed by a processor of a computer device, the computer device is enabled to execute the data processing method described above.

[0106] According to a fifth aspect of embodiments of the present disclosure, a computer program product is provided, comprising a computer program, the computer program being executed by a processor to implement the data processing method described above.

[0107] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0108] The accompanying drawings, which are incorporated into and form a part of the specification, illustrate an embodiment consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure without imposing on the disclosure any undue limitations.

[0109] Figure 1 is a schematic diagram of an implementation environment of a data processing method according to an exemplary embodiment;

[0110] Figure 2 is a flowchart of a data processing method according to an exemplary embodiment;

[0111] Figure 3 is a flowchart of a data processing method according to an exemplary embodiment;

[0112] Figure 4 is a flowchart of a threshold judgment according to an exemplary embodiment;

[0113] Figure 5 is a flowchart of a data processing verification according to an exemplary embodiment;

[0114] Figure 6 is a flowchart of a buffer triggering mode according to an exemplary embodiment;

[0115] Figure 7 is a flowchart of a data processing method according to an exemplary embodiment;

[0116] Figure 8 is a block diagram of a data processing device according to an exemplary embodiment;

[0117] Figure 9 is a structural block diagram of a terminal according to an exemplary embodiment;

[0118] Figure 10 is a structural block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION

[0119] In order for those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings.

[0120] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. The implementation described in the following exemplary embodiments does not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0121] The data involved in the present disclosure can be data authorized by a user or sufficiently authorized by parties.

[0122] First, the application scenarios involved in the embodiments of the present disclosure are described:

[0123] The data processing method involved in the embodiments of the present disclosure can be applied to high-concurrency scenarios in the computer field, and specifically can be applied to hot issues in high-concurrency scenarios. In the computer field, there can be a large number of services simultaneously requesting a certain resource, which exceeds the processing capacity of the resource, at which time the resource becomes a hot spot, which can cause unpredictable consequences.

[0124] For example, in a consumption scenario, there can be a large number of requests simultaneously triggering data processing on a certain account stored in a mysql database, at which time the account is also a hot account. Among them, the consumption scenario usually involves transaction processing processes such as account balance verification, account balance update, and consumption record writing. Taking the account balance update as an example, when there are a large number of requests simultaneously triggering update operations on the balance of the account, the account is also a hot account.

[0125] It should be noted that when data processing is performed on an account based on a request, in order to ensure that the account is not affected by other requests except the current request to affect the accuracy of the data, only one thread can be allowed to perform data processing based on the corresponding request at the same time. For example, in a consumption scenario, when a user simultaneously initiates multiple consumption requests, since the user's account balance is limited, in order to prevent overspending, only one thread can be allowed to update the account balance based on the corresponding request at the same time.

[0126] In the related art, when a plurality of requests are received, when data processing is performed on an account based on one request, the account is usually locked, only the thread holding the lock can perform data processing on the account based on the corresponding request, and after the data processing is completed, the lock is released, and other threads must wait for the lock to be released before performing data processing based on the corresponding request. In the technical solution shown in the related art, when multiple requests are waiting at the same time, multiple requests will compete for the lock, causing the problem of lock competition, so that threads that do not hold the lock can only be in a waiting state, causing the problem of request delay, and reducing the efficiency of data processing.

[0127] The embodiment of the present disclosure provides a data processing method, which can be applied to the process of data processing on a hot account in a consumption scenario. Through the data processing method provided by the embodiment of the present disclosure, the problem of request delay can be avoided when a user initiates multiple consumption requests to become a hot account at the same time, and the effect of ensuring that the user does not spend more and does not block the user's consumption behavior can be achieved.

[0128] Figure 1 is a schematic diagram of an implementation environment of a data processing method provided by the embodiment of the present disclosure, referring to Figure 1 The implementation environment includes a terminal 101 and a server 102.

[0129] The terminal 101 can be at least one of a smart phone, a smart watch, a desktop computer, a laptop computer, a virtual reality terminal, an augmented reality terminal, a wireless terminal, and a laptop computer. The terminal 101 has a communication function and can access a wired network or a wireless network. The terminal 101 can generally refer to one of a plurality of terminals, and the embodiment is only exemplified by the terminal 101. Those skilled in the art can know that the number of the above-mentioned terminals can be more or less.

[0130] The terminal 101 can run various types of application programs, such as social application programs, live broadcast application programs, shopping application programs, and the like. Taking the live broadcast application program as an example, in the live broadcast application program running on the terminal 101, virtual currency can be obtained by recharging, and the user can purchase props or gifts for consumption by using the virtual currency in the process of watching live broadcast or short video.

[0131] The server 102 can be a standalone physical server, a server cluster composed of multiple physical servers, or a distributed file system. The server 102 can also be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms. The server 102 and the terminal 101 can be directly or indirectly connected through wired or wireless communication. The number of servers 102 can be more or less. The server 102 can also include other functional servers to provide more comprehensive and diversified services.

[0132] In the embodiments of the present disclosure, the terminal 101 is configured to send a plurality of data processing requests based on a target account to the server 102 in response to a plurality of data processing operations based on the target account, so as to trigger the server 102 to determine a total number of processing resources of the target account based on the plurality of data processing requests, and update a resource number of the target account based on the total number of processing resources of the target account.

[0133] Figure 2 A flowchart of a data processing method according to an example embodiment is shown in FIG. 2. As shown in FIG. 2, the method is performed by a server and includes the following steps: Figure 2

[0134] In step 201, the server receives a plurality of data processing requests.

[0135] The plurality of data processing requests are respectively used to request to update a resource number of a target account.

[0136] In step 202, the server determines a total number of processing resources of the target account based on the plurality of data processing requests.

[0137] The total number of processing resources represents a total number of processing resource numbers indicated by the plurality of data processing requests.

[0138] In step 203, the server updates the resource number of the target account based on the total number of processing resources of the target account.

[0139] ​The technical scheme provided by the embodiments of the present disclosure, when receiving a plurality of data processing requests initiated by a user, determines a total quantity of processing resources of the plurality of data processing requests based on a quantity of processing resources indicated by the plurality of data processing requests, and then updates a quantity of resources of the user account based on the total quantity of processing resources. In this way, the effect of updating the account only once based on multiple data processing requests is achieved, and the problem of request delay is avoided by not sequentially performing data processing corresponding to the data processing requests, thereby improving the efficiency of data processing.

[0140] In some embodiments, determining the total quantity of processing resources of the target account based on the plurality of data processing requests comprises:

[0141] Based on the plurality of data processing requests, a plurality of data processing records of the target account are generated, wherein the data processing record is used to record event information of a data processing event corresponding to the data processing request;

[0142] Based on the quantity of processing resources in the generated plurality of data processing records, the total quantity of processing resources of the target account is determined.

[0143] In some embodiments, generating a plurality of data processing records of the target account based on the plurality of data processing requests comprises:

[0144] The plurality of data processing requests are encapsulated into a to-be-processed task, and the to-be-processed task is input into a target thread pool;

[0145] Based on the to-be-processed task, the target thread pool generates a plurality of data processing records of the target account, and the target thread pool is provided with a function of splitting tasks.

[0146] In some embodiments, based on the to-be-processed task, the target thread pool generates a plurality of data processing records of the target account, and the target thread pool is provided with a function of splitting tasks.

[0147] The target thread pool splits the to-be-processed task to obtain a plurality of sub-tasks, and the plurality of sub-tasks are respectively associated with corresponding data processing requests;

[0148] Based on the data processing requests associated with the plurality of sub-tasks, the target thread pool generates a plurality of data processing records of the target account.

[0149] In some embodiments, the target thread pool is also provided with a function of aggregating processing results;

[0150] The total quantity of processing resources of the target account is determined based on the quantity of processing resources in the generated plurality of data processing records, and the total quantity of processing resources of the target account is determined based on the total quantity of processing resources.

[0151] The processing resource total quantity of the target account is obtained by aggregating the processing resource quantities in the generated multiple data processing records.

[0152] In some embodiments, updating the resource quantity of the target account based on the processing resource total quantity of the target account comprises any one of the following:

[0153] If the multiple data processing requests are withdrawal requests, the resource quantity of the target account is updated to a first resource quantity, which is obtained by deducting the processing resource total quantity from the resource quantity;

[0154] If the multiple data processing requests are deposit requests, the resource quantity of the target account is updated to a second resource quantity, which is obtained by adding the processing resource total quantity to the resource quantity.

[0155] In some embodiments, after receiving the multiple data processing requests, the method further comprises at least one of the following:

[0156] Based on the first password parameter carried by the multiple data processing requests, the accounts corresponding to the multiple data processing requests are verified, and based on the data processing requests that pass the account verification, the step of determining the processing resource total quantity of the target account based on the multiple data processing requests is performed;

[0157] Based on the processing event identifier carried by the multiple data processing requests, it is verified whether the multiple data processing requests satisfy the idempotency condition, and based on the data processing requests that satisfy the idempotency condition, the step of determining the processing resource total quantity of the target account based on the multiple data processing requests is performed;

[0158] Based on the processing resource quantity carried by the multiple data processing requests, it is verified whether the processing resource quantity satisfies the processing resource condition, and based on the data processing requests that satisfy the processing resource condition, the step of determining the processing resource total quantity of the target account based on the multiple data processing requests is performed;

[0159] Based on the data processing type carried by the multiple data processing requests, it is verified whether the data processing type satisfies the data processing type condition, and based on the data processing requests that satisfy the data processing type condition, the step of determining the processing resource total quantity of the target account based on the multiple data processing requests is performed.

[0160] In some embodiments, the first password parameter is generated by a terminal corresponding to the account based on account information and a communication key provided by a server;

[0161] The verification of the accounts corresponding to the multiple data processing requests based on the first password parameter carried by the multiple data processing requests comprises:

[0162] For any data processing request, a second cryptographic parameter is generated based on account information carried by the data processing request and the communication key;

[0163] If the first cryptographic parameter carried by the data processing request and the second cryptographic parameter are the same, it is determined that the account verification is passed.

[0164] In some embodiments, after receiving a plurality of data processing requests, the method further comprises:

[0165] If the number of data processing requests received within a unit time reaches a target threshold, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed.

[0166] In some embodiments, the method further comprises:

[0167] The cache distributed resource proxy object of the target account is constructed, and the threshold judgment code is called through the cache distributed resource proxy object to determine whether the number of data processing requests received within a unit time reaches the target threshold.

[0168] In some embodiments, the method further comprises:

[0169] Based on the receiving order of the plurality of data processing requests, the plurality of data processing requests are sequentially added to a request queue, and the request queue is used to store data processing requests to be processed;

[0170] Based on the plurality of data processing requests in the request queue, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed.

[0171] In some embodiments, based on the receiving order of the plurality of data processing requests, the plurality of data processing requests are sequentially added to a request queue, which comprises:

[0172] Every target time interval, the plurality of data processing requests received within the target time interval are obtained;

[0173] Based on the receiving order of the plurality of data processing requests received within the target time interval, the plurality of data processing requests within the target time interval are sequentially added to a request queue.

[0174] In some embodiments, before the plurality of data processing requests are sequentially added to the request queue based on the receiving order of the plurality of data processing requests, the method further comprises:

[0175] A read lock is added to the request queue;

[0176] After the plurality of data processing requests are sequentially added into the request queue based on the receiving sequence of the plurality of data processing requests, the method further includes:

[0177] releasing the read lock and adding a write lock for the request queue.

[0178] The above Figure 2 The above Figure 3 is a flowchart of a data processing method according to an example embodiment, referring to Figure 3 The method includes:

[0179] In step 301, the terminal sends a plurality of data processing requests to the server in response to a plurality of data processing operations based on a target account.

[0180] In the embodiments of the present disclosure, the terminal can run various different types of application programs, such as social application programs, live broadcast application programs, shopping application programs, and the like. Taking the live broadcast application program as an example, in the live broadcast application program running on the terminal, virtual currency can be obtained by recharging, and the user can purchase props or gifts for consumption by using the virtual currency in the process of watching live broadcast or short videos. In the embodiments of the present disclosure, the subsequent scenario is based on the transaction scenario of the virtual currency, and accordingly, the data processing operation is the transaction operation, and the data processing request is the transaction request. The plurality of data processing requests (i.e., the plurality of transaction requests) are respectively used to request to update the resource quantity of the target account. The target account is a user account to be processed for data processing, i.e., a user account to be processed for transaction processing. Understandably, the target account is also the user account corresponding to the logged-in account of the terminal.

[0181] In some embodiments, the application running on the terminal is provided with a data processing portal, such as a transaction portal, for triggering a data processing request based on the target account. In an optional embodiment, taking the scenario of gifting virtual gifts in a live room as an example, the data processing portal can be a gifting control of virtual gifts, and correspondingly, the data processing operation can be a triggering operation on the gifting control of virtual gifts. For example, when a user wants to gift multiple virtual gifts to a host account in a live room, multiple triggering operations can be performed on the gifting control of virtual gifts in the live room. Then, the terminal sends multiple data processing requests based on the target account to the server in response to multiple data processing operations based on the target account. In an optional embodiment, taking the scenario of rewarding virtual currency for a short video as an example, the data processing portal can be a rewarding control of virtual currency, and correspondingly, the data processing operation can be a triggering operation on the rewarding control of virtual currency. For example, when a user wants to reward multiple virtual currencies to a publisher of a short video, multiple triggering operations can be performed on the rewarding control of virtual currency in the play interface of the short video. Then, the terminal sends multiple data processing requests based on the target account to the server in response to multiple data processing operations based on the target account.

[0182] In other embodiments, the data processing portal is used to trigger the execution of a data processing flow (i.e., a transaction flow or a payment flow) based on the target account. In an optional embodiment, taking the scenario of gifting virtual gifts in a live room as an example, the data processing portal can be a gifting control of virtual gifts, and correspondingly, the data processing operation can be a payment completion operation based on the gifting control of virtual gifts. For example, when a user wants to gift multiple virtual gifts to a host account in a live room, multiple triggering operations can be performed on the gifting control of virtual gifts in the live room. Then, the terminal displays a payment page of the virtual gifts in response to the triggering operation on the gifting control of virtual gifts, and triggers the terminal to send multiple data processing requests based on the target account to the server in response to a payment completion operation in the payment page of the virtual gifts, where the payment page of the virtual gifts includes electronic orders of multiple virtual gifts.

[0183] In step 302, the server receives the multiple data processing requests.

[0184] In some embodiments, after the server receives the multiple data processing requests based on the target account, the server checks the multiple data processing requests based on the information carried by the multiple data processing requests to check whether the multiple data processing requests meet data processing conditions, and then performs subsequent data processing processes based on the data processing requests that meet the data processing conditions, so as to ensure the safe performance of data processing. The checking process of the multiple data processing requests is described below based on steps 303 to 306.

[0185] In step 303, the server checks the account corresponding to the plurality of data processing requests based on the first password parameter carried by the plurality of data processing requests, and executes step 304 based on the data processing request after the account check.

[0186] In the embodiment of the present disclosure, the scheme is described by taking the plurality of data processing requests triggered based on the target account as an example. In this embodiment, the accounts corresponding to the plurality of data processing requests are the same account, and the target account is used to refer to the same account corresponding to the plurality of data processing requests in the embodiment of the present disclosure.

[0187] In other embodiments, the user can also trigger a plurality of data processing requests based on data processing operations of different accounts. In this embodiment, the accounts corresponding to the plurality of data processing requests are not the same account. At this time, the target account is used to refer to any one of the accounts corresponding to the plurality of data processing requests, that is, the number of target accounts can be one, two or more. For example, it is assumed that in the plurality of data processing requests triggered based on different accounts, a part of the data processing requests correspond to account 1, and another part of the data processing requests correspond to account 2. At this time, the target account can be account 1 or account 2.

[0188] The first password parameter is generated by the terminal based on the account information and the communication key provided by the server. In some embodiments, the account information is the identity information of the corresponding user, and the identity information is information used to represent the identity of the user, such as a user account. Accordingly, the process of checking the account is also the process of checking the identity of the user corresponding to the account. The communication key is a specified length of digital code agreed in advance between the terminal and the server. The communication key is used to encrypt the communication content when the terminal and the server communicate, to ensure the security of the communication process. In some embodiments, taking a live application program as an example, when the terminal logs in to the live application program for the first time, the server will send the communication key to the terminal, and then the terminal receives the communication key and stores it locally. Then, the terminal can obtain the communication key from the local when communicating with the server to generate the first password parameter.

[0189] In some embodiments, the process of checking the account corresponding to the plurality of data processing requests by the server includes: for any data processing request, the server generates a second password parameter based on the account information carried by the data processing request and the communication key, judges whether the first password parameter carried by the data processing request and the second password parameter are the same, if the first password parameter carried by the data processing request and the second password parameter are the same, it is determined that the account check is passed, if the first password parameter and the second password parameter are different, it is determined that the account check is not passed.

[0190] In this embodiment, the account is verified by judging whether the password parameter carried by the data processing request is same as the password parameter generated by the server, so as to ensure the security of data processing.

[0191] In some embodiments, the plurality of data processing requests also carry an account password of the user account, and before verifying the account, the server also verifies the user account corresponding to the plurality of data processing requests based on the user account and the account password carried by the plurality of data processing requests. The corresponding process is that the server queries the account information library based on the user account carried by the plurality of data processing requests to determine the account password corresponding to the user account. The account information library is used to store a plurality of user accounts and the account passwords corresponding to the plurality of user accounts. If the determined account password is same as the account password carried by the data processing request, it is determined that the user account verification is passed. If the determined account password is different from the account password carried by the data processing request, it is determined that the user account verification is not passed. In this way, the security of data processing can be further ensured.

[0192] In step 304, the server verifies whether the data processing request after the account verification satisfies the idempotency condition based on the processing event identifier carried by the data processing request after the account verification, and executes step 305 based on the data processing request satisfying the idempotency condition.

[0193] The processing event identifier is used to identify a processing event. In some embodiments, the processing event is a transaction event, for example, the processing event identifier can be represented by the transaction time of the transaction event. The idempotency condition means that one and multiple requests for a resource should have the same result on the resource itself, that is, the impact of any multiple requests on the resource itself is the same as the impact of one request. For example, it is assumed that the user clicks the submit order button on the application program multiple times in succession, and the server should only generate one order. Or, it is assumed that multiple payment requests are initiated to the payment platform due to network problems or system defects (BUG), and the payment platform should only deduct once.

[0194] In some embodiments, the process of verifying by the server whether the data processing request satisfies the idempotency condition includes that the server queries the data processing record file based on the processing event identifier carried by the data processing request, verifies whether there is a data processing record corresponding to the processing event identifier in the data processing record file, determines that the data processing request corresponding to the processing event identifier satisfies the idempotency condition if there is one data processing record corresponding to the processing event identifier in the data processing record file, and determines that the data processing request corresponding to the processing event identifier does not satisfy the idempotency condition if there are two or more data processing records corresponding to the processing event identifier in the data processing record file.

[0195] In the embodiments of the present disclosure, the data processing record is used to record event information of a data processing event of a target account. Accordingly, the data processing record file is used to record a plurality of data processing events of the target account and the event information of the plurality of data processing events. In some embodiments, the data processing record file is a billing log. In some embodiments, the event information can include a log number, a user account number, a transaction type, a transaction resource quantity, a transaction processing status, and the like. In some embodiments, the data processing record file is stored in a DB (Data Base) database associated with the server. Accordingly, the server can quickly check the data processing record by querying the DB database.

[0196] In this embodiment, the data processing request is checked to determine whether the data processing request satisfies the idempotency condition, so as to ensure the accuracy and security of the data processing.

[0197] In step 305, the server checks whether the processing resource quantity carried by the data processing request satisfying the idempotency condition satisfies a processing resource condition, and executes step 306 based on the data processing request satisfying the processing resource condition.

[0198] For example, in a transaction scenario, the processing resource quantity refers to a quantity of virtual resources or a value of virtual resources required to be paid in a transaction, such as a quantity of virtual currency or a price of virtual currency. In some embodiments, the processing resource condition refers to that the processing resource quantity is greater than or equal to a preset resource quantity, for example, the preset resource quantity is 0.

[0199] In some embodiments, the process of checking, by the server, whether the processing resource quantity satisfies the processing resource condition includes: determining, by the server, whether the processing resource quantity carried by the data processing request satisfying the idempotency condition is greater than a preset resource quantity, and determining that the processing resource quantity satisfies the processing resource condition if the processing resource quantity is greater than or equal to the preset resource quantity, or determining that the processing resource quantity does not satisfy the processing resource condition if the processing resource quantity is less than the preset resource quantity.

[0200] In this embodiment, the processing resource quantity carried by the data processing request is checked to determine whether the processing resource quantity satisfies the processing resource condition, so as to ensure the accuracy and security of the data processing.

[0201] In step 306, the server checks whether the data processing type carried by the data processing request satisfying the processing resource condition satisfies a data processing type condition, and executes step 307 based on the data processing request satisfying the data processing type condition.

[0202] In an example of a transaction scenario, the data processing type is a transaction type, which is referred to as a BizType, such as a transaction type of a tangible product or a transaction type of a virtual currency. In some embodiments, the data processing type condition refers to the data processing type being a preset data processing type, for example, the preset data processing type is a type that supports transactions based on a virtual currency.

[0203] In some embodiments, the process of verifying, by the server, whether the data processing type meets the data processing type condition includes: determining, by the server, whether the data processing type carried in the data processing request that meets the processing resource condition is a preset data processing type, and determining that the data processing type meets the data processing type condition if the data processing type is the preset data processing type, or determining that the data processing type does not meet the data processing type condition if the data processing type is not the preset data processing type.

[0204] In this embodiment, the data processing type carried in the data processing request is verified to meet the data processing type condition, to ensure the accuracy and security of data processing.

[0205] The above steps 303 to 306 are in the order of verification of the account, verification of the idempotency condition, verification of the processing resource condition, and verification of the data processing type condition. In other embodiments, the server can also perform the process of verifying the data processing request based on other verification orders, for example, the server can verify the data processing request in the order of verification of the idempotency condition, verification of the account, verification of the processing resource condition, and verification of the data processing type condition. The verification order of the data processing request in the embodiments of the present disclosure is not limited.

[0206] The steps 303 to 306 are based on the four checks of the account check, the idempotency condition check, the processing resource condition check, and the data processing type condition check to check the data processing requests. In some embodiments, the server can check the data processing requests based on one, two, or three of the four checks. The checking process is described below based on any one of the four checks. In an optional embodiment, the server checks the accounts corresponding to the data processing requests based on the first password parameters carried by the data processing requests, and executes the next step based on the data processing requests that pass the account check. In an optional embodiment, the server checks whether the data processing requests satisfy the idempotency condition based on the processing event identifiers carried by the data processing requests, and executes the next step based on the data processing requests that satisfy the idempotency condition. In an optional embodiment, the server checks whether the processing resource quantities satisfy the processing resource condition based on the processing resource quantities carried by the data processing requests, and executes the next step based on the data processing requests that satisfy the processing resource condition. In an optional embodiment, the server checks whether the data processing types satisfy the data processing type condition based on the data processing types carried by the data processing requests, and executes the next step based on the data processing requests that satisfy the data processing type condition. Of course, the server can also check the data processing requests based on other types of checks, such as checking whether the resource quantity of the target account satisfies the processing resource quantity indicated by the data processing request to ensure the smooth progress of data processing.

[0207] In step 307, if the server receives a number of data processing requests that reaches a target threshold value within a unit time, step 308 is performed.

[0208] The unit time can be a pre-set fixed time, such as 1s. In some embodiments, the number of data processing requests received within the unit time can be represented by QPS (Query Per Second), which refers to the number of queries that a server can respond to per second, and is a measure of how much traffic a specific query server can handle within a specified time.

[0209] The target threshold is a pre-set fixed threshold, such as 10. Accordingly, if the server receives 10 data processing requests in a unit time, step 308 is performed. In some embodiments, the server uses a target enumeration class to represent the target threshold. The enumeration class refers to a class whose object number is limited and unchangeable. For example, the target enumeration class can be a payment flow detection enumeration class (Pay Threshold Checker enumeration class). In some embodiments, the parameter value of the target enumeration class is dynamically configured. In some embodiments, the server uses a batch transaction-buffer trigger switching parameter (BATCH_TRADE_V2_BUFFER_TRIGGER_SWITCH) to represent the dynamically configured parameter value.

[0210] In some embodiments, the server constructs a cache distributed resource proxy object of the target account, calls the threshold judgment code through the cache distributed resource proxy object to judge whether the number of data processing requests received in a unit time reaches the target threshold, and if the number of data processing requests received in a unit time reaches the target threshold, it means that the target account is a hot account, and the subsequent steps are performed. In this way, by judging whether the number of data processing requests received in a unit time reaches the target threshold, whether the target account corresponding to the data processing request is a hot account is judged, and if the target account is a hot account, subsequent steps are performed for processing, achieving the effect of updating the hot account based on multiple data processing requests of the hot account, avoiding the problem of request delay, and improving the efficiency of data processing.

[0211] The cache distributed resource proxy object provides the function of calling code. In an optional embodiment, the cache distributed resource proxy object is a configuration threshold source node object (Redis Threshold Source Node object), which provides a delegate class (Delegate class) that provides the function of calling code. Accordingly, the server calls the threshold judgment code to judge whether the number of data processing requests received in a unit time reaches the target threshold based on the delegate class of the configuration threshold source node object. The delegate class is a data structure, which is essentially a class that holds a reference to a method. The threshold judgment code provides the function of judging whether the number of data processing requests received in a unit time reaches the target threshold. In an optional embodiment, the threshold judgment code is the code included in the canDo method.

[0212] For example, Figure 4 is a flowchart of threshold judgment according to an exemplary embodiment, referring to Figure 4The target threshold is represented by defining a payment flow detection enumeration class, and a configuration threshold source node object is constructed by using an Init process. Since the configuration threshold source node object is provided with a delegate class, the Init process calls a canDo method based on the delegate class of the configuration threshold source node object, and can realize the function of judging whether the number of received data processing requests in a unit time reaches the target threshold.

[0213] In the embodiments of the present disclosure, whether the number of received data processing requests in a unit time reaches the target threshold is judged by step 307 to judge whether the target account corresponding to the data processing request is a hot account. If the target account is a hot account, data processing of the hot account is performed based on a buffer trigger mode and a batch trade mode.

[0214] It should be noted that the server maintains a buffer trigger component and a batch trade component. Optionally, the buffer trigger component defines a request queue (Queue) for storing data processing requests to be processed, that is, for storing transaction requests to be processed. In some embodiments, the buffer trigger component is used to add a plurality of received data processing requests to the request queue based on a single thread every interval, and then perform batch processing of the target account based on the plurality of data processing requests in the request queue. In this way, the queuing of a plurality of data processing requests is realized, and the thread resource consumption caused by lock competition of multiple threads is avoided. In some embodiments, the batch trade component is used to generate a plurality of data processing records of the target account based on the plurality of data processing requests of the target account. In this way, batch processing of a plurality of data processing requests is realized.

[0215] In a specific example, Figure 5 is a flowchart of data processing verification according to an exemplary embodiment, referring to Figure 5After triggering multiple consumption requests (i.e., transaction requests) based on a consumption portal, the server first performs signature verification and parameter analysis on the consumption request to check the identity of the user triggering the consumption request. If the identity of the user triggering the consumption request is verified, the server performs idempotency check on the consumption request based on the identity verification to determine whether the consumption request meets the idempotency condition. If the consumption request meets the idempotency condition, the server performs parameter verification on the consumption request based on the consumption request meeting the idempotency condition, i.e., determines whether the transaction resource quantity (processing resource quantity) carried by the consumption request meets the transaction resource condition (processing resource condition) and whether the transaction type (data processing type) carried by the consumption request meets the transaction type condition (data processing type condition). If the transaction resource quantity carried by the consumption request meets the transaction resource condition and the transaction type carried by the consumption request meets the transaction type condition, the server determines whether the user account corresponding to the consumption request is a hot account based on QPS (transaction frequency per second, i.e., the number of consumption requests received per second). If the user account corresponding to the consumption request is a hot account, the server performs data processing of the hot account based on the buffer triggering mode and the batch transaction mode. If the user account corresponding to the consumption request is not a hot account, the server performs data processing of the non-hot account based on the batch transaction mode.

[0216] For example, Figure 6 is a flowchart of a buffer triggering mode according to an example embodiment. The following describes the process of performing data processing of a hot account based on the buffer triggering mode based on Figure 6 The following describes the process of performing data processing of a hot account based on the buffer triggering mode based on

[0217] In step 308, the server obtains the plurality of data processing requests received within a target time interval every target time interval.

[0218] In some embodiments, the server performs the process of obtaining the plurality of data processing requests received within a target time interval every target time interval based on a single thread.

[0219] In some embodiments, the buffer triggering mode introduces a simple buffer trigger builder class for adding the received plurality of data processing requests to a request queue every time interval based on a single thread, and performing batch processing of a target account based on the plurality of data processing requests in the request queue.

[0220] In one alternative embodiment, a Scheduled Executor Service is maintained within the Simple Buffer Trigger Creation Class. This Scheduled Executor Service provides a new Single Thread Scheduled Executor. In some embodiments, the server uses this new Single Thread Scheduled Executor to execute the process of retrieving multiple data processing requests received within a target time interval at each target time interval.

[0221] In one alternative embodiment, a TriggerRunnable function is constructed inside the Simple Buffer Trigger Creation class. This TriggerRunnable function is used to execute a scheduled task, which is a process of updating the target account once at a target time interval based on the multiple data processing requests received within the target time interval.

[0222] For example, see Figure 6 ,exist Figure 6 The diagram shown on the right illustrates a new single-threaded timer executor that determines whether the interval has been reached. If it has, the process of acquiring the multiple data processing requests received within the target time period is triggered, so as to perform subsequent processes of adding data processing requests to the request queue and batch processing the data processing requests in the request queue.

[0223] In step 309, the server adds a read lock to the request queue.

[0224] In some embodiments, a read lock mechanism is defined internally within the simplified buffer-triggered creation class. It should be understood that the subsequent step 310, adding a data processing request to the request queue, is a read operation problem. Therefore, by adding a read lock to the request queue, it is ensured that only the thread that acquires the read lock can respond to the data processing request by adding the data processing request to the request queue.

[0225] In step 310, the server adds the multiple data processing requests within the target duration to the request queue in the order in which they are received within the target duration.

[0226] In some embodiments, an element retrieval function, such as the BufferFactory get function, is defined inside the simple buffer trigger creation class. Accordingly, the server uses this element retrieval function to obtain the multiple data processing requests received within the target duration, so as to perform the subsequent process of adding the multiple data processing requests within the target duration to the request queue in sequence.

[0227] In some embodiments, an enqueue function is defined in the internal of the simple buffer trigger creation class, and the server uses the enqueue function to add the data processing requests in the target time duration to the request queue in order based on the receiving order of the data processing requests received in the target time duration. In this way, the data processing requests are summarized into a collection by setting the request queue, and the subsequent batch processing process is performed, thereby improving the efficiency of data processing.

[0228] In some embodiments, a QueueAdder is defined in the internal of the simple buffer trigger creation class, and the QueueAdder returns a positive number to indicate that the data processing request is added successfully and the count is incremented by one in response to adding a data processing request to the request queue.

[0229] In some embodiments, the server stops the process of adding data processing requests to the request queue in response to the number of data processing requests added to the request queue reaching the upper limit of the queue size. In an optional embodiment, the server triggers the Fire Reject Handler function in response to the number of data processing requests added to the request queue reaching the upper limit of the queue size.

[0230] In the above embodiments, the data processing requests in the target time duration are added to the request queue every interval of the target time duration, and the subsequent batch processing process is performed based on the data processing requests in the request queue, thereby improving the efficiency of data processing.

[0231] In step 311, the server releases the read lock and adds a write lock to the request queue.

[0232] In some embodiments, a write lock mechanism is defined in the internal of the simple buffer trigger creation class. It should be understood that the process of generating the data processing records corresponding to the data processing requests in the subsequent step 312 is a write operation problem. Therefore, by adding a write lock to the request queue, only the thread that obtains the write lock can execute the process of generating the data processing records in response to the data processing requests, thereby ensuring that no new elements are added to the request queue.

[0233] In step 312, the server generates a plurality of data processing records of the target account based on the plurality of data processing requests in the request queue.

[0234] The data processing record is used to record event information of a data processing event corresponding to a data processing request. In some embodiments, the server adds event information of data processing events corresponding to a plurality of data processing requests in the request queue to the data processing record file of the target account based on the event information of the data processing events carried by the plurality of data processing requests, to obtain a plurality of data processing records of the target account.

[0235] In some embodiments, after the server generates the plurality of data processing records of the target account, the server empties the request queue, resets the count to zero, and releases the write lock, and then re-adds data processing requests to be processed in the next target time interval after the target time interval elapses.

[0236] In some embodiments, the buffer trigger mode further defines a Get Pending Changes function, which is used to obtain the number of data processing requests in the request queue. Through the function, the server can return the number of data processing requests in the request queue, so as to know the number of data processing requests in the current batch processing.

[0237] In the above embodiments, the process of automatically triggering the execution of the timing task is described. In other embodiments, the buffer trigger mode further defines a Manually Do Trigger function, which is used to manually trigger the execution of the timing task, that is, to trigger the process of adding requests in the request queue and batch processing data processing requests in the request queue.

[0238] In step 313, the server determines the total number of processing resources of the target account based on the number of processing resources in the generated plurality of data processing records.

[0239] The total number of processing resources represents the total number of processing resources indicated by the plurality of data processing requests. For example, in a transaction scenario, the total number of processing resources is the total number of transactions, which represents the total number of transaction resources indicated by the plurality of transaction requests.

[0240] In some embodiments, the server executes the process of steps 312 to 313 based on a target thread pool. The corresponding process is that the server encapsulates the plurality of data processing requests into a to-be-processed task, inputs the to-be-processed task into the target thread pool, and generates the plurality of data processing records of the target account based on the to-be-processed task through the target thread pool.

[0241] In an alternative embodiment, in the buffer trigger mode, the server maintains a batch transaction task component (Batch Trade V2 Future component) for encapsulating the plurality of data processing requests as a to-be-processed task. The to-be-processed task can be a Future task, specifically a Completable Future task.

[0242] In an alternative embodiment, in the buffer trigger mode, the server maintains a thread pool component (such as a FronkJoin Pool component) for generating, based on the to-be-processed task, a plurality of data processing records of the target account through the target thread pool. The target thread pool can be a Fronk Join Pool thread pool.

[0243] In the above embodiment, the plurality of data processing requests are split and processed based on the target thread pool, which realizes batch processing of the plurality of data processing requests, improves the efficiency of processing the data processing requests, and avoids resource consumption caused by thread waiting.

[0244] In some embodiments, the target thread pool provides a function of splitting and processing tasks, and generating, based on the to-be-processed task, a plurality of data processing records of the target account through the target thread pool includes: splitting the to-be-processed task through the target thread pool to obtain a plurality of subtasks, the plurality of subtasks being respectively associated with corresponding data processing requests; and generating, based on the data processing requests associated with the plurality of subtasks respectively through a plurality of threads in the target thread pool, a plurality of data processing records of the target account. In this embodiment, the plurality of threads in the target thread pool respectively process the data processing requests corresponding to the split subtasks, which realizes batch processing of the plurality of data processing requests and improves the efficiency of processing the data processing requests.

[0245] In an alternative embodiment, the server executes, based on the batch transaction component, a process of generating, based on the data processing requests associated with the plurality of subtasks, a plurality of data processing records of the target account.

[0246] In some embodiments, the target thread pool further provides a function of aggregating processing results, and the determination of the total number of processing resources of the target account based on the number of processing resources in the generated plurality of data processing records includes: aggregating, through the target thread pool, the number of processing resources in the generated plurality of data processing records to obtain the total number of processing resources of the target account. In this embodiment, the processing results are asynchronously obtained by the plurality of threads during batch processing, and then aggregated, which finally realizes the effect of synchronous processing.

[0247] In one specific example, in the buffer trigger mode, multiple data processing requests of the target account are packaged as Completable Future tasks, the Completable Future tasks are added to a request queue, and then the Fronk Join Pool thread pool is triggered to batch process the multiple data processing requests in the request queue. In this embodiment, the Fronk Join Pool thread pool is used, and the Completable Future is used to obtain the results of the tasks in the thread pool asynchronously, which avoids the problems of blocking and polling and avoids resource consumption caused by thread waiting.

[0248] In the above embodiment, when the multiple data processing requests initiated by the user are received, a data processing record corresponding to each data processing request is generated to record event information of a data processing event corresponding to the data processing request, and the total number of processing resources of the multiple data processing requests is obtained, so as to subsequently update the resource quantity of the target account based on the total number of processing resources.

[0249] In some embodiments, after the server determines the total number of processing resources of the target account, the server further checks whether the resource quantity of the target account satisfies the total number of processing resources based on the total number of processing resources of the target account, and if the resource quantity of the target account satisfies the total number of processing resources, step 314 is performed.

[0250] In step 314, the server updates the resource quantity of the target account based on the total number of processing resources of the target account.

[0251] In an optional embodiment, if the multiple data processing requests are payout requests, the resource quantity of the target account is updated to a first resource quantity, which is obtained by deducting the total number of processing resources from the resource quantity; in an optional embodiment, if the multiple data processing requests are deposit requests, the resource quantity of the target account is updated to a second resource quantity, which is obtained by adding the total number of processing resources to the resource quantity.

[0252] In the above embodiment, when the multiple payout requests initiated by the user are received, the resource quantity of the user account is updated based on the total number of processing resources of the multiple payout requests, or when the multiple deposit requests initiated by the user are received, the resource quantity of the user account is updated based on the total number of processing resources of the multiple deposit requests. In this way, the effect of updating the account only once based on multiple data processing requests is achieved, and it is not necessary to sequentially perform data processing corresponding to the data processing requests, which avoids the problem of request delay and improves the efficiency of data processing.

[0253] In step 315, the server returns the processing status prompt information of the target account to the terminal based on the update result of the target account, and the processing status prompt information is used to prompt whether the data processing is successful.

[0254] For example, the content of the processing status prompt information can be that the data processing is successful or the data processing is not successful. Taking a transaction scenario as an example, the transaction status prompt information is used to prompt whether the transaction is successful, such as transaction success or transaction failure.

[0255] The above steps take the interaction between the terminal and the server as an example to describe the scheme, and the scheme will be described below based on a plurality of components maintained by the server. For example, Figure 7 is a flowchart of a data processing method according to an example embodiment, see Figure 7The plurality of components maintained by the server include a batch transaction task component, a buffer triggering component, a thread pool component, and a batch transaction component. Taking a transaction scenario as an example, the transaction processing procedure for a hot account includes: when N transaction requests are initiated by a user end, the server obtains the N transaction requests, encapsulates each transaction request into a Future subtask by using the batch transaction task component, and obtains N Future subtasks; the encapsulated N Future subtasks are added to a request queue provided by the buffer triggering component, a timing task is executed based on a single thread of the buffer triggering component, that is, every time a time interval elapses, the N transaction requests in the request queue are input into a Fronk Join Pool thread pool, specifically, the N transaction requests in the request queue are encapsulated into a Future task, and the Future task is input into the Fronk Join Pool thread pool; the Future task is split into the N Future subtasks by using the Fronk Join Pool thread pool, and the N Future subtasks are processed in batches by using the batch transaction component based on a plurality of threads in the Fronk Join Pool thread pool, to obtain N batch transaction processing results; the N batch transaction processing results are aggregated by using the Fronk Join Pool thread pool, and the aggregated transaction processing result is returned to the batch transaction task component, and the batch transaction task component returns the aggregated transaction processing result to the user end. Wherein, N is a positive integer greater than a target threshold. The transaction processing procedure for a non-hot account includes: when a transaction request is initiated by the user end, the server obtains the transaction request, processes the transaction request by using the batch transaction component, and returns a transaction processing result to the user end; when a plurality of transaction requests are initiated by the user end, the server obtains the plurality of transaction requests, processes the plurality of transaction requests in batches by using the batch transaction component, and returns transaction processing results of the plurality of transaction requests to the user end in sequence.

[0256] In step 316, the terminal receives the processing state prompt information of the target account, and displays the processing state prompt information.

[0257] The technical scheme provided by the embodiments of the present disclosure can, when receiving a plurality of data processing requests initiated by a user, determine a total number of processing resources of the plurality of data processing requests based on a number of processing resources indicated by the plurality of data processing requests, and update a number of resources of a user account based on the total number of processing resources. In this way, the effect of updating the account only once based on multiple data processing requests is achieved, and the problem of request delay is avoided without sequentially executing data processing corresponding to the data processing requests, thereby improving the efficiency of data processing.

[0258] Figure 8 is a block diagram of a data processing apparatus according to an exemplary embodiment. Referring to Figure 8 The apparatus includes a receiving unit 801, a determining unit 802 and an updating unit 803.

[0259] The receiving unit 801 is configured to perform receiving a plurality of data processing requests.

[0260] The determining unit 802 is configured to perform determining a total quantity of processing resources of a target account based on the plurality of data processing requests.

[0261] The updating unit 803 is configured to perform updating a resource quantity of the target account based on the total quantity of processing resources of the target account.

[0262] The technical solution provided by the embodiments of the present disclosure, when receiving a plurality of data processing requests initiated by a user, determines a total quantity of processing resources of the plurality of data processing requests based on the quantity of processing resources indicated by the plurality of data processing requests, and then updates a resource quantity of the user account based on the total quantity of processing resources. In this way, the effect of updating the account only once based on multiple data processing requests is achieved, and there is no need to sequentially perform data processing corresponding to the data processing requests, thereby avoiding the problem of request delay and improving the efficiency of data processing.

[0263] In some embodiments, the determining unit 802 includes:

[0264] The generating subunit is configured to perform generating a plurality of data processing records of the target account based on the plurality of data processing requests, wherein the data processing record is used to record event information of a data processing event corresponding to the data processing request.

[0265] The determining subunit is configured to perform determining the total quantity of processing resources of the target account based on the quantity of processing resources in the generated plurality of data processing records.

[0266] In some embodiments, the generating subunit includes:

[0267] The input sub-module is configured to perform packaging the plurality of data processing requests into a to-be-processed task, and inputting the to-be-processed task into a target thread pool, wherein the target thread pool is provided with a function of splitting and processing tasks.

[0268] The generating sub-module is configured to perform generating a plurality of data processing records of the target account based on the to-be-processed task through the target thread pool.

[0269] In some embodiments, the generating sub-module is configured to perform:

[0270] The target thread pool splits the to-be-processed task to obtain a plurality of subtasks, and the plurality of subtasks are respectively associated with corresponding data processing requests.

[0271] The target thread pool generates a plurality of data processing records of the target account based on the data processing requests associated with the plurality of subtasks.

[0272] In some embodiments, the target thread pool further provides a function of aggregating processing results.

[0273] The determination subunit is configured to perform:

[0274] The target thread pool aggregates the number of processing resources in the generated plurality of data processing records to obtain a total number of processing resources of the target account.

[0275] In some embodiments, the update unit 803 is configured to perform any one of the following:

[0276] If the plurality of data processing requests are withdrawal requests, the resource quantity of the target account is updated to a first resource quantity, and the first resource quantity is obtained by deducting the total number of processing resources from the resource quantity.

[0277] If the plurality of data processing requests are deposit requests, the resource quantity of the target account is updated to a second resource quantity, and the second resource quantity is obtained by adding the total number of processing resources to the resource quantity.

[0278] In some embodiments, the apparatus further comprises at least one of the following:

[0279] The first verification unit is configured to perform verification on the accounts corresponding to the plurality of data processing requests based on the first password parameter carried by the plurality of data processing requests, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on the data processing requests whose account verification passes.

[0280] The second verification unit is configured to perform verification on whether the plurality of data processing requests satisfy idempotency conditions based on the processing event identifier carried by the plurality of data processing requests, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on the data processing requests that satisfy the idempotency conditions.

[0281] The third verification unit is configured to perform verification on whether the plurality of data processing requests satisfy processing resource conditions based on the processing resource quantity carried by the plurality of data processing requests, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on the data processing requests that satisfy the processing resource conditions.

[0282] A fourth checking unit, configured to perform checking on whether a data processing type carried by the plurality of data processing requests meets a data processing type condition based on the data processing type, and perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests based on the data processing requests meeting the data processing type condition.

[0283] In some embodiments, the first cryptographic parameter is generated by a terminal corresponding to the account based on account information and a communication key provided by a server;

[0284] The first checking unit is configured to perform:

[0285] For any data processing request, a second cryptographic parameter is generated based on account information carried by the data processing request and the communication key;

[0286] If the first cryptographic parameter and the second cryptographic parameter carried by the data processing request are the same, it is determined that the account passes the check.

[0287] In some embodiments, the receiving unit 801 is further configured to perform:

[0288] If the number of data processing requests received within a unit time reaches a target threshold, the step of determining the total number of processing resources of the target account based on the plurality of data processing requests is performed.

[0289] In some embodiments, the apparatus further comprises a judging unit configured to perform:

[0290] The cached distributed resource proxy object of the target account is constructed, and the threshold judging code is called through the cached distributed resource proxy object to judge whether the number of data processing requests received within a unit time reaches the target threshold.

[0291] In some embodiments, the apparatus further comprises:

[0292] An adding unit configured to perform adding the plurality of data processing requests into a request queue in sequence based on the order of receiving the plurality of data processing requests, the request queue being used to store data processing requests to be processed;

[0293] The determining unit 802 is further configured to perform the step of determining the total number of processing resources of the target account based on the plurality of data processing requests in the request queue based on the plurality of data processing requests.

[0294] In some embodiments, the adding unit is configured to perform:

[0295] acquire the plurality of data processing requests received within the target time length every target time length;

[0296] add the plurality of data processing requests within the target time length to the request queue in sequence based on the receiving sequence of the plurality of data processing requests received within the target time length.

[0297] In some embodiments, the adding unit is further configured to perform adding a read lock for the request queue;

[0298] The adding unit is further configured to perform releasing the read lock and adding a write lock for the request queue.

[0299] It should be noted that the data processing apparatus provided by the above embodiments is only illustrated by the division of the above functional modules during data processing. In actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data processing apparatus and the data processing method provided by the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.

[0300] The computer device involved in the embodiments of the present disclosure can be provided as a terminal. Figure 9 is a structural block diagram of a terminal 900 according to an exemplary embodiment. The terminal 900 can be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The terminal 900 can also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, and other names.

[0301] Generally, the terminal 900 includes a processor 901 and a memory 902.

[0302] The processor 901 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 901 can be implemented in the form of at least one of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array), and the like. The processor 901 can also include a main processor and a co-processor. The main processor is a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit). The co-processor is a low-power consumption processor for processing data in a standby state. In some embodiments, the processor 901 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing content to be displayed by the display screen. In some embodiments, the processor 901 can further include an AI (Artificial Intelligence) processor for processing machine learning-related computing operations.

[0303] The memory 902 can include one or more computer-readable storage media that can be non-transitory. The memory 902 can also include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one program code for being executed by the processor 901 to implement a process performed by a terminal in a data processing method provided by the method embodiments in the present disclosure.

[0304] In some embodiments, the terminal 900 can also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902, and the peripheral device interface 903 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 903 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 904, a display screen 905, a camera component 906, an audio circuit 907, a positioning component 908, and a power supply 909.

[0305] The peripheral interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902 and the peripheral interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902 and the peripheral interface 903 can be implemented on a separate chip or circuit board, and the present embodiments are not limited in this regard.

[0306] The radio frequency circuit 904 is configured to receive and send RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts electrical signals to electromagnetic signals for transmission, or converts electromagnetic signals received to electrical signals. Optionally, the radio frequency circuit 904 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 904 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to, a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 904 can also include NFC (Near Field Communication) related circuitry, and the present disclosure is not limited in this regard.

[0307] The display screen 905 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 is further configured to capture touch signals on or above the surface of the display screen 905. The touch signals can be input to the processor 901 as control signals for processing. In this case, the display screen 905 can also be configured to provide virtual buttons and / or virtual keyboard, also known as soft buttons and / or soft keyboard. In some embodiments, the display screen 905 can be one, disposed on the front panel of the terminal 900; in other embodiments, the display screen 905 can be at least two, respectively disposed on different surfaces of the terminal 900 or in a folding design; in other embodiments, the display screen 905 can be a flexible display screen, disposed on a curved surface or a folding surface of the terminal 900. Even, the display screen 905 can also be disposed in an irregular shape, i.e., a special-shaped screen. The display screen 905 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc.

[0308] The camera assembly 906 is configured to capture images or videos. Optionally, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, the rear camera is at least two, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to realize the background blur function by fusing the main camera and the depth-of-field camera, the panoramic shooting and VR (Virtual Reality) shooting function by fusing the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera assembly 906 can further include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to the combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.

[0309] The audio circuit 907 can include a microphone and a speaker. The microphone is used to collect sound waves of a user and an environment, and convert the sound waves into an electrical signal input to the processor 901 for processing, or input to the radio frequency circuit 904 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, and arranged at different parts of the terminal 900. The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert an electrical signal from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker can be a conventional diaphragm speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can it convert an electrical signal into a sound wave audible to humans, but also can convert an electrical signal into an inaudible sound wave to humans for ranging purposes. In some embodiments, the audio circuit 907 can also include a headphone jack.

[0310] The positioning component 908 is used to position the current geographic location of the terminal 900 to realize navigation or LBS (Location Based Service). The positioning component 908 can be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China, the GLONASS system of Russia, or the Galileo system of the European Union.

[0311] The power supply 909 is used to supply power to various components in the terminal 900. The power supply 909 can be alternating current, direct current, disposable batteries, or rechargeable batteries. When the power supply 909 includes rechargeable batteries, the rechargeable batteries can support wired charging or wireless charging. The rechargeable batteries can also be used to support fast charging technology.

[0312] In some embodiments, the terminal 900 also includes one or more sensors 910. The one or more sensors 910 include, but are not limited to, an acceleration sensor 911, a gyroscope sensor 912, a pressure sensor 913, a fingerprint sensor 914, an optical sensor 915, and a proximity sensor 916.

[0313] The acceleration sensor 911 can detect the acceleration magnitude in three coordinate axes of the coordinate system established by the terminal 900. For example, the acceleration sensor 911 can be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 911. The acceleration sensor 911 can also be used for game or user motion data collection.

[0314] The gyroscope sensor 912 can detect the body direction and rotation angle of the terminal 900, and can collect 3D motions of the user on the terminal 900 in cooperation with the acceleration sensor 911. The processor 901 can implement the following functions according to the data collected by the gyroscope sensor 912: motion sensing (such as changing the UI according to the tilt operation of the user), image stabilization when shooting, game control, and inertial navigation.

[0315] The pressure sensor 913 can be arranged on the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 913 is arranged on the side frame of the terminal 900, the grip signal of the user on the terminal 900 can be detected, and the left-hand or right-hand recognition or shortcut operation can be performed by the processor 901 according to the grip signal collected by the pressure sensor 913. When the pressure sensor 913 is arranged on the lower layer of the display screen 905, the operable control on the UI interface can be controlled by the processor 901 according to the pressure operation of the user on the display screen 905. The operable control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0316] The fingerprint sensor 914 is used to collect the fingerprint of the user, and the identity of the user can be recognized by the processor 901 according to the fingerprint collected by the fingerprint sensor 914, or by the fingerprint sensor 914 according to the collected fingerprint. When the identity of the user is recognized as a trusted identity, the processor 901 authorizes the user to perform related sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, payment, and changing settings. The fingerprint sensor 914 can be arranged on the front, back, or side of the terminal 900. When the terminal 900 is provided with a physical button or a manufacturer's logo, the fingerprint sensor 914 can be integrated with the physical button or the manufacturer's logo.

[0317] The optical sensor 915 is used to collect the ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 according to the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 915.

[0318] The proximity sensor 916, also referred to as a distance sensor, is usually arranged on the front panel of the terminal 900. The proximity sensor 916 is used to collect the distance between the user and the front of the terminal 900. In an embodiment, when the proximity sensor 916 detects that the distance between the user and the front of the terminal 900 gradually decreases, the display screen 905 is switched from the bright screen state to the screen-off state under the control of the processor 901; when the proximity sensor 916 detects that the distance between the user and the front of the terminal 900 gradually increases, the display screen 905 is switched from the screen-off state to the bright screen state under the control of the processor 901.

[0319] Those skilled in the art can understand that the structure shown in the foregoing embodiments is not a limitation on the terminal 900, and the terminal 900 can include more or fewer components than those shown in the drawings, or combine certain components, or adopt a different arrangement of components. Figure 9

[0320] The computer device involved in the embodiments of the present disclosure can be provided as a server. Figure 10 FIG. 10 is a structural block diagram of a server 1000 according to an example embodiment. The server 1000 can have a large difference due to different configurations or performances, and can include one or more processors (Central Processing Units, CPUs) 1001 and one or more memories 1002. The one or more memories 1002 store at least one piece of program code, which is loaded and executed by the one or more processors 1001 to implement the processes performed by the server in the data processing method provided by each of the methods. Of course, the server 1000 can also have a wired or wireless network interface, a keyboard, and an input and output interface, and other components for realizing the functions of the device, which are not described here.

[0321] In example embodiments, a computer readable storage medium including program code, such as the memory 902 or the memory 1002 including program code, is also provided. The above program code can be executed by the processor 901 of the terminal 900 or the processor 1001 of the server 1000 to complete the above data processing method. Alternatively, the computer readable storage medium can be a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (Compact-Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0322] In example embodiments, a computer program product is also provided, which includes a computer program that is executed by a processor to implement the above data processing method.​

[0323] In some embodiments, the computer program of the present embodiments can be deployed on one computer device, or on multiple computer devices located at one site, or on multiple computer devices distributed over multiple sites and interconnected via a communication network, which can constitute a blockchain system.

[0324] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the concepts disclosed herein. It is intended that the present disclosure cover any and all variations of the present disclosure including combinations of features falling within the general scope of the disclosure. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0325] It should be understood that the present disclosure is not limited to the precise structures herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from its scope. The scope of the present disclosure is limited only by the claims that follow.

Claims

1. A data processing method, characterized in that, The method includes: Based on a single thread, it receives multiple data processing requests within a target duration; Add a read lock to the request queue; Each data processing request is encapsulated into a subtask, and the resulting subtasks, each corresponding to a different data processing request, are added to the request queue. Release the read lock and add a write lock to the request queue; Based on a single thread, the multiple data processing requests are encapsulated into a task to be processed, and the task to be processed is input into the target thread pool. The task to be processed is split into multiple subtasks by using the target thread pool. The data processing requests corresponding to the multiple sub-tasks obtained by splitting are processed in batches by multiple threads in the target thread pool to generate multiple data processing records for the target account. The request queue is cleared, the count is reset to zero, and the write lock is released; and, through the target thread pool, the number of processing resources in the multiple data processing records is aggregated to obtain the total number of processing resources for the target account; based on the total number of processing resources, the resource quantity of the target account is updated; Based on the update result of the target account, a processing status prompt message for the target account is returned to the terminal. The processing status prompt message is used to indicate whether the data processing was successful.

2. The data processing method according to claim 1, characterized in that, Data processing logs are used to record event information for data processing events corresponding to data processing requests.

3. The data processing method according to claim 1, characterized in that, Updating the resource quantity of the target account based on the total processing resources of the target account includes any of the following: If the multiple data processing requests are expenditure requests, then the resource quantity of the target account is updated to a first resource quantity, which is the resource quantity obtained by subtracting the total number of processing resources from the resource quantity. If the multiple data processing requests are storage requests, then the resource quantity of the target account is updated to a second resource quantity, which is the resource quantity obtained by adding the total number of processing resources to the resource quantity.

4. The data processing method according to claim 1, characterized in that, After receiving multiple data processing requests within the target time period, the method further includes at least one of the following: Based on the first password parameter carried by the multiple data processing requests, the accounts corresponding to the multiple data processing requests are verified. Based on the data processing requests after the account verification is passed, the step of determining the total number of processing resources for the target account based on the multiple data processing requests is executed. Based on the processing event identifiers carried by the multiple data processing requests, it is verified whether the multiple data processing requests meet the idempotency condition. Based on the data processing requests that meet the idempotency condition, the step of determining the total number of processing resources for the target account based on the multiple data processing requests is executed. Based on the number of processing resources carried by the multiple data processing requests, the number of processing resources is checked to see if it meets the processing resource conditions. Based on the data processing requests that meet the processing resource conditions, the step of determining the total number of processing resources for the target account based on the multiple data processing requests is executed. Based on the data processing type carried by the multiple data processing requests, the data processing type is checked to see if it meets the data processing type conditions. Based on the data processing requests that meet the data processing type conditions, the step of determining the total number of processing resources for the target account based on the multiple data processing requests is executed.

5. The data processing method according to claim 4, characterized in that, The first password parameter is generated by the terminal corresponding to the account based on the account information and the communication key provided by the server; The step of verifying the accounts corresponding to the multiple data processing requests based on the first password parameter carried by the multiple data processing requests includes: For any data processing request, a second password parameter is generated based on the account information carried in the data processing request and the communication key; If the first password parameter and the second password parameter carried in the data processing request are the same, then the account verification is deemed successful.

6. The data processing method according to claim 1, characterized in that, After receiving multiple data processing requests within the target time period, the method further includes: If the number of data processing requests received within a unit of time reaches the target threshold, then the step of determining the total number of processing resources for the target account based on the multiple data processing requests is executed.

7. The data processing method according to claim 6, characterized in that, The method further includes: Construct a cached distributed resource proxy object for the target account, and call threshold judgment code through the cached distributed resource proxy object to determine whether the number of data processing requests received within a unit of time reaches the target threshold.

8. The data processing method according to claim 1, characterized in that, The method further includes: Based on the order in which the multiple data processing requests are received, the multiple data processing requests are added to the request queue in sequence. The request queue is used to store data processing requests to be processed.

9. The data processing method according to claim 8, characterized in that, The step of adding the multiple data processing requests to the request queue sequentially based on the receiving order of the multiple data processing requests includes: At each target time interval, acquire the plurality of data processing requests received within the target time interval; Based on the receiving order of the multiple data processing requests received within the target duration, the multiple data processing requests within the target duration are added to the request queue in sequence.

10. A data processing apparatus, characterized in that, The device includes: The receiving unit is configured to execute multiple data processing requests received within a target duration based on a single thread; The added unit is configured to add a read lock to the request queue. The determining unit is configured to encapsulate each data processing request into a subtask and add the resulting subtasks, which correspond one-to-one with the multiple data processing requests, to the request queue. The adding unit is also configured to release the read lock and add a write lock to the request queue; The determining unit is further configured to perform the following steps based on a single thread: encapsulate the multiple data processing requests into a task to be processed, input the task to be processed into a target thread pool; split the task to be processed into multiple subtasks using the target thread pool; process the data processing requests corresponding to the multiple subtasks in batches using multiple threads in the target thread pool to generate multiple data processing records for the target account; clear the request queue, reset the count to zero, and release the write lock; and aggregate the number of processing resources in the multiple data processing records using the target thread pool to obtain the total number of processing resources for the target account. The update unit is configured to update the resource quantity of the target account based on the total number of processing resources; The unit is configured to perform the following steps: based on the update result of the target account, return a processing status prompt message for the target account to the terminal, the processing status prompt message being used to indicate whether the data processing was successful.

11. The data processing apparatus according to claim 10, characterized in that, Data processing logs are used to record event information for data processing events corresponding to data processing requests.

12. The data processing apparatus according to claim 10, characterized in that, The update unit is configured to perform any of the following: If the multiple data processing requests are expenditure requests, then the resource quantity of the target account is updated to a first resource quantity, which is the resource quantity obtained by subtracting the total number of processing resources from the resource quantity. If the multiple data processing requests are storage requests, then the resource quantity of the target account is updated to a second resource quantity, which is the resource quantity obtained by adding the total number of processing resources to the resource quantity.

13. The data processing apparatus according to claim 10, characterized in that, The device further includes at least one of the following: The first verification unit is configured to perform verification on the accounts corresponding to the multiple data processing requests based on the first password parameters carried by the multiple data processing requests, and to perform the step of determining the total number of processing resources for the target account based on the multiple data processing requests after the account verification is passed. The second verification unit is configured to perform a verification based on the processing event identifier carried by the multiple data processing requests to check whether the multiple data processing requests meet the idempotency condition, and based on the data processing requests that meet the idempotency condition, perform a step of determining the total number of processing resources for the target account based on the multiple data processing requests. The third verification unit is configured to perform a step of verifying whether the number of processing resources carried by the multiple data processing requests meets the processing resource conditions, and based on the data processing requests that meet the processing resource conditions, to determine the total number of processing resources for the target account based on the multiple data processing requests. The fourth verification unit is configured to perform a step of verifying whether the data processing type carried by the plurality of data processing requests meets the data processing type conditions, and based on the data processing requests that meet the data processing type conditions, to perform a step of determining the total number of processing resources for the target account based on the plurality of data processing requests.

14. The data processing apparatus according to claim 13, characterized in that, The first password parameter is generated by the terminal corresponding to the account based on the account information and the communication key provided by the server; The first verification unit is configured to perform: For any data processing request, a second password parameter is generated based on the account information carried in the data processing request and the communication key; If the first password parameter and the second password parameter carried in the data processing request are the same, then the account verification is deemed successful.

15. The data processing apparatus according to claim 10, characterized in that, The receiving unit is also configured to perform: If the number of data processing requests received within a unit of time reaches the target threshold, then the step of determining the total number of processing resources for the target account based on the multiple data processing requests is executed.

16. The data processing apparatus according to claim 15, characterized in that, The device further includes a determination unit configured to execute: Construct a cached distributed resource proxy object for the target account, and call threshold judgment code through the cached distributed resource proxy object to determine whether the number of data processing requests received within a unit of time reaches the target threshold.

17. The data processing apparatus according to claim 10, characterized in that, The device further includes: The adding unit is further configured to add the multiple data processing requests to the request queue in sequence based on the receiving order of the multiple data processing requests. The request queue is used to store data processing requests to be processed.

18. The data processing apparatus according to claim 17, characterized in that, The added unit is also configured to perform: At each target time interval, acquire the plurality of data processing requests received within the target time interval; Based on the receiving order of the multiple data processing requests received within the target duration, the multiple data processing requests within the target duration are added to the request queue in sequence.

19. A computer device, characterized in that, The computer device includes: One or more processors; Memory used to store the executable program code of the processor; The processor is configured to execute the program code to implement the data processing method as described in any one of claims 1 to 9.

20. A computer-readable storage medium, characterized in that, When the program code in the computer-readable storage medium is executed by the processor of a computer device, the computer device is able to perform the data processing method as described in any one of claims 1 to 9.

21. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the data processing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method for transaction processing and transaction server

    CN107016536A

  • Concurrent payment method, system and device

    CN112101955A