Resource data processing method and device, storage medium and electronic equipment

By processing resource transfer requests in parallel in solid-state memory, the problem of low resource data processing efficiency caused by the process sequence of solid-state memory implementation is solved, and more efficient resource data processing is achieved.

CN119847451AActive Publication Date: 2025-04-18SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510314487.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-04-18
Estimated Expiration
2045-03-17

AI Technical Summary

Technical Problem

The implementation process of solid-state memory is sequential, resulting in low processing efficiency of resource data.

Method used

By setting a first storage area for storing resource data in the solid state memory, receiving multiple resource transfer requests, building a connection diagram between resource transfer requests, determining a resource transfer request that can be processed in parallel, and calling multiple threads for parallel processing.

Benefits of technology

Improve the processing efficiency of resource data, and make full use of the hardware resources of the multi-processor core by processing multiple resource transfer requests in parallel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847451A_ABST
    Figure CN119847451A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource data processing method and device, a storage medium and electronic equipment, and relates to the field of computers, a first storage area used for storing resource data is arranged in a solid-state memory, and the method comprises the steps that M resource transfer requests carrying to-be-stored resource data are received, a first connection graph among the M resource transfer requests is obtained, N resource transfer requests are determined from the M resource transfer requests according to the first connection graph, and the first connection graph refers to a connection graph used for representing the dependency relationship among the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer processes of other resource transfer requests in the first connection graph; and calling N threads to process the N resource transfer requests in parallel so as to store the to-be-stored resource data respectively carried by the N resource transfer requests into the first storage area in parallel. And the processing efficiency of the resource data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the computer field, and specifically, to a method and device for processing resource data, a storage medium, and an electronic device. Background Art

[0002] In the field of storage systems, solid state drives (SSDs) are storage devices that use semiconductor flash memory as the core storage medium and have been widely used in recent years. They are different from traditional mechanical hard disk drives (HHDs) in terms of performance, power consumption, and reliability.

[0003] In the actual reading and writing process of SSD, there are various operations, such as writing data to SSD, reading data from SSD, formatting SSD, erasing SSD, etc. For each operation, there are multiple steps, and the description of the implementation process of each step is sequential (serial), which cannot be implemented on hardware with multiple processor cores, resulting in low resource data processing efficiency.

[0004] Therefore, the current implementation process of solid-state storage is sequential, resulting in low resource data processing efficiency, which has become a problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present application provide a method and device for processing resource data, a storage medium, and an electronic device, so as to at least solve the problem that the implementation process of solid-state storage is sequential, resulting in low efficiency in processing resource data.

[0006] According to an embodiment of the present application, a method for processing resource data is provided, which is applied to a solid-state memory, wherein a first storage area for storing resource data is provided in the solid-state memory, comprising: receiving M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area; obtaining a first connection diagram between the M resource transfer requests, and determining N resource transfer requests from the M resource transfer requests according to the first connection diagram, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection diagram refers to a connection diagram used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection diagram; calling N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area.

[0007] In an exemplary embodiment, the step of constructing the first connection graph includes: based on the M resource transfer requests, respectively extracting corresponding transfer times and transfer identifiers from the M resource transfer requests; determining a target resource transfer request from the M resource transfer requests, and traversing other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration; for any other traversed resource transfer request, determining a dependent resource transfer request that meets the dependency condition from the other resource transfer requests according to the transfer times and transfer identifiers of the other traversed resource transfer requests and the transfer times and transfer identifiers corresponding to the target resource transfer request; wherein the resource transfer process of the dependent resource transfer request depends on the resource transfer process of the target resource transfer request; re-determining a new target resource transfer request from the M resource transfer requests, and returning to traverse other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration and continue to execute until a preset iteration stop condition is reached, thereby obtaining the first connection graph.

[0008] In an exemplary embodiment, the transfer identifier includes a transferee identifier and a transferor identifier;

[0009] The determining, according to the transfer time and transfer identifier of the other resource transfer requests traversed, and the transfer time and transfer identifier corresponding to the target resource transfer request, from the other resource transfer requests a dependent resource transfer request that satisfies the dependency condition comprises:

[0010] When the transfer time corresponding to the target resource transfer request is less than the transfer time of the other resource transfer requests traversed, and the transfer-in party identifier corresponding to the target resource transfer request is the same as the transfer-out party identifier of the other resource transfer requests traversed, the other resource transfer request is determined as the dependent resource transfer request of the target resource transfer request.

[0011] In an exemplary embodiment, after calling N threads to process the N resource transfer requests in parallel to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area, the method includes: removing the N resource transfer requests in the first connection graph to obtain an updated first connection graph.

[0012] In an exemplary embodiment, calling N threads to process the N resource transfer requests in parallel so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area includes: calling N threads to determine N areas to be stored in the first storage area; the N areas to be stored are N areas where the resource data to be stored are to be stored in the first storage area; and storing the resource data to be stored respectively carried by the N resource transfer requests in parallel into the N areas to be stored in the first storage area through the N threads.

[0013] In an exemplary embodiment, the method further includes: if any one of the N areas to be stored is the same as a stored area set for the first storage area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored; and storing the resource data to be stored respectively carried by the N resource transfer requests in parallel in the N areas to be stored of the first storage area after the erasure process.

[0014] In an exemplary embodiment, a second storage area is also provided in the solid-state memory; the second storage area is used to store at least resource status parameters associated with the resource data stored in the first storage area; the erasing process of the first storage area includes: determining the data to be erased in the first storage area; updating the resource status parameters in the second storage area according to the data to be erased, and writing the updated resource status parameters into the second storage area; when writing the updated resource status parameters into the second storage area, erasing the first storage area based on the determined data to be erased.

[0015] In an exemplary embodiment, after calling N threads to process the N resource transfer requests in parallel so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area, it also includes: obtaining an updated first connection graph, wherein the first connection graph is updated after N resource transfer requests are determined from the M resource transfer requests; based on the updated first connection graph, determining K resource transfer requests from the M resource transfer requests, wherein K is a positive integer; calling K threads to process the K resource transfer requests in parallel so as to store the resource data to be stored respectively carried by the K resource transfer requests in parallel into the first storage area.

[0016] In an exemplary embodiment, the method also includes: under the request that the resource data to be stored carried by the M resource transfer requests are all stored in the first storage area, obtaining a pre-constructed second connection graph between the resource transfer parties of the M resource transfer requests; wherein the second connection graph is obtained based on the connection of multiple key nodes, and the key nodes are used to characterize the resource transfer parties corresponding to the M resource transfer requests respectively; based on the number of key nodes in the second connection graph, determining O threads matching the number of key nodes; based on the connection relationship between the O threads and the multiple key nodes, updating the resource transfer record linked list associated with the M resource transfer requests in parallel.

[0017] In an exemplary embodiment, the solid-state memory is also provided with a third storage area for storing a first pointer parameter and a second pointer parameter; the method further includes: obtaining a power-off instruction; wherein the power-off instruction is an instruction generated by the solid-state memory when it enters a stop working state; based on the power-off instruction, determining the storage location of the resource data in the first storage area, and updating the first pointer parameter and the second pointer parameter in the third storage area according to the storage location.

[0018] In an exemplary embodiment, the solid-state memory includes a first storage area, a second storage area, and a third storage area; before receiving a resource transfer request carrying resource data to be stored, the method also includes at least one of the following: clearing the first storage area, the second storage area, and the third storage area of ​​the solid-state memory; writing an empty record in the first storage area; determining the number P of transferors of the resource transferor, determining P threads, and initializing the resource status parameters in the second storage area based on the P threads, wherein P is a positive integer.

[0019] In an exemplary embodiment, the method also includes: responding to a resource query request; the resource query request includes at least one of a resource change query request and a resource storage query request; in a case where the resource query request includes the resource change query request, based on the resource change query request, determining a resource first change record matching the resource change query request from resource status parameters stored in the second storage area; determining an address of the resource first change record; according to the address, determining a query result corresponding to the resource change query request; in a case where the resource query request includes a resource storage query, directly determining resource storage parameters from the memory corresponding to the solid-state storage device.

