Virtual resource updating method and apparatus, device, and storage medium

By splitting the processing of asynchronous message queues and hot message queues, the problem of virtual resource update delay under high concurrency is solved, enabling fast updates of hot accounts and efficient updates of non-hot accounts, thereby improving system performance and user experience.

CN116126530BActive Publication Date: 2026-06-12BEIJING DAJIA INTERNET INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2023-01-09
Publication Date
2026-06-12

Smart Images

  • Figure CN116126530B_ABST
    Figure CN116126530B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a virtual resource updating method, device, equipment and storage medium. The method comprises: when a virtual resource transfer request in an asynchronous message queue meets a preset condition, sending the virtual resource transfer request to a hot message queue; obtaining a first to-be-transferred resource record and a second to-be-transferred resource record corresponding to a target account identifier; the first to-be-transferred resource record is generated based on a target virtual resource; the second to-be-transferred resource record is an unprocessed resource record in a historical period; based on the hot message queue, updating the virtual resource corresponding to the target account identifier according to the first to-be-transferred resource record and the second to-be-transferred resource record. The present disclosure realizes fast and efficient updating of the virtual resource of a hot account, reduces the updating delay of the virtual resource of the hot account, and also reduces the updating delay of the virtual resource of a non-hot account.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for updating virtual resources. Background Technology

[0002] In an account system, high-concurrency updates of virtual resources for the same account are required. For example, in a live streaming tipping scenario, virtual resources for a streamer's account need to be changed. When multiple viewers tip the same popular streamer, high-concurrency changes to the same account's virtual resources will create hot rows at the database level. High-concurrency updates will cause severe lock contention, greatly affecting database availability.

[0003] In related technologies, a fixed window method is used to limit the traffic of the same account at the interface. Requests exceeding the limit are rejected and the business side needs to retry the rejected requests. On the one hand, this causes a long delay in updating the account's virtual resources; on the other hand, relying on the business side to retry requests multiple times results in a poor user experience for the business side. Summary of the Invention

[0004] This disclosure provides a method, apparatus, device, and storage medium for updating virtual resources, to at least solve the problem of long delays in updating virtual resources for accounts in related technologies. The technical solution of this disclosure is as follows:

[0005] According to a first aspect of the present disclosure, a virtual resource update method is provided, comprising:

[0006] When a virtual resource transfer request in the asynchronous message queue meets a preset condition, the virtual resource transfer request is sent to the hot message queue; the virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource.

[0007] Based on the hotspot message queue, obtain the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier; the first resource record to be transferred is generated based on the target virtual resource; the second resource record to be transferred is an unprocessed resource record within a historical time period.

[0008] Based on the hotspot message queue, the virtual resources corresponding to the target account identifier are updated according to the first resource record to be transferred and the second resource record to be transferred.

[0009] In one exemplary embodiment, the method further includes:

[0010] Based on the asynchronous message queue, determine whether the virtual resource transfer request meets the preset conditions;

[0011] When the virtual resource transfer request does not meet the preset conditions, the virtual resource transfer request is processed based on the asynchronous message queue.

[0012] In one exemplary implementation, determining whether the virtual resource transfer request meets the preset conditions includes:

[0013] Determine whether the target account identifier is a hot account identifier; or

[0014] Determine whether the total number of virtual resource transfer requests corresponding to the target account identifier is greater than a preset threshold; the hotspot account identifier is the identifier corresponding to the account whose traffic exceeds the traffic threshold; the total number of virtual resource transfer requests is updated based on the virtual resource transfer requests.

[0015] In one exemplary embodiment, the method further includes:

[0016] The virtual resource transfer request is obtained based on the synchronous message queue;

[0017] Based on the synchronous message queue, the first record of the resource to be transferred is generated according to the target virtual resource in the virtual resource transfer request;

[0018] The first resource record to be transferred is sent to the preset database based on the synchronous message queue;

[0019] The step of obtaining the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier based on the hotspot message queue includes:

[0020] Based on the hotspot message queue, a resource transfer record retrieval request is sent to the preset database; the resource transfer record retrieval request carries the target account identifier.

[0021] Based on the target account identifier, search the preset database for the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier.

[0022] In one exemplary implementation, the step of searching the preset database for the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier based on the target account identifier includes:

[0023] Based on the target account identifier, search the preset database for the historical resource transfer record corresponding to the target account identifier; the historical resource transfer record includes processed resource records and unprocessed resource records.

[0024] The unprocessed resource records are selected from the historical resource transfer records; the unprocessed resource records include the first resource record to be transferred and the second resource record to be transferred.

[0025] In one exemplary implementation, updating the virtual resource corresponding to the target account identifier based on the hotspot message queue, according to the first resource record to be transferred and the second resource record to be transferred, includes:

[0026] Based on the hot message queue, update the first resource record to be transferred and the second resource record to be transferred to the processed status;

[0027] Based on the virtual resources corresponding to the first resource record to be transferred and the second resource record to be transferred, a comprehensive virtual resource is determined.

[0028] Obtain the initial virtual resources corresponding to the target account identifier;

[0029] Based on the initial virtual resources and the comprehensive virtual resources, the updated virtual resources corresponding to the target account identifier are obtained.

[0030] In an exemplary implementation, before updating the virtual resource corresponding to the target account identifier based on the hotspot message queue according to the first resource record to be transferred and the second resource record to be transferred, the method further includes:

[0031] When the target account identifier is a non-hotspot account identifier, a preset time period corresponding to the hotspot account identifier is determined based on the hotspot message queue;

[0032] Based on the hotspot message queue, the target account identifier is marked as a hotspot account identifier during the preset time period.

[0033] In one exemplary embodiment, the method further includes:

[0034] Determine the time interval for processing requests in the hotspot message queue;

[0035] The preset time period is determined based on the interval period.

[0036] In one exemplary embodiment, the method further includes:

[0037] Based on the aforementioned synchronous message queue, retrieve any unprocessed virtual resource transfer requests;

[0038] The unprocessed virtual resource transfer requests are processed based on the affinity thread pool queue.

[0039] Based on the unprocessed resources corresponding to the unprocessed virtual resource transfer request, update the virtual resources corresponding to the target account identifier.

[0040] According to a second aspect of the present disclosure, a virtual resource update apparatus is provided, comprising:

[0041] The transfer request sending module is configured to send the virtual resource transfer request to the hot message queue when the virtual resource transfer request executed in the asynchronous message queue meets the preset conditions; the virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource.

[0042] The record acquisition module is configured to acquire, based on the hotspot message queue, a first resource record to be transferred and a second resource record to be transferred corresponding to the target account identifier; the first resource record to be transferred is generated based on the target virtual resource; the second resource record to be transferred is a resource record that has not been processed within a historical time period.

[0043] The resource update module is configured to perform an operation based on the hotspot message queue, updating the virtual resources corresponding to the target account identifier according to the first resource record to be transferred and the second resource record to be transferred.

[0044] In one exemplary embodiment, the apparatus further includes:

[0045] The condition judgment module is configured to perform an operation based on the asynchronous message queue to determine whether the virtual resource transfer request meets the preset conditions.