[0020] According to another embodiment of the embodiment of the present application, a resource data processing device is also provided, including: a receiving module, used to receive M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area; a determining module, used to obtain a first connection diagram between the M resource transfer requests, and determine N resource transfer requests from the M resource transfer requests according to the first connection diagram, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection diagram refers to a connection diagram used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection diagram; a calling module, used to call N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored carried by the N resource transfer requests in parallel into the first storage area.

[0021] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0022] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0023] According to another embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0024] Through the present application, M resource transfer requests carrying resource data to be stored are received, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area, and a first connection diagram between the M resource transfer requests is obtained, and N resource transfer requests are further determined from the M resource transfer requests according to the first connection diagram, wherein M and N are both positive integers, and M is greater than or equal to N; thus, N threads can be called to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area. That is to say, when the present application receives M resource transfer requests, it determines the N resource transfer requests that can be processed in parallel by obtaining the first connection diagram, and then N threads can be called to process the N resource transfer requests in parallel, thereby improving the processing efficiency of resource data. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0026] Figure 1 It is a hardware structure block diagram of a server device of a resource data processing method according to an embodiment of the present application;

[0027] Figure 2 is a flow chart of a method for processing resource data according to an embodiment of the present application;

[0028] Figure 3 It is a schematic diagram of the association relationship between resource transfer parties in an embodiment of the present application;

[0029] Figure 4 is a schematic diagram of a first connection diagram according to an embodiment of the present application;

[0030] Figure 5 is a schematic diagram of a second connection diagram according to an embodiment of the present application;

[0031] Figure 6 It is a structural block diagram of a resource data processing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0032] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0034] The resource data processing method embodiment provided in the embodiment of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a resource data processing method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0035] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the processing methods of resource data in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, the above-mentioned method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory, wherein only one first storage area for storing resource data is set in the solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0036] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0037] In order to solve the above problems existing in the related art, a method for processing resource data is provided in this embodiment, which is applied to a solid-state memory. Only a first storage area for storing resource data is set in the solid-state memory. The execution subject includes but is not limited to an SSD controller of the solid-state memory. The solid-state memory and the SSD controller can be deployed in Figure 1 In the server device shown, Figure 2 As shown, the process includes the following steps S202-S206:

[0038] Step S202: receiving M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area;

[0039] The resource data may include information of the resource transferor, information of the resource transferee, and resource amount, etc. M may be an integer greater than 1. In an actual SSD working scenario, there may be M resource transfer requests, that is, there may be M resource transfer requests carrying resource data that need to be stored in the first storage area at the same time.

[0040] In some embodiments, in addition to storing the information of the resource transferor, the information of the resource transferee, and the resource amount, the first storage area also stores the next record pointer of the resource transfer-out linked list and the next record pointer of the resource transfer-in linked list. The resource transfer-out linked list is used to record the transfer-out status of the user's resource data, and the resource transfer-in linked list is used to record the receipt status of the user's resource data. When there is a resource transfer request, the next record pointer of the resource transfer-out linked list and the next record pointer of the resource transfer-in linked list are recorded. Through the next record pointer of the resource transfer-out linked list and the next record pointer of the resource transfer-in linked list, when querying the user's resource transfer-in record and resource transfer-out record in the subsequent time, the stored next record pointer can be directly read to determine the next record of the user in turn.

[0041] In some embodiments, the area capacity of the first storage area can be pre-set. It is understandable that when the first storage area is full of resource data, or the resource data stored in the first storage area has occupied a preset proportion of the area capacity, for example, it has occupied eighty percent of the area capacity, then the first storage area can be erased. When specifically setting the area capacity of the first storage area, various influencing factors can be considered, such as the data length of the resource data to be stored at a single time. Since the information included in the resource data is consistent, such as including the information of the resource transferor, the information of the resource transferor, and the resource amount, the next record pointer of the resource transfer list, and the next record pointer of the resource transfer list, the data length of the resource data to be stored at a single time can also be set to a fixed value, that is, the data length of the resource data stored each time is consistent by default. In addition to the data length of the resource data to be stored, it is also necessary to consider the total number of users with resource transfer business needs, the maximum resource quota of each user, etc., and the embodiment of the present application is not limited here.

[0042] In some embodiments, the first storage area is used to store all resource data, and the resource data may specifically refer to transfer records. When the resource data is a transfer record, each resource data to be stored may include the following data: transfer-out account number; transfer-in account number; transfer amount; pointer to the next record of the resource transfer-out linked list; pointer to the next record of the resource receiving linked list. The length of each resource data is lr, and lr at least satisfies: lr ≥α + 2β +2γ.

[0043] Among them, α refers to the number of bytes occupied by each transfer amount; β refers to the number of bytes occupied by each account number (including the transfer-out account number and the transfer-in account number); γ refers to the number of bytes occupied by the next record pointer. The area capacity of the first storage area can be defined as: n2:=r*lr, where r is the number of transfer records determined based on the number of users and the account user limit, and ":=" is a symbol indicating the meaning of the definition. Set lr|Cb (Cb can divide lr, Cb is the erase unit, and the size of Cb is determined by the hardware properties of the SSD itself); , where rb represents the number of transfer records contained in each erase block. And set rb|r (which means r can divide rb); , where rc represents the number of erase blocks contained in the entire first storage area.

[0044] In some embodiments, it can be set as follows: α = 8; β = 2; γ = 4; Cb = 20MB = 20× 2 20 ; Then lr = 20, m = 264, n = 216, r = 232, which just satisfies lr|Cb, so rb = 2 20 , which also satisfies rb|r, so rc =2 12 The calculated capacity of the second storage area is: n1 = 80 GB.

[0045] Step S204: obtaining a first connection graph between the M resource transfer requests, and determining N resource transfer requests from the M resource transfer requests according to the first connection graph, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection graph;

[0046] It should be noted that the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests. There is a dependency relationship between the resource transfer requests, which is specifically manifested in that if the resource transfer process included in one resource transfer request depends on the resource transfer process included in another resource transfer request, then there is a dependency edge between the two resource transfer requests.

[0047] When processing M resource transfer requests, we first need to analyze the dependencies between these requests. For example, if request R1 can only be executed after request R2 is completed (for example, R1 needs to use the resources transferred by R2), then add an edge from R2 to R1 in the first connection graph. In this way, by analyzing all M requests, we can construct a directed acyclic graph (DAG), namely the first connection graph, which clearly shows the execution order and dependencies between requests.

[0048] It is understandable that, according to the first connection graph, N resource transfer requests can be determined, where N is a subset of M and M>=N. This is usually done when resources are limited and certain requests need to be processed first. For example, if the number of currently available parallel processing threads is N, then N requests that can be executed simultaneously and do not violate dependencies can be screened out from the M requests.

[0049] In the screening process, the first connection graph can be traversed to find nodes without incoming edges (i.e., resource transfer requests that do not depend on other nodes). These nodes without incoming edges can be regarded as N resource transfer requests that can be directly executed. Specifically, a breadth-first search or topological sorting algorithm can be used to extract N resource transfer requests without dependencies from the first connection graph for parallel processing.

[0050] Once N resource transfer requests that can be processed in parallel are determined, threads can be allocated according to the hardware architecture (such as multiple processors or multiple processor cores). Each thread is responsible for processing a request, including but not limited to verifying the legitimacy of the resource transfer, executing the resource transfer operation, updating the resource status and dependencies, etc. After processing a resource transfer request, the outgoing edge of the parallel resource transfer request (i.e., the subsequent request that depends on it) can be considered as the next request that may be processed in parallel. Such a processing strategy can not only maximize the utilization of hardware resources, but also ensure the correct execution order of resource transfer requests, avoiding data inconsistency or errors caused by improper dependency processing. In the ASSD (Accounting Solid State Drive) scenario, this strategy helps to improve the write efficiency and query performance of the accounting-specific solid-state storage, especially when facing a large number of concurrent transfer requests.