[0046] The request processing module is configured to process the virtual resource transfer request based on the asynchronous message queue when the virtual resource transfer request does not meet the preset conditions.

[0047] In one exemplary embodiment, the condition judgment module includes:

[0048] The first judgment unit is configured to perform a judgment on whether the target account identifier is a hot account identifier;

[0049] The second judgment unit is configured to judge whether the total number of virtual resource transfer requests corresponding to the target account identifier is greater than a preset threshold; the hotspot account identifier is the identifier corresponding to the account whose traffic exceeds the traffic threshold; the total number of virtual resource transfer requests is updated based on the virtual resource transfer requests.

[0050] In one exemplary embodiment, the apparatus further includes:

[0051] The request acquisition module is configured to execute the virtual resource transfer request based on the synchronous message queue;

[0052] The record generation module is configured to generate the first record of the resource to be transferred based on the target virtual resource in the virtual resource transfer request according to the synchronous message queue.

[0053] The record sending module is configured to send the first resource record to be transferred to a preset database based on the synchronous message queue.

[0054] In one exemplary embodiment, the record acquisition module includes:

[0055] The request sending unit is configured to send a resource transfer record retrieval request to the preset database based on the hotspot message queue; the resource transfer record retrieval request carries the target account identifier.

[0056] The record lookup unit is configured to perform a search in the preset database based on the target account identifier for a first resource record to be transferred and a second resource record to be transferred corresponding to the target account identifier.

[0057] In one exemplary embodiment, the record lookup unit includes:

[0058] The lookup subunit is configured to perform a search in the preset database based on the target account identifier, for historical resource transfer records corresponding to the target account identifier; the historical resource transfer records include processed resource records and unprocessed resource records.

[0059] The filtering subunit is configured to filter out the unprocessed resource records from the historical resource transfer records; the unprocessed resource records include the first resource record to be transferred and the second resource record to be transferred.

[0060] In one exemplary embodiment, the resource update module includes:

[0061] The status update unit is configured to update the first resource record to be transferred and the second resource record to be transferred to a processed status based on the hot message queue.

[0062] The integrated virtual resource determination unit is configured to determine integrated virtual resources based on the virtual resources corresponding to the first resource record to be transferred and the second resource record to be transferred, respectively.

[0063] The initial virtual resource acquisition unit is configured to acquire the initial virtual resource corresponding to the target account identifier;

[0064] The virtual resource update determination unit is configured to perform an update virtual resource determination based on the initial virtual resource and the comprehensive virtual resource to obtain the updated virtual resource corresponding to the target account identifier.

[0065] In one exemplary embodiment, the apparatus further includes:

[0066] The preset time period determination module is configured to determine the preset time period corresponding to the hot account identifier based on the hot message queue when the target account identifier is a non-hot account identifier;

[0067] The hotspot account marking module is configured to mark the target account identifier as a hotspot account identifier based on the hotspot message queue during the preset time period.

[0068] In one exemplary embodiment, the apparatus further includes:

[0069] The interval period determination module is configured to determine the interval period for processing requests of the hot message queue;

[0070] The preset time period determination module is configured to determine the preset time period based on the interval time period.

[0071] In one exemplary embodiment, the apparatus further includes:

[0072] The unprocessed request acquisition module is configured to acquire unprocessed virtual resource transfer requests based on the synchronous message queue;

[0073] The request processing module is configured to execute the unprocessed virtual resource transfer request based on the affinity thread pool queue;

[0074] The unprocessed resource update module is configured to update the virtual resource corresponding to the target account identifier based on the unprocessed virtual resource transfer request.

[0075] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0076] processor;

[0077] Memory used to store the processor's executable instructions;

[0078] The processor is configured to execute the instructions to implement the virtual resource update method described above.

[0079] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein when instructions in the computer-readable storage medium are executed by an electronic device processor, the electronic device is enabled to perform the virtual resource update method as described above.

[0080] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the virtual resource update method as described above.

[0081] The technical solutions provided by the embodiments of this disclosure bring at least the following beneficial effects:

[0082] When a virtual resource transfer request in an asynchronous message queue meets preset conditions, the virtual resource transfer request is sent to a hot message queue. The virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource. Based on the hot message queue, the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier are obtained. The first resource record to be transferred is generated based on the target virtual resource. The second resource record to be transferred is a resource record that has not been processed in a historical period. The present disclosure uses an asynchronous message queue to process the virtual resource transfer request of the account, which overcomes the problem of relying on business retries due to rate limiting of synchronous interfaces in related technologies. Based on the hot message queue, the virtual resource corresponding to the target account identifier is updated according to the first resource record to be transferred and the second resource record to be transferred. In this disclosure, when a virtual resource transfer request meets preset conditions, the resource record to be transferred corresponding to the target account identifier is obtained through hotspot message queue processing, and the resource record is processed in batches. This enables one-time update processing of virtual resource requests for the same target account within a historical period, achieving fast and efficient updates of virtual resources for hotspot accounts and reducing the update latency of virtual resources for hotspot accounts. At the same time, this disclosure avoids using asynchronous message queues to process resource transfer requests for hotspot accounts, which also reduces the update latency of virtual resources for non-hotspot accounts.

[0083] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0084] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0085] Figure 1 This is an application environment diagram illustrating a virtual resource update method according to an exemplary embodiment.

[0086] Figure 2 This is a flowchart illustrating a virtual resource update method according to an exemplary embodiment.

[0087] Figure 3This is a flowchart illustrating a method for determining whether a virtual resource transfer request meets preset conditions based on an asynchronous message queue, according to an exemplary embodiment.

[0088] Figure 4 This is a flowchart illustrating a method for generating a first resource record to be transferred, according to an exemplary embodiment.

[0089] Figure 5 This is a flowchart illustrating a method for obtaining a first resource record to be transferred and a second resource record to be transferred corresponding to a target account identifier based on a hotspot message queue, according to an exemplary embodiment.

[0090] Figure 6 This is a flowchart illustrating a method for searching a first resource record to be transferred and a second resource record to be transferred corresponding to a target account identifier in a preset database, based on an exemplary embodiment.

[0091] Figure 7 This is a flowchart illustrating a method for updating a virtual resource graph corresponding to a target account identifier based on a first resource record to be transferred and a second resource record to be transferred, according to an exemplary embodiment.

[0092] Figure 8 This is a flowchart illustrating another virtual resource update method according to an exemplary embodiment;

[0093] Figure 9 This is a block diagram illustrating a virtual resource update apparatus according to an exemplary embodiment.

[0094] Figure 10 This is a block diagram illustrating an electronic device for updating virtual resources according to an exemplary embodiment. Detailed Implementation

[0095] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0096] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0097] Please see Figure 1 The diagram illustrates an application environment for a virtual resource update method according to an exemplary embodiment. The application environment may include a server 01 and a client 02.