[0051] The construction of the first connection graph and the determination of N resource transfer requests are key steps to achieve parallel processing of resource transfer requests. It ensures that requests can be effectively and correctly executed in parallel under a multi-processor or multi-processor core architecture. It is understandable that this parallel execution method is not limited to the processing of transfer records, but can also be widely applied to any system that needs to process resource transfer requests and has dependencies between requests.

[0052] In an exemplary embodiment, the step of constructing the first connection graph includes: based on the M resource transfer requests, respectively extracting corresponding transfer times and transfer identifiers from the M resource transfer requests; determining a target resource transfer request from the M resource transfer requests, and traversing other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration; for any other traversed resource transfer request, determining a dependent resource transfer request that meets the dependency condition from the other resource transfer requests according to the transfer times and transfer identifiers of the other traversed resource transfer requests and the transfer times and transfer identifiers corresponding to the target resource transfer request; wherein the resource transfer process of the dependent resource transfer request depends on the resource transfer process of the target resource transfer request; re-determining a new target resource transfer request from the M resource transfer requests, and returning to traverse other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration and continue to execute until a preset iteration stop condition is reached, thereby obtaining the first connection graph.

[0053] Among them, the corresponding transfer time and transfer identifier can be extracted from the M resource transfer requests respectively. In the ASSD scenario, the transfer time can specifically refer to the timestamp when the transfer occurs; the transfer identifier is used to identify the resource transferor in the resource data, and the resource transferor can specifically correspond to a user with a resource transfer business demand. The resource transferor can include a resource transferor and a resource transferee, and the resource transferee and the resource transferor are two relative concepts. In the resource data processing scenario, for the same user, it can be both a resource transferor and a resource transferee. For example, for the resource transfer process between user A and user B, when user A has resource expenditure and user B has resource reception, user A is the resource transferor and user B can be the resource transferee. For another example, for the resource transfer process between user A and user C, when user C has resource expenditure and user A has resource reception, user A is the resource transferee and user B can be the resource transferor.

[0054] Specifically, a target resource transfer request can be determined from the M resource transfer requests. This target resource transfer request can be any unprocessed request. In the parallel processing strategy, those requests that do not depend on other requests can be preferentially selected as targets, that is, nodes without incoming edges in the dependency graph. In the current iteration process, the other requests except the target resource transfer request in the M resource transfer requests are traversed. For each traversed request, it is determined whether it depends on the target resource transfer request. The judgment of the dependency is based on the transfer time and transfer identifier between the requests.

[0055] For each other resource transfer request traversed, determine whether its transfer time and transfer identifier meet the condition of being dependent on the target request. Specifically, if the transfer time of a request is after the request it depends on, and the dependent identifier is correct, then the request is determined to be a dependent resource transfer request that meets the dependency condition. For example, in ASSD, if a transfer record R2 depends on R1 (that is, R1's transfer is part of R2's condition), then R2's transfer time needs to be after R1, and R2's transfer-in account is R1's transfer-out account.

[0056] Furthermore, a new target resource transfer request is determined from the M resource transfer requests, and the traversal process is returned to continue execution until the preset iteration stop condition is reached. The iteration stop condition can be that all requests are correctly assigned to the dependency graph, or all requests without dependencies (i.e., the root nodes in the graph) have been processed.

[0057] The first connection graph is a directed acyclic graph (DAG), where each node represents a resource transfer request and the edges represent the dependencies between the requests. After the first connection graph is constructed, a parallel processing strategy can be used to optimize the execution of resource transfer requests. Based on the dependencies of the nodes in the first connection graph, nodes without dependencies (i.e., nodes without incoming edges) can be selected for parallel processing. After processing a node, the node and its outgoing edges are removed from the graph, and then it is checked whether there are new nodes that become nodes without incoming edges and can be added to the parallel processing queue.

[0058] In the above embodiment, the purpose is to optimize the parallel processing strategy by constructing a dependency graph of resource transfer requests, namely the first connection graph, to ensure that resource transfer requests can be effectively and correctly processed under a multi-processor or multi-processor core architecture, while avoiding resource competition and dependency conflicts, thereby improving the overall processing efficiency and performance of the system. This method is used in ASSD to process the parallel writing of transfer records, and is also applicable to other resource management and scheduling scenarios that need to consider dependencies between requests.

[0059] In some embodiments, the first connection graph may be a directed acyclic graph. Optionally, N may be a positive integer less than M. When determining resource transfer requests that can be processed in parallel from the first connection graph, the determined N may be equal to M, that is, all M resource transfer requests may be processed in parallel, or may be less than M, that is, some resource transfer requests may be processed in parallel. Generally speaking, there is no dependency between two resource transfer requests processed in parallel.

[0060] It can be understood that for different users, no matter they are the resource transferor or the resource transferee, the corresponding transfer identifier is unique.

[0061] In some embodiments, the transfer identifier may be represented by numbers, letters, and feature codes. For example, the transfer identifier may be represented by numbers.

[0062] In an exemplary embodiment, the transfer identifier includes a transfer-in party identifier and a transfer-out party identifier; the dependent resource transfer request that satisfies the dependency condition is determined from the other resource transfer requests based on the transfer times and transfer identifiers of the other resource transfer requests that have been traversed, and the transfer times and transfer identifiers corresponding to the target resource transfer request, including: when the transfer time corresponding to the target resource transfer request is less than the transfer time of the other resource transfer requests that have been traversed, and the transfer-in party identifier corresponding to the target resource transfer request is the same as the transfer-out party identifier of the other resource transfer requests that have been traversed, the other resource transfer request is determined as the dependent resource transfer request of the target resource transfer request.

[0063] It is understandable that the transfer identifier is used to identify the entity (account in ASSD) involved in the resource transfer request. Each resource transfer request (such as a transfer record) will contain the transferee identifier and the transferor identifier, which is equivalent to each transfer record in ASSD having a transfer-out account number and a transfer-in account number.

[0064] The process of determining dependent resource transfer requests is based on two conditions: the transfer time of the target resource transfer request must be less than the transfer time of other resource transfer requests traversed, and the transferee identifier of the target resource transfer request must be the same as the transferee identifier of other resource transfer requests traversed. In other words, a transfer record R1 is dependent on R2 only if its transfer time is earlier than another transfer record R2, and the transfer-in account of R1 is the transfer-out account of R2.

[0065] When traversing and processing resource transfer requests, each resource transfer request other than the target resource transfer request can be checked. For each request R2, its transfer time and transferee identifier can be compared with the corresponding information of the target resource transfer request R1. If the transfer time of R2 is later than that of R1, and the transferor identifier of R2 is the same as the transferee identifier of R1, then R2 is determined to be the dependent resource transfer request of R1. This shows that when processing resource transfer requests, R2 can be processed after R1, because R2's resource transfer (such as fund transfer) depends on the resource transfer result of R1.

[0066] In the above embodiment, the dependencies between all resource transfer requests are identified and represented in a first connection graph. The first connection graph is a directed acyclic graph (DAG), in which nodes represent resource transfer requests and edges represent dependencies between requests. This enables the system to determine which requests can be processed in parallel and which requests must be processed serially based on the dependencies in the graph, thereby optimizing the execution process of resource transfer.

[0067] In an exemplary embodiment, determining N resource transfer requests from the M resource transfer requests according to the first connection graph includes: determining a parallel resource transfer request from the M resource transfer requests based on the first connection graph; wherein the resource transfer process of the parallel resource transfer request is independent of the resource transfer process of other resource transfer requests in the first connection graph; and determining the parallel resource transfer requests as N resource transfer requests.