[0098] Specifically, in the embodiments of this specification, server 01 may include a standalone server, a distributed server, or a server cluster composed of multiple servers. It may also be a cloud server providing basic cloud computing services such as 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 big data and artificial intelligence platforms. Server 01 may include a network communication unit, a processor, and a memory, etc. Specifically, server 01 can be used to send a virtual resource transfer request to a hot message queue when a virtual resource transfer request in an asynchronous message queue meets preset conditions. The virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource. Based on the hot message queue, it obtains a first resource record to be transferred and a second resource record to be transferred corresponding to the target account identifier. The first resource record to be transferred is generated based on the target virtual resource. The second resource record to be transferred is an unprocessed resource record within a historical time period. Based on the hot message queue, it updates the virtual resource corresponding to the target account identifier according to the first and second resource records to be transferred.

[0099] Specifically, in this embodiment of the specification, the client 02 may include physical devices such as smartphones, desktop computers, tablets, laptops, digital assistants, smart wearable devices, and in-vehicle terminals, and may also include software running on the physical device, such as web pages provided to users by some service providers, or applications provided to users by these service providers. Specifically, the client 02 can be used to display updated virtual resources corresponding to the target account identifier.

[0100] Figure 2 This is a flowchart illustrating a virtual resource update method according to an exemplary embodiment, such as... Figure 2 As shown, this method can be applied to Figure 1 The server 01 shown includes the following steps.

[0101] In step S201, when a virtual resource transfer request in the asynchronous message queue meets a preset condition, the virtual resource transfer request is sent to the hot message queue; the virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource.

[0102] Specifically, in this embodiment, virtual resources may include, but are not limited to, points, virtual goods, and gifts. This embodiment can be applied to live streaming scenarios, where the virtual resources of the live streaming account are updated when a viewer makes a donation to the live streaming platform. The target account can be the broadcaster's account, and the target account identifier may include, but is not limited to, the broadcaster's account, nickname, username, and other account information. Preset conditions can indicate that the target account is a popular account, which can be an account with interactive traffic exceeding a preset traffic threshold. In a live streaming scenario, a popular account can be a broadcaster's account with live streaming traffic exceeding a preset traffic threshold.

[0103] Specifically, in this embodiment, a virtual resource transfer request can include a virtual resource transfer-in request and a virtual resource transfer-out request. In a live streaming scenario, when the target account is the broadcaster, the virtual resource transfer request can be a virtual resource transfer-in request, meaning that virtual resources need to be added to the broadcaster's account. An asynchronous message queue and a hot message queue can be set up on the server. The hot message queue handles virtual resource transfer requests corresponding to hot accounts, while the asynchronous message queue handles virtual resource transfer requests for non-hot accounts. Compared to related technologies that use synchronous interface rate limiting to handle virtual resource transfer requests for all accounts, this embodiment uses an asynchronous message queue to handle account virtual resource transfer requests, overcoming the problem of relying on business retries due to synchronous interface rate limiting in related technologies. This embodiment also separates hot accounts from non-hot accounts, reducing the data processing pressure on the asynchronous message queue and improving the update efficiency of virtual resources for each hot and non-hot account.

[0104] In this embodiment of the disclosure, before step S201, as follows: Figure 3 As shown, the above method also includes:

[0105] In step S2001, based on the above asynchronous message queue, it is determined whether the above virtual resource transfer request meets the preset conditions;

[0106] Specifically, in this embodiment of the disclosure, preset conditions corresponding to the resource transfer request can be set in advance. After receiving the virtual resource transfer request, the asynchronous message queue can determine whether the virtual resource transfer request meets the preset conditions; and determine whether to send the virtual resource transfer request to the hotspot message queue based on the determination result; that is, determine whether the asynchronous message queue should perform a virtual resource update operation based on the virtual resource transfer request.

[0107] In some embodiments, determining whether the virtual resource transfer request meets preset conditions includes:

[0108] Determine whether the above target account identifier is a hot account identifier; or

[0109] Specifically, in this embodiment, a hot account can be an account whose interactive traffic exceeds a preset traffic threshold; in a live streaming scenario, a hot account can be a streamer account whose live streaming traffic exceeds a preset traffic threshold; after receiving a virtual resource transfer request, the corresponding target account identifier can be obtained by parsing the virtual resource transfer request. In this embodiment, a hot account database corresponding to hot accounts can be pre-built. Specifically, based on the live streaming traffic corresponding to each account, accounts with live streaming traffic exceeding a preset traffic threshold can be identified as hot accounts, and the hot account identifiers corresponding to the hot accounts can be stored in the hot account database. Then, the hot account database is searched to see if a target account identifier exists; if a target account identifier exists in the hot account database, the target account identifier is determined to be a hot account identifier, and the virtual resource transfer request is determined to meet preset conditions; otherwise, the target account identifier is determined to be a non-hot account identifier.

[0110] Determine whether the total number of virtual resource transfer requests corresponding to the above target account identifier is greater than a preset threshold; the above hotspot account identifier is the identifier corresponding to the account whose traffic exceeds the traffic threshold; the above total number of virtual resource transfer requests is updated based on the above virtual resource transfer requests;

[0111] Specifically, in this embodiment, the total number of virtual resource transfer requests corresponding to the target account identifier can be updated based on the current virtual resource transfer requests; the original number of virtual resource transfer requests corresponding to the target account identifier can be obtained, and 1 can be added to the original number to obtain the total number; the target account can be determined as a hot account based on the total number of virtual resource transfer requests corresponding to the target account identifier; if the total number of virtual resource transfer requests corresponding to the target account identifier is greater than a preset threshold, the target account identifier can be determined as a hot account identifier; and the virtual resource transfer request can be determined to meet preset conditions. If the total number of virtual resource transfer requests corresponding to the target account identifier is less than or equal to the preset threshold, the target account identifier can be determined as a non-hot account identifier; and the virtual resource transfer request can be determined to not meet preset conditions.

[0112] In some embodiments, the above method further includes:

[0113] If any of the above judgment results are yes, it is determined that the above virtual resource transfer request meets the preset conditions.

[0114] Specifically, in this embodiment of the disclosure, if the target account identifier is a hotspot account identifier, or the total number of virtual resource transfer requests corresponding to the target account identifier is greater than a preset threshold, then the virtual resource transfer request is determined to meet the preset conditions.

[0115] In this embodiment of the disclosure, it is possible to determine whether a target account is a hot account based on the target account identifier or the total number of virtual resource transfer requests corresponding to the target account identifier, and further determine whether the virtual resource transfer request meets the preset conditions, thereby realizing the diversion of message queues corresponding to hot accounts and non-hot accounts, and improving the update efficiency of virtual resources of hot accounts and non-hot accounts.

[0116] In step S2003, when the virtual resource transfer request does not meet the preset conditions, the virtual resource transfer request is processed based on the asynchronous message queue.

[0117] Specifically, in this embodiment of the disclosure, a virtual resource transfer request that does not meet the preset conditions includes two cases: the target account identifier is a non-hotspot account identifier and the total number of virtual resource transfer requests corresponding to the target account identifier is less than or equal to a preset threshold. In this case, it can be determined that the target account is a non-hotspot account, and the above-mentioned virtual resource transfer request can be processed through an asynchronous message queue, and the virtual resources corresponding to the target account can be updated.