[0068] A parallel resource transfer request is a resource transfer process that does not depend on other resource transfer requests in the first connection diagram during the resource transfer process. In other words, these requests do not need to wait for the completion of other requests when they are executed, and there is no direct dependency between them. In the ASSD scenario, this means that there is no direct correlation between the transfer records in terms of transfer order, that is, the transfer-out account of one transfer record is not the transfer-in account of another transfer record, or their transfer times do not conflict.

[0069] Specifically, the process of determining parallel resource transfer requests generally includes analyzing a first connection graph (i.e., a dependency graph between resource transfer requests). In the graph, nodes without incoming edges (i.e., requests that no other request depends on) can be identified as resource transfer requests that can be processed in parallel. This is because the absence of incoming edges means that the request does not need to wait for the completion of any other request and can be started directly. For example, in the transfer record processing of ASSD, if a dependency graph of transfer records is constructed, then the nodes without incoming edges in the graph (i.e., transfer records) can be regarded as resource transfer requests that can be executed in parallel, because they do not need to consider the status of other transfer records when executing.

[0070] The process of determining N resource transfer requests is actually to select the number of resource transfer requests that can be executed simultaneously based on the parallel processing capability (such as the number of processor cores). When determining N resource transfer requests, those requests that have no dependencies can be selected from the M resource transfer requests to ensure that their resource transfer processes can be executed in parallel. Which requests are selected as resource transfer requests that can be processed in parallel is usually determined based on the number of nodes without input edges in the first connection graph and the number of parallel operations that can be processed.

[0071] For example, in ASSD, if there are 4 processor cores available for parallel processing, and in the first connection graph constructed, a node without an incoming edge is found, that is, there are also 4 transfer records that no other transfer records depend on, and 4 such records can be selected as resource transfer requests that can be processed in parallel for processing. If there are 5 transfer records that no other transfer records depend on, since there are only 4 processor cores, only 4 such records can be selected as resource transfer requests that can be processed in parallel for processing.

[0072] Step S206: calling N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests into the first storage area in parallel.

[0073] It should be noted that when there are N resource transfer requests, N processes can be called to process the N resource transfer requests in parallel. When the number of currently idle threads is less than N, some resource transfer requests can be processed first, and the remaining resource transfer requests can be processed when there are idle threads.

[0074] In an exemplary embodiment, the calling of N threads to process the N resource transfer requests in parallel so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area includes: calling N threads to determine N areas to be stored in the first storage area; the N areas to be stored are N areas where the resource data to be stored are to be stored in the first storage area; and, through the N threads, storing the resource data to be stored respectively carried by the N resource transfer requests in parallel into the N areas to be stored in the first storage area.

[0075] It is understandable that, based on the fact that the area capacity of the first storage area is already determined, how much resource data can be stored in the first storage area can also be determined. In the first storage area, the first storage area can be divided into multiple storage areas according to the area capacity and the data length of the pre-calculated resource data.

[0076] The area to be stored is the area determined to store the resource data in the first storage area, that is, the location where the data to be stored is to be written. When determining the area to be stored, it can be determined based on the first pointer parameter of the first storage area.

[0077] It is understandable that the first pointer parameter can be represented by numbers, letters, and feature codes, etc. The first pointer parameter can correspond to a storage area in the first storage area. For example, the first storage area includes a total of 12 storage areas. When the first pointer parameter is represented by numbers, the pointer parameters are 0, 1, 2...11, respectively, where 0 can correspond to the first storage area and 11 can correspond to the twelfth storage area. When writing the resource data to be stored into the first storage area, it can be written in sequence, for example, first writing the resource data to be stored into the first storage area, then writing the resource data to be stored into the second storage area... and so on, until writing into the twelfth storage area, which indicates that the first storage area has been filled.

[0078] It should be noted that when N is equal to 3, it means that three storage areas need to be determined from the first storage area. Before storing the resource data to be stored in the first storage area, it is necessary to first determine the first pointer parameter, and determine the storage area according to the first pointer parameter. If the determined first pointer parameter is 0, 1, and 2, it can be indicated that the storage area to be stored is the first storage area, the second storage area, and the third storage area.

[0079] In an exemplary embodiment, the method further includes: when any one of the N areas to be stored is the same as a stored area set for the first storage area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored; and storing the resource data to be stored respectively carried by the N resource transfer requests in parallel in the N areas to be stored of the first storage area after the erasure process.

[0080] The stored area is an area in the determined first storage area where resource data has been stored. When determining the stored area, it can be determined based on the second pointer parameter recorded for the first storage area. It is understandable that the second pointer parameter can be represented by numbers, letters, and feature codes. The second pointer parameter can correspond to the storage area in the first storage area.

[0081] Optionally, the second pointer parameter may correspond to the storage area in the first storage area where the resource data is first stored, that is, the second pointer parameter points to the oldest storage area, which may be understood as the location where the resource data is first written in the first storage area.

[0082] In an exemplary embodiment, a second storage area is also provided in the solid-state memory, and the second storage area is used to store at least resource status parameters associated with the resource data stored in the first storage area; the erasing process of the first storage area includes: determining the data to be erased in the first storage area; updating the resource status parameters in the second storage area according to the data to be erased, and writing the updated resource status parameters into the second storage area; when writing the updated resource status parameters into the second storage area, erasing the first storage area based on the determined data to be erased.

[0083] The resource status parameters may include the resource amount of the resource transferor, the first resource transfer record of the resource transferor, the transfer amount of the resource receiver, the first resource transfer record of the resource receiver, etc. Before the data to be erased is erased, the resource amount of the resource transferor and the resource receiver, the first resource transfer record, etc. related to the data to be erased may be updated accordingly.

[0084] In some embodiments, in addition to storing resource status parameters, the second storage area may also store the following system control parameters, which may be constants set based on the hardware performance of the SSD, such as the number of bytes occupied by the resource amount of each resource transferor, the number of bytes occupied by the account number of each resource transferor and resource recipient, the number of bytes occupied by the transfer record number, etc.

[0085] It is understandable that after determining the data to be erased, the resource status parameters in the second storage area are updated according to the data to be erased, so that even if the data to be erased is erased later, its resource status parameters are updated, ensuring the accuracy of the subsequent resource query process.

[0086] In the above embodiment, after determining the data to be erased, the resource status parameters in the second storage area are also updated based on the data to be erased, thereby avoiding errors in resource amounts and the like caused by data erasure processing, and effectively improving the processing accuracy of resource data. In an exemplary embodiment, after calling N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area, it also includes: obtaining an updated first connection diagram, wherein the first connection diagram is updated after determining the N resource transfer requests from the M resource transfer requests; based on the updated first connection diagram, determining K resource transfer requests from the M resource transfer requests, wherein K is a positive integer; calling K threads to process the K resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the K resource transfer requests in parallel into the first storage area.

[0087] It can be understood that after the resource data to be stored respectively carried by the N resource transfer requests are stored in parallel in the first storage area, a new root node will continue to be selected from the updated first connection graph, and K resource transfer requests will be determined, where K is a positive integer less than M. K threads are called to process the K resource transfer requests in parallel, and the resource data to be stored respectively carried by the K resource transfer requests are stored in parallel in the first storage area.

[0088] It should be noted that after determining K resource transfer requests, the root node will continue to be deleted, and then the first connection graph will be updated to obtain an updated first connection graph, until all key nodes in the first connection graph are determined as root nodes, and then the update of the first connection graph will be stopped. After each resource transfer request for parallel processing is determined, the first connection graph will be updated by deleting the root node.

[0089] In an exemplary embodiment, the resource status parameters include at least a record identifier and a resource amount of the resource transfer of the resource transferor; updating the resource status parameters in the second storage area according to the data to be erased includes: when there are resource data corresponding to at least two resource transferors in the data to be erased, obtaining a second connection diagram between the resource transferors; the second connection diagram records the resource transfer relationship between the multiple resource transferors and calls at least two threads; updating the record identifier and the resource amount of the resource transfer of the at least two resource transferors in the second storage area in parallel according to the at least two threads and the resource transfer relationship.

[0090] That is to say, when the data to be erased includes record identifiers and resource amounts of different resource transfer parties, the record identifiers and resource amounts of different resource transfer parties can be erased in parallel through different threads and recorded resource transfer relationships, that is, resources are transferred from A to B, or resources are transferred from B to C. This improves the erasure efficiency.

[0091] In an exemplary embodiment, determining the data to be erased in the first storage area includes: determining the length of the data to be erased based on the properties of the solid-state memory; and determining the data to be erased of the data length from the first storage area according to the storage time of the resource data stored in the first storage area.

[0092] Specifically, the attribute of the solid-state memory refers to the hardware performance of the solid-state memory, and the data length of the resource data that can be deleted at one time is determined by the hardware performance of the solid-state memory.

[0093] It should be noted that when determining the data to be erased from the first storage area, the writing time of each resource data written in the first storage area can be determined, and according to the writing time, the resource data with the data length before the writing time is selected and determined as the data to be erased.

[0094] In the above embodiment, the data length of the data that can be erased each time the erasure process is performed is determined by the hardware performance of the solid-state memory, and the data length of the data to be erased each time is further determined, thereby effectively improving the data erasure efficiency.

[0095] In the above steps S202-S206, M resource transfer requests carrying resource data to be stored are received, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area, and a first connection diagram between the M resource transfer requests is obtained, and N resource transfer requests are further determined from the M resource transfer requests according to the first connection diagram, wherein M and N are both positive integers, and M is greater than or equal to N; thus, N threads can be called to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel in the first storage area. That is to say, when the present application receives M resource transfer requests, the N resource transfer requests that can be processed in parallel are determined by obtaining the first connection diagram, and then N threads can be called to process the N resource transfer requests in parallel, thereby improving the processing efficiency of resource data.

[0096] In an exemplary embodiment, the method also includes: under the request that the resource data to be stored carried by the M resource transfer requests are all stored in the first storage area, obtaining a pre-constructed second connection graph between the resource transfer parties of the M resource transfer requests; wherein the second connection graph is obtained based on the connection of multiple key nodes, and the key nodes are used to characterize the resource transfer parties corresponding to the M resource transfer requests respectively; based on the number of key nodes in the second connection graph, determining O threads matching the number of key nodes; based on the connection relationship between the O threads and the multiple key nodes, updating the resource transfer record linked list associated with the M resource transfer requests in parallel.

[0097] The second connection graph is constructed based on the key nodes of the resource transfer parties (transfer-in and transfer-out parties) in the M resource transfer requests. The "key nodes" here refer to the accounts in the resource transfer request, and each account is represented as a node in the second connection graph. The construction of the second connection graph is based on the connection relationship between accounts, that is, which accounts participate in the resource transfer request as transfer-in and transfer-out parties. In ASSD, this is equivalent to a relationship graph between the accounts involved in the transfer record.

[0098] It is understandable that based on the number of key nodes in the second connection graph, it can be determined how many threads (O threads) are assigned to process resource transfer requests. The number of threads O usually matches the number of key nodes, which means that each key node (i.e., each account) will be responsible for processing all resource transfer requests related to it by one thread. In the ASSD scenario, this is equivalent to assigning one thread to each account to process all transfer records of the account.

[0099] Once O threads are determined, these threads can be used to update the resource transfer record linked list associated with M resource transfer requests in parallel. The resource transfer record linked list here refers to the transfer record linked list of each account, including the transfer-in record linked list and the transfer-out record linked list. Each thread is responsible for updating the record linked list related to its corresponding key node (account), which means that the transfer record linked list update of each account can be performed in parallel in independent threads.

[0100] Specifically, each thread will traverse all edges (i.e., resource transfer requests) connected to its corresponding key node in the second connection graph and update the resource transfer record list of the account. Since the second connection graph is built based on the connections between resource transfer parties, each thread can independently process resource transfer requests related to the account without conflicting with other threads.

[0101] For example, in ASSD, if there are multiple accounts whose transfer records need to be updated, a thread can be assigned to each account. Each thread will be responsible for updating the linked list of all transfer-in and transfer-out records of its account, including the relevant records in the newly received M resource transfer requests. In this way, even if there are a large number of concurrent resource transfer requests, the system can efficiently update the account's transfer records through parallel processing without being limited by the bottleneck of serial processing.

[0102] In the above embodiment, by constructing a second connection graph and allocating threads based on the number of key nodes in the graph, the resource transfer record linked list associated with M resource transfer requests can be updated in parallel, thereby optimizing the processing efficiency of resource transfer requests in a multi-threaded environment. This method is not only applicable to the management of account transfer records in ASSD, but also to any scenario involving resource transfer parties (such as accounts, users, etc.), and improves the processing speed and system performance of resource transfer requests through parallelization technology.

[0103] In an exemplary embodiment, the solid-state memory is also provided with a third storage area for storing a first pointer parameter and a second pointer parameter; the method further includes: obtaining a power-off instruction; wherein the power-off instruction is an instruction generated by the solid-state memory when it enters a stop working state; based on the power-off instruction, determining the storage location of the resource data in the first storage area, and updating the first pointer parameter and the second pointer parameter in the third storage area according to the storage location.

[0104] It is understandable that the solid-state memory may enter the stopped working state when the solid-state memory enters sleep mode normally or when receiving a shutdown operation. Of course, the solid-state memory may also enter the stopped working state when an abnormal power failure occurs to the solid-state memory. Regardless of the reason for the solid-state memory to enter the stopped working state, the storage location of the resource data in the first storage area is determined, and the first pointer parameter and the second pointer parameter in the third storage area are updated according to the storage location.

[0105] In the above embodiment, by updating the first pointer parameter and the second pointer parameter when power is turned off, when the solid-state memory works normally later, the storage of resource data can be expanded based on the recorded first pointer parameter and the second pointer parameter, thereby improving storage efficiency.

[0106] In an exemplary embodiment, the solid-state memory includes a first storage area, a second storage area, and a third storage area; before receiving a resource transfer request carrying resource data to be stored, it also includes at least one of the following: clearing the first storage area, the second storage area, and the third storage area of ​​the solid-state memory; determining the number P of transferors of the resource transferor, determining P threads, and initializing the resource status parameters in the second storage area according to the P threads, wherein P is a positive integer.

[0107] In the above embodiment, before receiving a resource transfer request carrying resource data to be stored, the memory variables of the solid-state storage device can be initialized. Through the initialization process, the normal operation of the subsequent solid-state storage device can be ensured and the processing accuracy of the resource data can be improved.

[0108] In an exemplary embodiment, the method also includes: responding to a resource query request; the resource query request includes at least one of a resource change query request and a resource storage query request; in a case where the resource query request includes the resource change query request, based on the resource change query request, determining a resource first change record matching the resource change query request from resource status parameters stored in the second storage area; determining an address of the resource first change record; according to the address, determining a query result corresponding to the resource change query request; in a case where the resource query request includes a resource storage query, directly determining resource storage parameters from the memory corresponding to the solid-state storage device.

[0109] It should be noted that the resource change query request may include a request generated when a resource is transferred out or transferred in. For the resource change query request, the resource first change record that matches the resource change query request may be first determined from the resource state parameters stored in the second storage area, that is, the resource first change record of the resource transferor in the resource change request. After determining the resource first change record, the address of the resource first change record may be determined based on the resource transfer-out linked list and the resource transfer-in linked list of the resource transferor, thereby obtaining the query result.

[0110] In an exemplary embodiment, before determining the area to be stored in the first storage area in response to the resource transfer request, it also includes: storing the resource data to be stored in a cache; wherein the cache is a buffer area set for the solid-state memory; when it is determined that the amount of resource data in the cache reaches a set quantity threshold, determining the area to be stored in the first storage area in response to the resource transfer request.