[0118] Specifically, in some embodiments, for non-hotspot accounts, messages can be assembled based on virtual resource transfer requests and stored in a kinship thread pool queue; different account identifiers correspond to different kinship thread pool queues, with each account identifier corresponding to one kinship thread pool queue. Then, the corresponding first resource record to be transferred is retrieved from a preset database through the kinship thread pool queue, and its status is determined to be "processing". If so, the virtual resources of the target account are updated based on the first resource record to be transferred through the kinship thread pool queue, and the status corresponding to the first resource record to be transferred is updated to "processed".

[0119] In this embodiment of the disclosure, the asynchronous message queue is only used to process virtual resource transfer requests for non-hot accounts, avoiding the use of asynchronous message queues to process resource transfer requests for hot accounts, thereby reducing the update latency of virtual resources for non-hot accounts and improving the update efficiency of virtual resources for non-hot accounts.

[0120] In step S202, based on the aforementioned hotspot message queue, the first resource record to be transferred and the second resource record to be transferred corresponding to the aforementioned target account identifier are obtained; the first resource record to be transferred is generated based on the aforementioned target virtual resource; the second resource record to be transferred is a resource record that has not been processed within a historical period.

[0121] Specifically, in this embodiment, for a popular account, multiple viewers may be given donations in a short period of time, resulting in multiple virtual resource transfer requests. If these requests are processed one by one, it will obviously overload the popular message queue and reduce the efficiency of updating virtual resources. In this embodiment, after determining that the target account is a popular account, all records of resources to be transferred in the historical period can be processed in batches, which improves the efficiency of updating virtual resources for popular accounts.

[0122] In some embodiments, obtaining the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier based on the aforementioned hotspot message queue may include:

[0123] Based on the aforementioned hot message queue, determine whether the time corresponding to the aforementioned virtual resource transfer request is a preset time.

[0124] Specifically, in this embodiment of the disclosure, the hotspot message queue can process the resource records to be transferred for the same account in batches at intervals, and the preset time can be the end time of the interval period.

[0125] If the time corresponding to the above virtual resource transfer request is a preset time, determine whether the above virtual resource transfer request meets the preset conditions.

[0126] Specifically, in this embodiment of the disclosure, when the time corresponding to the virtual resource transfer request is a preset time, it indicates that the request is the last request within the interval period; at this time, the hotspot message queue can obtain unprocessed resource records within the historical period (current interval period) and perform batch processing, thereby improving the processing efficiency of multiple virtual resource transfer requests.

[0127] In some embodiments, the above method further includes:

[0128] If the time corresponding to the above virtual resource transfer request is not a preset time, store the first record of the virtual resource transfer request to be transferred.

[0129] Specifically, in this embodiment of the disclosure, when the time corresponding to the virtual resource transfer request is not a preset time, it indicates that the request is not the last request within the interval period, but can be the first request or an intermediate request within the interval period. In this case, the first record of the virtual resource transfer request to be transferred can be stored; and the next virtual resource transfer request can be waited for until the time corresponding to the received virtual resource transfer request is the preset time, and then all records of the virtual resource transfer request to be transferred within the interval period are processed in batches; thereby reducing the data processing pressure of the hot message queue and improving the data processing efficiency of the hot message queue.

[0130] In some embodiments, obtaining the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier based on the aforementioned hotspot message queue may include:

[0131] Based on the aforementioned hot message queue, and according to the aforementioned virtual resource transfer requests, the total number of virtual resource transfer requests corresponding to the target account is determined;

[0132] Specifically, in this embodiment of the disclosure, for the same account, the hotspot message queue can be set to have a total number of virtual resource transfer requests processed in a single transaction. When the total number of requests reaches a preset threshold, the generated resource records to be transferred are then processed in batches. Specifically, the total number of virtual resource transfer requests corresponding to the target account can be determined based on the virtual resource transfer requests, and it can be determined whether the total number of requests is greater than the preset threshold.

[0133] If the total number of attempts exceeds the preset threshold, obtain the first resource record to be transferred and the second resource record to be transferred corresponding to the above target account identifier.

[0134] Specifically, in this embodiment of the disclosure, when the total number of times exceeds a preset threshold, the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier can be obtained, thereby batch processing of the resource records to be transferred and updating the virtual resources of the target account, thereby improving the processing efficiency of multiple virtual resource transfer requests.

[0135] In some embodiments, when the total number of requests is less than or equal to a preset threshold, it indicates that the number of virtual resource transfer requests received by the target account has not reached the preset threshold of the hotspot message queue. In this case, the received virtual resource transfer requests will not be processed temporarily, thereby reducing the data processing pressure on the hotspot message queue and improving the data processing efficiency of the hotspot message queue.

[0136] In this embodiment of the disclosure, such as Figure 4 As shown, the above method also includes:

[0137] In step S401, the aforementioned virtual resource transfer request is obtained based on the synchronous message queue;

[0138] Specifically, in this embodiment of the disclosure, the server further includes a synchronization message queue, which is used to receive virtual resource transfer requests sent by the business system; the business system can be a backend server corresponding to the target business, and the virtual resource is the resource corresponding to the target business.

[0139] In step S402, based on the aforementioned synchronous message queue and the target virtual resource in the aforementioned virtual resource transfer request, the aforementioned first resource record to be transferred is generated;

[0140] Specifically, in this embodiment of the disclosure, the first resource record to be transferred can be generated by synchronizing the message queue based on the target virtual resource in the virtual resource transfer request; the first resource record to be transferred may include the target virtual resource to be transferred and the target account identifier.

[0141] In step S403, the first resource record to be transferred is sent to the preset database based on the aforementioned synchronization message queue.

[0142] Specifically, in this embodiment of the disclosure, the first resource record to be transferred can be sent to a preset database through a synchronous message queue; wherein, the preset database includes the association between account identifiers and resource records to be transferred, wherein one account identifier can correspond to one or more resource records to be transferred, and the preset database is used to store resource records to be transferred corresponding to different accounts and their corresponding processing status; for example, the status corresponding to the first resource record to be transferred can be set to processing or not processed in the preset database.

[0143] In this embodiment of the disclosure, such as Figure 5 As shown, based on the aforementioned hot message queue, the first resource record to be transferred and the second resource record to be transferred corresponding to the aforementioned target account identifier are obtained, including:

[0144] In step S2021, a resource transfer record retrieval request is sent to a preset database based on the hotspot message queue; the resource transfer record retrieval request carries the target account identifier.

[0145] Specifically, in this embodiment of the disclosure, the hotspot message queue can send a resource transfer record retrieval request to a preset database, and obtain the resource record to be transferred corresponding to the target account identifier according to the target account identifier; wherein, the resource record to be transferred includes a first resource record to be transferred and a second resource record to be transferred.

[0146] In step S2022, based on the target account identifier, the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier are searched in the preset database.

[0147] Specifically, in this embodiment of the disclosure, a resource record to be transferred that matches the target account identifier can be searched in a preset database to obtain a first resource record to be transferred and a second resource record to be transferred.