[0111] It is understandable that there are different data granularities for flash memory (i.e., solid-state memory) write operations, which may not necessarily be aligned with the minimum write granularity of the flash memory. In order to avoid the actual write granularity exceeding the demand and thus causing too many writes, in the specific implementation, a cache mechanism is introduced to collect various write operations. When a sufficient number of write operations are collected in the cache, the write from the cache to the flash memory is implemented.

[0112] In some embodiments, all data in the second storage area and the third storage area can be updated and read in the cache. Synchronization with the flash memory is performed only when necessary. If the user needs to perform too many operations of querying the account (in / out) records, the following data can be cached in part or in whole: the complete account (in / out) records of some frequently queried accounts; the latest partial account (in / out) records of all accounts to avoid calling multiple query operations on the flash memory.

[0113] Obviously, the above-described embodiments are only embodiments of a part of the present invention, rather than all embodiments. In order to better understand the above method, the above process is described below in conjunction with embodiments, but it is not intended to limit the technical solutions of the embodiments of the present invention, specifically:

[0114] In the related art, there are various operations in the actual reading and writing process of the SSD, such as writing data to the SSD, reading data from the SSD, formatting the SSD, erasing the SSD, etc. For each operation, there are multiple steps, and the description of the implementation process of each step is sequential (serial), which cannot be implemented in hardware with multiple processor cores, resulting in low resource data processing efficiency.

[0115] For the above storage application, this application includes the following basic operation steps: 1. Format ASSD, that is, initialize the accounting storage; 2. Add a transfer record to ASSD; 3. Query all the incoming records of an account; 4. Query all the outgoing records of an account; 5. Query the deposit balance of an account; 6. When the transfer record space is insufficient, a certain number of the oldest transfer records need to be erased and the corresponding account information needs to be updated at the same time; 7. Power on; 8. Power off.

[0116] First, consider the ASSD formatting (initialization) operation. This operation mainly includes the following steps: 1. Clear the storage space of the three storage areas; 2. Confirm the correctness of the system control parameters; 3. Reset the pointer; 4. Write an empty record in the second storage area record position 0; 5. Initialize the account information in the second storage area; 6. Initialize the memory variables. Among them, step 1 is responsible for clearing the data in each data area. If the user does not care about the security of the data, that is, perform the formatting as fast as possible rather than low-level, then this step can be omitted. If the user forces this step, whether this step can be executed in parallel depends on the execution method of the Nand erase command inside the SSD. If the Nand erase command can be executed in parallel, this step can also be executed in parallel. The execution method also depends entirely on the calling interface of the underlying Nand erase function, and the underlying command can be directly called. Step 2 is responsible for confirming the value of the system configuration constant, and no parallel is required. Step 3 resets 4 pointers, which can be executed by 4 threads respectively. However, due to the extremely small amount of calculation, it can also be executed directly in serial, because parallelism is not very meaningful. Step 4 is an independent operation and cannot be executed in parallel. Step 5 can be executed for each account separately. The pointer of the first transfer record of each account has no association with the original balance of the account, so it can be executed in parallel without communication. All memory variables in step 6 are independent of each account, so they can be divided into threads by account and executed in parallel without communication.

[0117] Next, consider adding a transfer record to ASSD. The main steps of this operation are: 1. Query the account balance of the transfer source account to determine whether the balance meets the requirements of the transfer record to be processed. If not, terminate the execution and return failure to the user. 2. Determine whether the storage space of the second storage area is full. If it is full, execute the following erase process. 3. Write the transfer-in account number, transfer-out account number and transfer amount to the record position pointed to by the pointer. Note that the two linked list record pointer fields are kept empty. 4. According to the direction of the transfer operation, write the address of this transfer record to the linked list record pointer field. 5. Update the address of this transfer record; 6. Update the account balance in memory.

[0118] Among them, steps 1 and 2 are only one-step judgment and do not need to be parallelized. Step 3 is used to write the transfer record information. Before writing each record, it is necessary to determine whether the record to be written is legal based on the current account balance. This means that when the system receives n records that need to be written in parallel, the relationship between these n records must be limited before parallel processing can be performed. To this end, a dependency relationship needs to be established between the records. Figure 3 As shown, a rectangular box represents a record, and arrows between the rectangular boxes represent dependency relationships. Figure 3The arrow in the middle indicates that the record below depends on the record above. The two cannot be written in parallel. The record below can only be written after the record above is written. t1 and t2 indicate the order in which the records are submitted. The smaller the sequence number, the earlier the record is submitted. a1 and a2 indicate the source account of the transfer, and b1 and b2 indicate the destination account of the transfer. Figure 3 The dependency shown in exists if and only if t2> t1 and b1 = a2. To make it more specific, Figure 4 shows a specific example of dependency, namely Figure 4 is a schematic diagram of the first connection graph. In which, a rectangular box represents a record, that is, each rectangular box can correspond to a resource transfer request. For example, for rectangular box A, 1:1-2 can represent the resource transfer between account 1 and account 2 at time 1, where account 1 represents the source account of the transfer; account 2 represents the destination account of the transfer, and the arrows between the rectangular boxes represent the dependency relationship, that is, the resource transfer process of rectangular box B depends on the resource transfer process of rectangular box A. Only after the resource transfer request of rectangular box A is written, the resource transfer request of rectangular box B can be written. The dependency graph is a directed acyclic graph, which can determine which records can be opened for parallel writing at the same time according to the directed acyclic graph and the number of current idle threads. Specifically, the breadth-first search method can be used to continuously extract and delete the root node (node ​​without incoming edge) from the graph. Step 4 needs to establish a link relationship between the linked lists of all transfer-in records and transfer-out records of each account. When the system receives multiple transfer records at the same time, it can first establish a directed graph GT based on the transfer relationship. Each node in the graph represents an account associated with any transfer record, and each edge represents a transfer record. In other words, if account a transfers money to account b, it is considered that there is an edge in GT from node a to node b. For example, if the following are received at the same time Figure 4 All transfer records shown can be expressed as Figure 5 , Figure 5 is a schematic diagram of the second connection diagram, Figure 5 Each key node in represents the resource transferor. Subsequently, based on the second connection graph, each account can be processed in parallel, and each thread is responsible for one account (a node in the second connection graph). Each thread can independently traverse all the incoming and outgoing edges of the node it is responsible for, and establish and write link relationships at the same time. The update of the address in step 5 can also be obtained from GT and completed in parallel by the independent threads responsible for each node. Step 6 needs to update and calculate the balance of each account. The calculations between each account are also independent of each other and can be executed by the thread responsible for the account, thereby realizing parallel calculation.

[0119] Next, consider querying all the deposit (debit) records of an account numbered k. The main execution steps are: 1. Obtain the data from the second storage area (the number of the first transfer record of each account); 2. read the address of the first record of the linked list of incoming (outgoing) records in the record from the first storage area; 3. track each incoming (outgoing) record along the linked list of incoming (outgoing) records, read the information of the incoming account, the outgoing account, and the amount of the transfer and return it to the user. Since the incoming or outgoing transfer records of each account constitute a linked list, each record must be read one by one through the linked list to find the next record, so it cannot be executed in parallel.

[0120] The main process of querying the deposit balance of an account numbered k is: 1. Directly return the account balance in the memory; since the deposit balance can be queried by directly reading the account balance from the memory, this operation does not need to be parallelized.

[0121] When there is insufficient space for transfer records, an erase process needs to be executed, and its execution steps can be described as: 1. Merge the transfer records of the area to be erased into the original total amount for each account, and then update the balance of each account; 2. Update account information 3. Update memory variables; 4. Perform an erase operation on the current area to be erased; 5. Set a new area to be erased; 6. Perform a system control information write to the second storage area, and update the next write position of the system information in the first storage area. Among them, steps 1 to 3 can be executed separately for each account, and there is no need for communication between accounts. Therefore, each account can be assigned to an independent thread for execution, thereby achieving parallelization. Step 4 is a complete erase command sent to Nand, which cannot be split any further, so there is no need for parallelization. The workload of steps 5 and 6 is not large, and there is no need for parallelization.