[0148] In this embodiment of the disclosure, the synchronous message queue can generate a first resource record to be transferred based on the target virtual resource in the virtual resource transfer request; and send the first resource record to be transferred to a preset database; thereby realizing the storage of resource records to be transferred at different times and for different accounts in the preset database, which facilitates the subsequent batch acquisition of multiple resource records to be transferred corresponding to the target account and batch processing.

[0149] In this embodiment of the disclosure, such as Figure 6 As shown, the above-mentioned method of searching for the first and second resource records to be transferred corresponding to the target account identifier in the preset database based on the target account identifier includes:

[0150] In step S20221, based on the target account identifier, the historical resource transfer record corresponding to the target account identifier is searched in the preset database; the historical resource transfer record includes processed resource records and unprocessed resource records.

[0151] Specifically, in this embodiment, a preset database stores historical resource transfer records corresponding to each account, including processed and unprocessed parts; this embodiment first searches for all historical resource transfer records corresponding to the target account identifier in the preset database according to the target account identifier; and further filters out unprocessed resource records to be transferred.

[0152] In step S20222, the unprocessed resource records are selected from the historical resource transfer records; the unprocessed resource records include the first resource record to be transferred and the second resource record to be transferred.

[0153] Specifically, in this embodiment of the disclosure, unprocessed resource records can be filtered from historical resource transfer records based on the tag status corresponding to each resource transfer record; the unprocessed resource records include a first resource record to be transferred and a second resource record to be transferred.

[0154] In this embodiment of the disclosure, a preset database stores processed and unprocessed resource transfer records corresponding to each account; unprocessed resource records to be transferred can be accurately filtered out based on the status information corresponding to each resource transfer record, thereby facilitating accurate updates of virtual resources.

[0155] In step S203, based on the aforementioned hotspot message queue, the virtual resources corresponding to the aforementioned target account identifier are updated according to the aforementioned first resource record to be transferred and the aforementioned second resource record to be transferred.

[0156] In some embodiments, such as Figure 7As shown, based on the aforementioned hotspot message queue, and according to the aforementioned first resource record to be transferred and the aforementioned second resource record to be transferred, the virtual resource corresponding to the aforementioned target account identifier is updated, including:

[0157] In step S2031, based on the above-mentioned hot message queue, the first resource record to be transferred and the second resource record to be transferred are updated to the processed status.

[0158] Specifically, in this embodiment of the disclosure, the first resource record to be transferred and the second resource record to be transferred can be updated to the processed state according to the hot message queue, and the status information corresponding to each resource record to be transferred can be stored in a preset database.

[0159] In step S2032, based on the virtual resources corresponding to the first resource record to be transferred and the second resource record to be transferred, a comprehensive virtual resource is determined.

[0160] Specifically, in this embodiment of the disclosure, the virtual resources corresponding to the first resource record to be transferred and the second resource record to be transferred can be obtained, and the sum of each virtual resource can be calculated to obtain the comprehensive virtual resources; wherein, the second resource record to be transferred can be one or more.

[0161] In step S2033, the initial virtual resources corresponding to the target account identifier are obtained;

[0162] Specifically, in this embodiment, the initial virtual resources corresponding to the target account identifier are the total value of virtual resources before the update, and the initial virtual resources corresponding to the target account identifier can be obtained through a preset database. The preset database can also store the initial virtual resources corresponding to each account, and the initial virtual resources corresponding to each account can be displayed on the terminal corresponding to each account.

[0163] In step S2034, based on the initial virtual resources and the comprehensive virtual resources, the updated virtual resources corresponding to the target account identifier are obtained.

[0164] Specifically, in this embodiment of the disclosure, the sum of the initial virtual resources and the comprehensive virtual resources can be calculated to obtain the updated virtual resources corresponding to the target account identifier; the updated virtual resources corresponding to the target account identifier can be stored in a preset database; and the updated virtual resources can be displayed on the terminal corresponding to the target account.

[0165] In this embodiment of the disclosure, the updated virtual resources corresponding to the target account identifier can be obtained based on each resource record to be transferred corresponding to the target account identifier and the initial virtual resources; thereby realizing the updating of virtual resources based on batch resource records to be transferred, and improving the updating efficiency of virtual resources of the target account.

[0166] In some embodiments, before updating the virtual resource corresponding to the target account identifier based on the hotspot message queue, according to the first resource record to be transferred and the second resource record to be transferred, the method further includes:

[0167] When the target account is identified as a non-hotspot account, a preset time period corresponding to the hotspot account is determined based on the hotspot message queue.

[0168] Specifically, in this embodiment, when the target account identifier is a non-hotspot account identifier, the target account identifier can be determined as a hotspot account identifier based on the hotspot message queue, and a preset time period corresponding to the hotspot account identifier can be determined. The preset time period can be a period after the current time, and the preset time period is used to characterize the duration of the hotspot account identifier; the preset time period can be set according to the actual situation. Within the preset time period, even if it is determined through interactive traffic that the target account has been converted to a non-hotspot account, it will still continue to be tagged as a hotspot account, thereby ensuring that its corresponding virtual resources continue to be updated through the hotspot message queue.

[0169] Based on the aforementioned hot message queue, the aforementioned target account identifier is marked as a hot account identifier during the aforementioned preset time period.

[0170] Specifically, in this embodiment of the disclosure, a hotspot message queue can be used to mark the target account identifier as a hotspot account identifier within a preset time period; thereby preventing the hotspot account from becoming a non-hotspot account while the hotspot message queue is waiting to process the resource records to be transferred in batches, and thus processing the next resource record to be transferred that the hotspot message queue is waiting to process through an asynchronous message queue; and preventing the hotspot message queue and the asynchronous message queue from processing the resource records to be transferred for the same account at the same time.

[0171] In some embodiments, when the target account is identified as a hot account, the extended time period corresponding to the hot account can be determined based on the hot message queue. The extended time period can be used to characterize the delay duration of the hot account. During the delayed time period, even if it is determined through interactive traffic that the target account has been converted into a non-hot account, it is still marked as a hot account, thereby ensuring that its corresponding virtual resources continue to be updated through the hot message queue.

[0172] In some embodiments, a preset time period can be determined based on the update virtual resource transfer request corresponding to the target account identifier; if an update virtual resource transfer request corresponding to the target account identifier is continuously received in the first part of a period of time, but no update virtual resource transfer request corresponding to the target account identifier is received in the second part of the period of time, then that period of time can be determined as the preset time period.

[0173] In this embodiment of the disclosure, by setting a preset time period corresponding to the hot account identifier, it can be ensured that the hot account can still remain hot for a period of time after it cools down, thus preventing asynchronous consumption threads and hot consumption threads from concurrently processing their corresponding virtual resource transfer requests.

[0174] In some embodiments, the above method further includes:

[0175] Determine the time interval for processing requests in the aforementioned hot message queue;

[0176] Specifically, in this embodiment of the disclosure, the hotspot message queue can process the resource records to be transferred for the same hotspot account in batches at intervals. The interval for processing requests in the hotspot message queue can be set, and the resource records to be transferred for a hotspot account within the interval can be processed in batches, thereby improving data processing efficiency.