[0122] Each time the system is powered on, the following steps need to be performed: 1. Read the latest system control information from the first storage area, including various system constants and account information. k , , ; 2. Read the latest record pointer information from the third storage area and assign it to variables pt, pr; 3. k , , Update variables in memory , , , , Ok is the original amount of each account (before all transfer records occur); k is the record number, The address of the earliest existing entry record. The address of the latest entry record. is the earliest existing payment record address, is the address of the latest existing outgoing record; 4. Scan all incoming records of each account and calculate the total incoming amount ti; 5. Scan all outgoing records of each account and calculate the total outgoing amount to; 6. Update the current amount of each account: dk:=Ok + ti – to. In step 1, it is necessary to read the information k of each account. , , each account can perform this part independently, so step 2 only includes the reading and assignment of two pointers, which does not need to be parallelized, or can be executed separately by two threads. , , , Each account can be independently executed without interfering with each other, so the account can be simply bound to the thread to achieve parallelization. In steps 4 and 5, since all the entry and exit records are saved as linked lists, they cannot be parallelized; in step 6, the balance of each account d k The calculations do not interfere with each other and can be bound to threads for parallel execution.

[0123] Each time the system is powered off, the following operations need to be performed: 1. According to the variable p t , p r, That is, the location of the oldest transfer record saved in the second storage area and the write location of the next transfer record in the second storage area, write the record pointer information once to the third storage area, and update Pp, that is, the write location of the next pointer information in the third storage area. Each time the system is powered off, only one record needs to be written to area three, without parallel.

[0124] Through the resource data processing method of the present application, M resource transfer requests carrying resource data to be stored are received, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area, and the transfer identifier in the resource data to be stored is extracted, and a first connection diagram between the resource transfer parties of the multiple resource transfer requests is established according to the transfer identifier, and N resource transfer requests are further determined from the M resource transfer requests according to the first connection diagram; thereby, N threads can be called to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area. That is to say, when the present application receives M resource transfer requests, it determines the N resource transfer requests that can be processed in parallel through the determined first connection diagram, and then N threads can be called to process the N resource transfer requests in parallel, thereby improving the processing efficiency of resource data.

[0125] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0126] In the present embodiment, a processing device for resource data is also provided to realize the above-mentioned embodiment and preferred implementation mode, and the descriptions which have been made are not repeated here. As used below, the term "module" can realize the combination of software and / or hardware of the predetermined function. Although the modules described in the following embodiments are preferably realized with software, the realization of hardware, or the combination of software and hardware is also possible and conceived.

[0127] Figure 6 : is a structural block diagram of a resource data processing device according to an embodiment of the present application, the device comprising:

[0128] A receiving module 602 is configured to receive M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area;

[0129] The determination module 604 is used to obtain a first connection graph between the M resource transfer requests, and determine N resource transfer requests from the M resource transfer requests according to the first connection graph, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection graph;

[0130] The calling module 606 is used to call N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests into the first storage area in parallel.

[0131] The above-mentioned device receives M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area, and obtain a first connection diagram between the M resource transfer requests, and further determines N resource transfer requests from the M resource transfer requests according to the first connection diagram, wherein M and N are both positive integers, and M is greater than or equal to N; thereby, N threads can be called to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area. That is to say, when receiving M resource transfer requests, the present application determines the N resource transfer requests that can be processed in parallel by obtaining the first connection diagram, and then N threads can be called to process the N resource transfer requests in parallel, thereby improving the processing efficiency of resource data.

[0132] In an exemplary embodiment, the determination module 604 is further used to extract corresponding transfer times and transfer identifiers from the M resource transfer requests based on the M resource transfer requests; determine a target resource transfer request from the M resource transfer requests, and traverse the other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration; for any other traversed resource transfer request, determine a dependent resource transfer request that meets the dependency condition from the other resource transfer requests according to the transfer times and transfer identifiers of the other traversed resource transfer requests and the transfer times and transfer identifiers corresponding to the target resource transfer request; wherein the resource transfer process of the dependent resource transfer request depends on the resource transfer process of the target resource transfer request; re-determine a new target resource transfer request from the M resource transfer requests, and return to traverse the other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration and continue to execute until a preset iteration stop condition is reached to obtain the first connection graph.

[0133] In an exemplary embodiment, the transfer identifier includes a transfer-in party identifier and a transfer-out party identifier; the determination module 604 is also used to determine the other resource transfer request as a dependent resource transfer request of the target resource transfer request when the transfer time corresponding to the target resource transfer request is less than the transfer time of the other resource transfer requests traversed, and the transfer-in party identifier corresponding to the target resource transfer request is the same as the transfer-out party identifier of the other resource transfer requests traversed.

[0134] In an exemplary embodiment, the calling module 606 is also used to call N threads to determine N areas to be stored in the first storage area; the N areas to be stored are N areas where the resource data to be stored are to be stored in the first storage area; through the N threads, the resource data to be stored carried by the N resource transfer requests are stored in parallel in the N areas to be stored in the first storage area.

[0135] In an exemplary embodiment, the device also includes an erasing module, which is used to erase the first storage area if any of the N areas to be stored is the same as the stored area set for the first storage area; the stored area is an area in the first storage area where resource data has been stored; and through N threads, the resource data to be stored carried by the N resource transfer requests are stored in parallel in the N areas to be stored in the first storage area after the erasure process.

[0136] In an exemplary embodiment, the update module is also used to obtain an updated first connection graph, wherein the first connection graph is updated after N resource transfer requests are determined from the M resource transfer requests; based on the updated first connection graph, K resource transfer requests are determined from the M resource transfer requests, wherein K is a positive integer; and K threads are called to process the K resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the K resource transfer requests in parallel into the first storage area.

[0137] In an exemplary embodiment, a second storage area is also provided in the solid-state memory, and the second storage area is used to store at least resource status parameters associated with the resource data stored in the first storage area; the erasing module is also used to determine the data to be erased in the first storage area; according to the data to be erased, the resource status parameters in the second storage area are updated, and the updated resource status parameters are written into the second storage area; when the updated resource status parameters are written into the second storage area, the first storage area is erased based on the determined data to be erased.

[0138] In an exemplary embodiment, the update module is also used to call at least two threads when there is resource data corresponding to at least two resource transferors in the data to be erased; and update the record identifiers and resource amounts of the resource transfers of the at least two resource transferors in the second storage area in parallel according to the at least two threads.

[0139] In an exemplary embodiment, the update module is also used to obtain a pre-built second connection graph between the resource transfer parties of the M resource transfer requests under the request that the resource data to be stored carried by the M resource transfer requests are stored in the first storage area; wherein the second connection graph is obtained based on the connection of multiple key nodes, and the key nodes are used to characterize the resource transfer parties corresponding to the M resource transfer requests respectively; based on the number of key nodes in the second connection graph, determine O threads matching the number of key nodes; based on the connection relationship between the O threads and the multiple key nodes, update the resource transfer record linked list associated with the M resource transfer requests in parallel.

[0140] In an exemplary embodiment, the solid-state memory includes a first storage area, a second storage area and a third storage area; the device also includes an initialization module, which is used to clear the first storage area, the second storage area and the third storage area of ​​the solid-state memory; write empty records in the first storage area; determine the number of transferors of the resource transferor, determine the number of transferors P of the resource transferor, determine P threads, and initialize the resource status parameters in the second storage area according to the P threads, wherein P is a positive integer.

[0141] In an exemplary embodiment, the device also includes a query module, which is used to respond to a resource query request; the resource query request includes at least one of a resource change query request and a resource storage query request; when the resource query request includes the resource change query request, based on the resource change query request, determine the resource first change record matching the resource change query request from the resource status parameters stored in the second storage area; determine the address of the resource first change record; according to the address, determine the query result corresponding to the resource change query request; when the resource query request includes a resource storage query, directly determine the resource storage parameters from the memory corresponding to the solid-state storage device.