[0177] Based on the aforementioned intervals, the aforementioned preset time period is determined.

[0178] Specifically, in this embodiment of the disclosure, the preset time period can be determined by the interval period. Specifically, the interval period can be determined as the preset time period, or the interval period can be extended by a certain range to obtain the preset time period.

[0179] In this embodiment of the disclosure, the preset time period corresponding to the hot account identifier can be determined by the interval period of the hot message queue processing requests. This ensures that the hot message queue processes all the resource records to be transferred in the last time period and then converts the hot account identifier into a non-hot account identifier, effectively avoiding the hot message queue and the asynchronous message queue from processing the resource records to be transferred for the same account at the same time.

[0180] In some embodiments, the above method further includes:

[0181] If the aforementioned hotspot message queue does not receive a next virtual resource transfer request for the aforementioned target account identifier within the aforementioned preset time period, the hotspot account tag for the aforementioned target account identifier will be revoked.

[0182] In some embodiments, during or after the operation of an asynchronous message queue or a hot message queue, it is possible to check for any unprocessed virtual resource transfer requests and process them, thereby ensuring the accuracy of virtual resource updates for each account.

[0183] In some embodiments, after step S203, the above method further includes:

[0184] Based on the aforementioned synchronous message queue, retrieve any unprocessed virtual resource transfer requests;

[0185] Specifically, in this embodiment of the disclosure, unprocessed virtual resource transfer requests can be obtained periodically through a synchronous message queue; then, the corresponding first resource record to be transferred can be obtained from a preset database through a kinship thread pool queue, and its status can be determined as being processed; if so, the virtual resources of the target account can be updated based on the first resource record to be transferred through the kinship thread pool queue, and the status corresponding to the first resource record to be transferred can be updated to being processed.

[0186] Based on the affinity thread pool queue, process the above-mentioned unprocessed virtual resource transfer requests;

[0187] Specifically, in this embodiment of the disclosure, requests that are missed in the processing of asynchronous message queues or hot message queues can be processed uniformly through a kinship thread pool queue.

[0188] Based on the unprocessed resources corresponding to the aforementioned unprocessed virtual resource transfer requests, update the virtual resources corresponding to the aforementioned target account identifier.

[0189] Specifically, in this embodiment of the disclosure, the initial update resource corresponding to the target account identifier can be obtained, and the sum of the unprocessed resource and the initial update resource can be calculated to obtain the virtual resource corresponding to the target account identifier, thereby achieving accurate updating of the virtual resource corresponding to the target account identifier.

[0190] In this embodiment of the disclosure, after the asynchronous message queue and the hot message queue process the request, a review can be performed through the synchronous message queue to obtain unprocessed virtual resource transfer requests. Then, the unprocessed virtual resource transfer requests are processed through the affinity thread pool queue. Based on the unprocessed resources corresponding to the unprocessed virtual resource transfer requests, the virtual resources corresponding to the target account identifier are updated, thereby improving the update accuracy of the virtual resources corresponding to the target account identifier.

[0191] In a specific embodiment, such as Figure 8 As shown, Figure 8 A flowchart for another method of updating virtual resources; including:

[0192] In step S801, the business system sends a virtual resource transfer request to the synchronization message queue; the virtual resource transfer request carries the target account identifier and the resource to be transferred.

[0193] In step S802, the synchronous message queue generates a pending resource transfer record based on the virtual resource transfer request and sends the pending resource transfer record to the preset database.

[0194] In step S803, the synchronous message queue sends a kinship message to the asynchronous message queue based on the target account identifier;

[0195] Among these features, the database lock contention problem can be solved by distributing virtual resource operations of the same user to the same thread for linear operations through affinity messages and affinity thread pools.

[0196] In step S804, it is determined whether the virtual resource transfer request meets the preset conditions based on the asynchronous message queue;

[0197] The asynchronous message queue can send a judgment request to the cache database, which can then determine whether the virtual resource transfer request meets the preset conditions and return the judgment result to the asynchronous message queue. The cache database can include hot account identifiers and the number of requests corresponding to each account. The preset conditions include that the target account identifier is a hot account identifier, or that the total number of virtual resource transfer requests corresponding to the target account is greater than a preset threshold. If the target account is determined to be a non-hot account, step S805 is executed; if the target account is determined to be a hot account, step S808 is executed.

[0198] In step S805, the assembled message is placed into the affinity thread pool task queue;

[0199] In step S806, the resource transfer record is queried through the affinity thread to determine the processing status corresponding to the resource transfer record; if the processing status corresponding to the resource transfer record is "processing", step S807 is executed.

[0200] In step S807, the virtual resource is updated through the affinity thread, a new transaction record is added, and the status of the resource transfer record is updated to successful.

[0201] In step S808, a kinship message is sent to the hotspot message queue based on the target account identifier;

[0202] In step S809, the kinship message is stored in a preset queue;

[0203] The preset queue can be a BufferTrigger queue. BufferTrigger is a data collection trigger used to collect data and trigger logic based on the amount of data or a timer. The aggregation processing function of the BufferTrigger component can be used to merge and process virtual resource change operations of the same account within a certain period of time.

[0204] The specific implementation involves constructing BufferTrigger objects whose elements are BatchTransferFuture. BatchTransferFuture corresponds to a future pattern that supports asynchronous computation, can return results, and can block the caller's thread until the result is returned. The batch future pattern is an extension of the future pattern. BatchTransferFuture is a CompletableFuture. <consumeresult>A subclass of `CompletableFuture`, possessing only the attribute of virtual resource transfer messages. `CompletableFuture` acts as a task orchestration tool, with `ConsumeResult` representing the message consumption result. Constructing subclass objects of `CompletableFuture` as elements of the `BufferTrigger` queue allows passing the execution result of the `BufferTrigger` task thread, thus determining whether the message was successfully consumed. The storage structure of `BufferTrigger` is defined as a `ConcurrentHashMap`. <String,ConcurrentLinkedQueue <batchtransferfuture>ConcurrentHashMap is a hash table that supports high-concurrency updates and queries. ConcurrentLinkedQueue is a utility class provided by the java.util.concurrent.juc package for concurrent programming, implemented in a classic non-blocking manner. It consists of a head node and a tail node, with each node consisting of an item and a reference to the next node. Using the account's unique identifier as the key, when enqueuing a BufferTrigger, the constructed BatchTransferFuture object is placed into the corresponding queue, ensuring that messages from the same account are in the same queue. The BufferTrigger's scheduled task executes the defined consumption method at set intervals. The input parameter of this method is the BufferTrigger's storage structure, a ConcurrentHashMap. <String,ConcurrentLinkedQueue <batchtransferfuture>This method iterates through the ConcurrentLinkedQueue data for each account, retrieving all order numbers from the ConcurrentLinkedQueue. It then batch-queries the corresponding virtual resource transfer records from the database, categorizing them into "processing" and "processed" lists based on their status. A database transaction is initiated, changing the "processing" records to "processed." The total virtual resource change data for the "processing" virtual resource transfer records is calculated, and the flow chart for this batch is constructed. Within this database transaction, the virtual resources are modified once, and all flows for this batch are inserted in batches. Finally, the complete synchronous execution result of the BatchTransferFuture in the queue is called in batches. After receiving the execution result, the consumer thread sends an ACK (Acknowledge character) to the message broker. ACK is a transmission control character sent by the receiving station to the sending station in data communication, indicating that the received data has been confirmed as correct. By merging virtual resource operations, the consumption rate is greatly improved, and the BatchTransferFuture object mechanism ensures data correctness and integrity.