[0142] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0143] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0144] Optionally, in this embodiment, the computer program may be configured to perform the following steps by means of the computer program:

[0145] S1, receiving M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area;

[0146] S2, obtaining a first connection graph between the M resource transfer requests, and determining N resource transfer requests from the M resource transfer requests according to the first connection graph, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection graph;

[0147] S3, calling N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests into the first storage area in parallel.

[0148] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0149] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the steps in any one of the above method embodiments through the computer program.

[0150] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0151] S1, receiving M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area;

[0152] S2, obtaining a first connection graph between the M resource transfer requests, and determining N resource transfer requests from the M resource transfer requests according to the first connection graph, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection graph;

[0153] S3, calling N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests into the first storage area in parallel.

[0154] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0155] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0156] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0157] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.

[0158] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0159] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for processing resource data, characterized in that: Applied to a solid-state memory, in which a first storage area for storing resource data is provided, the method comprises: receiving M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area; Obtaining a first connection graph between the M resource transfer requests, and determining N resource transfer requests from the M resource transfer requests according to the first connection graph, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection graph; N threads are called to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests into the first storage area in parallel.

2. The method according to claim 1, characterized in that: The step of constructing the first connection graph comprises: Based on the M resource transfer requests, extracting corresponding transfer times and transfer identifiers from the M resource transfer requests respectively; Determine a target resource transfer request from the M resource transfer requests, and traverse other resource transfer requests except the target resource transfer request among the M resource transfer requests in a current iteration process; For any other resource transfer request traversed, according to the transfer time and transfer identifier of the other resource transfer request traversed, and the transfer time and transfer identifier corresponding to the target resource transfer request, determine the dependent resource transfer request that meets the dependency condition from the other resource transfer requests; wherein the resource transfer process of the dependent resource transfer request depends on the resource transfer process of the target resource transfer request; Re-determine a new target resource transfer request from the M resource transfer requests, and return to traverse the other resource transfer requests except the target resource transfer request in the M resource transfer requests during the current iteration and continue to execute until a preset iteration stop condition is reached, thereby obtaining the first connection diagram.

3. The method according to claim 2, characterized in that The transfer identifier includes a transferee identifier and a transferor identifier; The determining, according to the transfer time and transfer identifier of the other resource transfer requests traversed, and the transfer time and transfer identifier corresponding to the target resource transfer request, from the other resource transfer requests a dependent resource transfer request that satisfies the dependency condition comprises: When the transfer time corresponding to the target resource transfer request is less than the transfer time of the other resource transfer requests traversed, and the transfer-in party identifier corresponding to the target resource transfer request is the same as the transfer-out party identifier of the other resource transfer requests traversed, the other resource transfer request is determined as the dependent resource transfer request of the target resource transfer request.

4. The method according to claim 1, characterized in that: After calling N threads to process the N resource transfer requests in parallel so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area, the method comprises: The N resource transfer requests in the first connection graph are removed to obtain an updated first connection graph.

5. The method according to claim 1, characterized in that The calling N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area, includes: Calling N threads to determine N areas to be stored in the first storage area; the N areas to be stored are N areas where the resource data to be stored is to be stored in the first storage area; The resource data to be stored respectively carried by the N resource transfer requests are stored in parallel in the N to-be-stored areas of the first storage area through the N threads.

6. The method according to claim 5, characterized in that The method further comprises: When any one of the N to-be-stored areas is the same as the stored area set in the first storage area, the first storage area is erased; the stored area is an area in the first storage area where resource data has been stored; The resource data to be stored respectively carried by the N resource transfer requests are stored in parallel in the N to-be-stored areas of the first storage area after the erasure process through N threads.

7. The method according to claim 6, characterized in that A second storage area is also provided in the solid-state memory, and the second storage area is used to store at least resource status parameters associated with the resource data stored in the first storage area; The erasing process on the first storage area includes: determining the data to be erased in the first storage area; According to the data to be erased, the resource status parameters in the second storage area are updated, and the updated resource status parameters are written into the second storage area; When the updated resource status parameter is written into the second storage area, the first storage area is erased based on the determined data to be erased.

8. The method according to claim 1, characterized in that After calling N threads to process the N resource transfer requests in parallel so as to store the resource data to be stored respectively carried by the N resource transfer requests in parallel into the first storage area, the method further includes: Acquire an updated first connection graph; wherein the first connection graph is updated after determining N resource transfer requests from the M resource transfer requests; Based on the updated first connection graph, determining K resource transfer requests from the M resource transfer requests, where K is a positive integer; K threads are called to process the K resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the K resource transfer requests into the first storage area in parallel.

9. The method according to claim 1, characterized in that: The method further comprises: Under the request that the resource data to be stored carried by the M resource transfer requests are all stored in the first storage area, a second connection graph between the resource transfer parties of the M resource transfer requests constructed in advance is obtained; wherein the second connection graph is obtained based on the connection of multiple key nodes, and the key nodes are used to characterize the resource transfer parties corresponding to the M resource transfer requests respectively; based on the number of key nodes in the second connection graph, O threads matching the number of key nodes are determined; Based on the connection relationship between the O threads and the multiple key nodes, the resource transfer record linked lists associated with the M resource transfer requests are updated in parallel.

10. The method according to claim 1, characterized in that The solid-state memory is also provided with a third storage area for storing the first pointer parameter and the second pointer parameter; the method further comprises: Obtaining a power-off instruction; wherein the power-off instruction is an instruction generated when the solid-state memory enters a stop working state; Based on the power-off instruction, a storage location of the resource data in the first storage area is determined, and a first pointer parameter and a second pointer parameter in the third storage area are updated according to the storage location.

11. The method according to claim 1, characterized in that: The solid-state memory includes a first storage area, a second storage area, and a third storage area; before receiving a resource transfer request carrying resource data to be stored, the method further includes at least one of the following: Clearing the first storage area, the second storage area, and the third storage area of ​​the solid-state memory; Writing an empty record in the first storage area; Determine the number P of transferors of the resource transferor, determine P threads, and initialize resource state parameters in the second storage area according to the P threads, wherein P is a positive integer.

12. The method according to claim 1, characterized in that The method further comprises: responding to a resource query request; the resource query request at least comprises at least one of a resource change query request and a resource storage query request; In the case where the resource query request includes the resource change query request, based on the resource change query request, determining a resource first change record matching the resource change query request from the resource state parameters stored in the second storage area; Determine the address of the first change record of the resource; Determining, according to the address, a query result corresponding to the resource change query request; In the case where the resource query request includes a resource storage query, the resource storage parameters are directly determined from the memory corresponding to the solid-state storage.

13. A resource data processing device, applied to a solid-state memory, wherein only one first storage area for storing resource data is provided in the solid-state memory, characterized in that: include: A receiving module, configured to receive M resource transfer requests carrying resource data to be stored, wherein the M resource transfer requests are all used to store the resource data to be stored in the first storage area; A determination module, configured to obtain a first connection graph between the M resource transfer requests, and determine N resource transfer requests from the M resource transfer requests according to the first connection graph, wherein M and N are both positive integers, and M is greater than or equal to N; the first connection graph refers to a connection graph used to characterize the dependency relationship between the M resource transfer requests; the resource transfer process of the N resource transfer requests does not depend on the resource transfer process of other resource transfer requests in the first connection graph; The calling module is used to call N threads to process the N resource transfer requests in parallel, so as to store the resource data to be stored respectively carried by the N resource transfer requests into the first storage area in parallel.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 12 when executed by a processor.

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Virtual resource transferring, sending and obtaining method and device

    CN110569127A

  • Resource transfer data management method and device and storage medium

    CN111008839A

  • High-concurrency data erasing method, device and apparatus and storage medium

    CN111858078A

  • Resource data processing method and device

    CN112598510A

  • Resource transfer tracking method, device and system and electronic equipment

    CN112686743A