[0205] In step S8010, based on a preset queue in the hot message queue, batch processing of messages in the queue is triggered periodically;

[0206] In step S8011, during task processing, the target account is identified as a hot account; and the target account identifier is sent to the cache database.

[0207] In step S8012, resource transfer records are retrieved in batches according to the order number in the queue;

[0208] Specifically, resource transfer records can be retrieved in batches using the order numbers in a preset queue;

[0209] In step S8013, records in the processing state are filtered and their status is updated to "processed successfully".

[0210] Specifically, based on the status of each resource transfer record, records in the processing state can be filtered out and their status updated to "processed successfully".

[0211] In step S8014, the total virtual resources corresponding to the records with updated status are calculated;

[0212] In step S8015, the virtual resources are modified, and the pipeline is inserted in batches;

[0213] In step S8016, the resource transfer records in progress are obtained through the account fallback queue;

[0214] In step S8017, the account safety net queue records are added to the affinity thread pool task queue;

[0215] In step S8018, the virtual resources are updated through the affinity thread pool, a new transaction record is added, and the status of the resource transfer record is updated to "processed successfully".

[0216] Among them, the strategy of using an account-backed queue can prevent message loss or multiple failed consumption attempts by the viewer.

[0217] This embodiment increases the interface capacity of hot users from 20 queries per second (QPS) to tens of thousands of QPS, the same as non-hot users, and can be further increased through expansion; reduces the arrival latency of hot users from days to seconds; reduces the database lock duration from hundreds of milliseconds to less than 1 millisecond; and ensures that hot users do not affect the arrival latency of non-hot users.

[0218] When a virtual resource transfer request in an asynchronous message queue meets preset conditions, the present disclosure sends a virtual resource transfer request to a hot message queue. The virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource. The present disclosure uses an asynchronous message queue to process the virtual resource transfer request of the account, overcoming the problem of relying on business retries due to rate limiting of synchronous interfaces in related technologies. Based on the hot message queue, the present disclosure obtains a first resource record to be transferred and a second resource record to be transferred corresponding to the target account identifier. The first resource record to be transferred is generated based on the target virtual resource. The second resource record to be transferred is a resource record that has not been processed in a historical period. Based on the hot message queue, the virtual resource corresponding to the target account identifier is updated according to the first resource record to be transferred and the second resource record to be transferred. In this disclosure, when a virtual resource transfer request meets preset conditions, the resource record to be transferred corresponding to the target account identifier is obtained through hotspot message queue processing, and the resource record is processed in batches. This enables one-time update processing of virtual resource requests for the same target account within a historical period, achieving fast and efficient updates of virtual resources for hotspot accounts and reducing the update latency of virtual resources for hotspot accounts. At the same time, this disclosure avoids using asynchronous message queues to process resource transfer requests for hotspot accounts, which also reduces the update latency of virtual resources for non-hotspot accounts.

[0219] Figure 9 This is a block diagram illustrating a virtual resource updating apparatus according to an exemplary embodiment. (Refer to...) Figure 9 The device includes:

[0220] The transfer request sending module 910 is configured to send the virtual resource transfer request to the hot message queue when the virtual resource transfer request executed in the asynchronous message queue meets the preset conditions; the virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource.

[0221] The record acquisition module 920 is configured to perform an operation based on the aforementioned hotspot message queue to acquire a first resource record to be transferred and a second resource record to be transferred corresponding to the aforementioned target account identifier; the first resource record to be transferred is generated based on the aforementioned target virtual resource; the second resource record to be transferred is a resource record that has not been processed within a historical time period.

[0222] The resource update module 930 is configured to perform an update based on the hotspot message queue, according to the first resource record to be transferred and the second resource record to be transferred, to update the virtual resources corresponding to the target account identifier.

[0223] In some embodiments, the above-described apparatus further includes:

[0224] The condition judgment module is configured to perform an operation based on the aforementioned asynchronous message queue to determine whether the aforementioned virtual resource transfer request meets preset conditions.

[0225] The request processing module is configured to process the virtual resource transfer request based on the asynchronous message queue when the virtual resource transfer request does not meet the preset conditions.

[0226] In some embodiments, the condition judgment module includes:

[0227] The first judgment unit is configured to perform a judgment on whether the target account identifier is a hot account identifier;

[0228] The second judgment unit is configured to judge whether the total number of virtual resource transfer requests corresponding to the target account identifier is greater than a preset threshold; the hot account identifier is the identifier corresponding to the account whose traffic exceeds the traffic threshold; the total number of virtual resource transfer requests is updated based on the virtual resource transfer requests.

[0229] In some embodiments, the above-described apparatus further includes:

[0230] The determination module is configured to determine that the virtual resource transfer request meets preset conditions if the judgment result of the first judgment unit or the second judgment unit is yes.

[0231] In some embodiments, the above-described apparatus further includes:

[0232] The request acquisition module is configured to execute the virtual resource transfer request based on the synchronous message queue.

[0233] The record generation module is configured to generate the first record of the resource to be transferred based on the target virtual resource in the virtual resource transfer request according to the aforementioned synchronous message queue.

[0234] The record sending module is configured to send the first resource record to be transferred to a preset database based on the aforementioned synchronous message queue.

[0235] In some embodiments, the record acquisition module includes:

[0236] The request sending unit is configured to send a resource transfer record retrieval request to the preset database based on the aforementioned hotspot message queue; the resource transfer record retrieval request carries the aforementioned target account identifier.

[0237] The record lookup unit is configured to perform a search in the preset database based on the target account identifier for the first resource record to be transferred and the second resource record to be transferred corresponding to the target account identifier.

[0238] In some embodiments, the record lookup unit includes:

[0239] The search subunit is configured to perform a search in the preset database based on the target account identifier to find the historical resource transfer record corresponding to the target account identifier; the historical resource transfer record includes processed resource records and unprocessed resource records.

[0240] The filtering subunit is configured to filter out the unprocessed resource records from the aforementioned historical resource transfer records; the unprocessed resource records include the aforementioned first resource record to be transferred and the aforementioned second resource record to be transferred.

[0241] In some embodiments, the resource update module includes:

[0242] The status update unit is configured to update the first resource record to be transferred and the second resource record to be transferred to the processed status based on the hot message queue.

[0243] The integrated virtual resource determination unit is configured to determine integrated virtual resources based on the virtual resources corresponding to the first resource record to be transferred and the second resource record to be transferred, respectively.

[0244] The initial virtual resource acquisition unit is configured to acquire the initial virtual resources corresponding to the aforementioned target account identifier;

[0245] The virtual resource determination unit is configured to perform an update virtual resource determination based on the initial virtual resource and the comprehensive virtual resource to obtain the updated virtual resource corresponding to the target account identifier.

[0246] In some embodiments, the above-described apparatus further includes:

[0247] The preset time period determination module is configured to determine the preset time period corresponding to the hot account identifier based on the hot message queue when the target account identifier is a non-hot account identifier.

[0248] The hot account marking module is configured to mark the target account identifier as a hot account identifier during the preset time period based on the aforementioned hot message queue.

[0249] In some embodiments, the above-described apparatus further includes:

[0250] The interval period determination module is configured to determine the interval period for processing the aforementioned hot message queue requests;

[0251] The preset time period determination module is configured to determine the preset time period based on the aforementioned interval time period.

[0252] In some embodiments, the above-described apparatus further includes:

[0253] The unprocessed request acquisition module is configured to acquire unprocessed virtual resource transfer requests based on the aforementioned synchronous message queue;

[0254] The request processing module is configured to execute the above-mentioned unprocessed virtual resource transfer requests based on the affinity thread pool queue;

[0255] The unprocessed resource update module is configured to update the virtual resource corresponding to the target account identifier based on the unprocessed virtual resource transfer request mentioned above.

[0256] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0257] In one exemplary embodiment, an electronic device is also provided, including a processor; a memory for storing processor-executable instructions; wherein, when the processor is configured to execute the instructions stored in the memory, it implements the virtual resource update method provided in any of the above embodiments.

[0258] The electronic device can be a terminal, a server, or a similar computing device. Taking a server as an example... Figure 10 This is a block diagram illustrating an electronic device according to an exemplary embodiment, such as... Figure 10 As shown, the server 1000 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1010 (CPUs 1010 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 1030 for storing data, and one or more storage media 1020 (e.g., one or more mass storage devices) for storing application programs 1023 or data 1022. The memory 1030 and storage media 1020 may be temporary or persistent storage. The program stored in the storage media 1020 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 1010 may be configured to communicate with the storage media 1020 and execute the series of instruction operations in the storage media 1020 on the server 1000. Server 1000 may also include one or more power supplies 1060, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1040, and / or one or more operating systems 1021, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0259] The input / output interface 1040 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 1000. In one example, the input / output interface 1040 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 1040 may be a radio frequency (RF) module for wireless communication with the Internet.

[0260] Those skilled in the art will understand that Figure 10 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 1000 may also include... Figure 10 The more or fewer components shown, or having the same Figure 10 The different configurations shown.

[0261] In one exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1030 including instructions, which can be executed by a processor 1010 of the device 1000 to perform the above-described method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0262] In one exemplary embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the virtual resource update method provided in any of the above embodiments.

[0263] When a virtual resource transfer request in an asynchronous message queue meets preset conditions, the present disclosure sends a virtual resource transfer request to a hot message queue. The virtual resource transfer request carries the target account identifier of the account to be transferred and the target virtual resource. The present disclosure uses an asynchronous message queue to process the virtual resource transfer request of the account, overcoming the problem of relying on business retries due to rate limiting of synchronous interfaces in related technologies. Based on the hot message queue, the present disclosure obtains a first resource record to be transferred and a second resource record to be transferred corresponding to the target account identifier. The first resource record to be transferred is generated based on the target virtual resource. The second resource record to be transferred is a resource record that has not been processed in a historical period. Based on the hot message queue, the virtual resource corresponding to the target account identifier is updated according to the first resource record to be transferred and the second resource record to be transferred. In this disclosure, when a virtual resource transfer request meets preset conditions, the resource record to be transferred corresponding to the target account identifier is obtained through hotspot message queue processing, and the resource record is processed in batches. This enables one-time update processing of virtual resource requests for the same target account within a historical period, achieving fast and efficient updates of virtual resources for hotspot accounts and reducing the update latency of virtual resources for hotspot accounts. At the same time, this disclosure avoids using asynchronous message queues to process resource transfer requests for hotspot accounts, which also reduces the update latency of virtual resources for non-hotspot accounts.

[0264] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0265] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0266] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.< / batchtransferfuture> < / batchtransferfuture> < / consumeresult>

Claims

1. A method for updating virtual resources, characterized in that, include: S01: The business system sends a virtual resource transfer request to the synchronous message queue; The virtual resource transfer request carries the target account identifier and the resources to be transferred; S02: The synchronous message queue generates a resource transfer record to be processed based on the virtual resource transfer request, and sends the resource transfer record to be processed to the preset database; S03: The synchronous message queue sends a affinity message to the asynchronous message queue based on the target account identifier; S04: The asynchronous message queue determines whether the virtual resource transfer request meets the preset conditions; the preset conditions include that the target account identifier is a hot account identifier, or the total number of virtual resource transfer requests corresponding to the target account is greater than a preset number threshold; if the target account is determined to be a non-hot account, proceed to step S05; if the target account is determined to be a hot account, proceed to step S08. S05: Assemble the message and put it into the affinity thread pool task queue; S06: Query the resource transfer record through the affinity thread to determine the processing status corresponding to the resource transfer record; if the processing status corresponding to the resource transfer record is "processing", proceed to step S07; S07: Update virtual resources through kinship thread, add transaction records, and update the status of resource transfer records to success; S08: Send a kinship message to the hotspot message queue based on the target account identifier; S09: Store the kinship message in a preset queue in the hot message queue; S010: Based on the preset queue in the hot message queue, trigger batch processing of messages in the queue at regular intervals; S011: During task processing, the target account is identified as a hot account; and the target account identifier is sent to the cache database. S012: Batch retrieve resource transfer records according to the order number in the preset queue; S013: Filter the records in the processing state and update their status to processed successfully; S014: Calculate the total virtual resources corresponding to the records with updated status; S015: Modify virtual resources and insert them into the pipeline in batches; S016: Obtain the resource transfer records in process through the account safety net queue; S017: Put the resource transfer records into the affinity thread pool task queue through the account safety net queue; S018: Update virtual resources through the affinity thread pool, add a new transaction record, and update the status of the resource transfer record to "processed successfully".

2. The method according to claim 1, characterized in that, The hotspot account identifier is the identifier corresponding to the account whose traffic exceeds the traffic threshold.

3. The method according to claim 1, characterized in that, The asynchronous message queue determines whether the virtual resource transfer request meets preset conditions, including: The asynchronous message queue sends a judgment request to the cache database, which determines whether the virtual resource transfer request meets the preset conditions, and returns the judgment result to the asynchronous message queue.

4. The method according to claim 1, characterized in that, The preset queue is a BufferTrigger queue, and the method further includes: The BufferTrigger component's aggregation processing function can be used to merge virtual resource change operations for the same account within a certain period of time.

5. The method according to claim 4, characterized in that, The method further includes: Using the account's unique identifier as the key, when executing the BufferTrigger queue, the constructed Batch TransferFuture object is placed into the corresponding queue, ensuring that messages from the same account are in the same queue.

6. A virtual resource update device, characterized in that, The apparatus is used to perform the virtual resource update method according to any one of claims 1-5.

7. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the virtual resource update method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of an electronic device, the electronic device is able to perform the virtual resource update method as described in any one of claims 1-5.