Concurrent transaction data processing method and device

A transaction data and processing method technology, applied in data processing applications, electrical digital data processing, special data processing applications, etc., can solve problems such as spending a lot of time and reducing transaction processing efficiency, reducing time and improving transaction processing. The effect of efficiency

Inactive Publication Date: 2017-01-04
BANK OF CHINA
5 Cites 7 Cited by

AI-Extracted Technical Summary

Problems solved by technology

However, this has the following disadvantages: When multiple customers request flash sales or flash sales, the data processing system for flash sales or flash sales must complete the two operations of the previous c...
View more

Method used

[0183] 1. The present invention uses transaction separation for transactions, which ca...
View more

Abstract

The invention provides a concurrent transaction data processing method and device. The method comprises the steps of receiving concurrent transaction data (pre-purchased commodity identifiers and the number of pre-purchased commodities) submitted by multiple clients; deducting the residual number of the pre-purchased commodities from a limit table (the commodity identifiers and the corresponding residual number of the commodities) according to the commodity identifiers and the number of pre-purchased commodities submitted by one client; generating a transaction according to the transaction data when the residual number of the pre-purchased commodities is deducted successfully; carrying out a response that the client transacts successfully when the transaction is generated successfully; and carrying out the response that the client transacts unsuccessfully when the residual number of the pre-purchased commodities is deducted unsuccessfully or the transaction is generated unsuccessfully. Compared with the traditional mode that the same transaction is used for controlling deduction of the residual number of the pre-purchased commodities and generation of the transaction, the method and the device have the advantage that the control of two independent transactions is employed. According to the scheme, the time of responding to multiple client requests is reduced, and the transaction processing efficiency is improved.

Application Domain

Payment architectureBuying/selling/leasing transactions +2

Technology Topic

Data processingTransaction processing +2

Image

  • Concurrent transaction data processing method and device
  • Concurrent transaction data processing method and device
  • Concurrent transaction data processing method and device

Examples

  • Experimental program(1)

Example Embodiment

[0065] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
[0066] The existing online spike system uses the same transaction to control the deduction amount and the generation transaction, ensuring that the deduction amount and the generation transaction either succeed or fail at the same time. Assuming that the online spike system is mainly composed of two database tables, one is the quota table (recording the maximum saleable quota (that is, the maximum saleable quantity) and the current remaining quota (that is, the current remaining quantity)), and the other is the transaction table (used to record Transaction data submitted by the customer). The flow chart of the existing online spike system processing transaction data is as follows figure 1 As shown, the basic process of the system is:
[0067] 1. Customers log in to the online spike system;
[0068] 2. Inquire about the goods that can be reserved (mainly in the database to inquire about the remaining amount/quantity of the goods is not 0);
[0069] 3. The customer selects the product and fills in the pre-order data;
[0070] 4. Submit the transaction;
[0071] 5. The online spike system deducts the quota (from the quota table in the database), inserts the transaction data submitted by the customer, and generates a transaction (inserts into the transaction table in the database);
[0072] 6. If the deduction of the quota and inserting the transaction data submitted by the customer are successful, it will respond to the success of the customer transaction;
[0073] 7. If one of the operations of deducting quota and inserting transaction data fails, the database will roll back the data in response to the failure of the customer's transaction.
[0074] Among them, the detailed process of the online seckill system responding to the customer’s transaction submission is as follows: figure 2 Shown, including:
[0075] 1. At the beginning of the transaction, the online spike system gets the data connection;
[0076] 2. Lock the quota table and deduct the remaining quota of commodities;
[0077] 3. If the operation of deducting the remaining quota of commodities fails, the transaction will end in response to the failure of the customer's transaction;
[0078] 4. If the operation of deducting the remaining quota of commodities is successful, lock the transaction table and insert the transaction data;
[0079] 5. If the operation of inserting data is successful, it will respond to the success of the customer transaction;
[0080] 6. If the operation of inserting data fails, the quota table will be rolled back, and the transaction will end in response to the customer's transaction failure;
[0081] 7. If both the operation of deducting the remaining amount of the commodity and the operation of inserting data are successful, submit the data (commit) in response to the customer's successful transaction, and the transaction ends.
[0082] It can be seen from the above that the existing online spike system has the following shortcomings: when there are multiple customers making a spike or a limited time purchase request, the system must process the deduction of the previous customer and generate the transaction before the two operations Will respond to the next customer's request, which will take a lot of time to respond to multiple customer requests, thereby reducing transaction processing efficiency.
[0083] In view of the problems in the prior art, the present invention proposes a concurrent transaction data processing device. The concurrent transaction data processing device includes:
[0084] The receiving module is configured to receive concurrent transaction data submitted by multiple customers, where the concurrent transaction data includes the pre-purchased product identifier and the pre-purchased product quantity;
[0085] The transaction data processing module is used to deduct the remaining quantity of the corresponding pre-purchased goods from the quota table according to the commodity identifier and the quantity of pre-purchased commodities in the concurrent transaction data submitted by one of the multiple clients; the quota table includes commodities Identification and the remaining quantity of the corresponding goods;
[0086] When the deduction of the remaining quantity of the pre-ordered goods fails, respond to the customer transaction failure;
[0087] When the deduction of the remaining quantity of pre-ordered goods is successful, a transaction is generated based on the concurrent transaction data;
[0088] When the generated transaction is successful, respond to the customer's successful transaction;
[0089] When the generated transaction fails, respond to the customer transaction failure;
[0090] After the current customer has completed the deduction of the remaining quantity of the pre-purchased goods, the next customer is deducted the remaining quantity of the pre-purchased goods without waiting for the current customer to complete the transaction generation operation;
[0091] The deduction of the remaining quantity of pre-purchased commodities and the generation transaction are controlled by two independent transactions.
[0092] In specific implementation, the transaction submitted by the transaction data processing module includes two atomic transactions, namely, deduction of the remaining quota of commodities (ie, the remaining quantity of commodities) and generating transactions. The key point of the present invention is to separate the submitted transactions vertically (divide the m atomic transactions in the business process into m transactions), that is, to deduct the remaining commodity quota and generate the two atomic transactions of the submitted transaction. Divided into two transactions, the system first deducts the remaining amount of the pre-ordered goods, if the deduction of the remaining amount of the goods fails, it responds to the failure of the customer transaction; if the deduction of the remaining amount of the goods is successful, the transaction is generated. If the generated transaction is successful, it responds to the success of the customer transaction; if the generated transaction fails, the corresponding customer transaction fails. By performing vertical transaction separation, when multiple customers make transaction requests, the system of the present invention can respond to the transaction request of the next customer after successfully processing the deduction limit of the previous customer, without having to process the deduction of the previous customer. After the two operations of quota and transaction generation, the next customer's transaction request is responded to. That is to say, the time when the system of the present invention supports the earliest operation of the next customer may be the time when the previous customer just successfully deducted the quota.
[0093] In addition, the present invention can also perform horizontal transaction separation for the submitted transaction (divide a record into x copies, then the original only supported concurrency is increased to x concurrencies), that is, the remaining commodity quota is deducted. The quota record corresponding to the atomic exchange is divided into x records. When responding to the customer, the customer request is mapped to these x records through the Hassy algorithm, then the original only supported concurrency is increased to x concurrency.
[0094] During specific implementation, the transaction data processing module is specifically used to:
[0095] Deduct the remaining quantity of pre-ordered goods as follows:
[0096] Find the corresponding product identifier and the corresponding remaining quantity of the product from the quota table according to the product identifier;
[0097] Subtract the quantity of the pre-ordered goods from the remaining quantity of the corresponding goods. If the deduction result is greater than or equal to 0, the deduction of the remaining quantity of the pre-ordered goods is successful; if the deduction result is less than 0, the deduction of the remaining quantity of the pre-ordered goods fails.
[0098] The transaction data processing module is specifically used for:
[0099] Generate transactions as follows:
[0100] Insert concurrent transaction data into the transaction table to generate transactions;
[0101] If the concurrent transaction data is inserted successfully, respond to the success of the customer transaction;
[0102] If the concurrent transaction data insertion fails, respond to the customer transaction failure;
[0103] The transaction table includes customer information, product identifiers, and corresponding pre-ordered product quantities.
[0104] In specific implementation, since the present invention uses vertical transaction separation in the transaction submission, it is possible that when the quota deduction succeeds and the insertion transaction fails, the remaining quota of the commodity in the quota table is inconsistent with the actual remaining quota. In order to solve this problem, the present invention introduces a quota compensation mechanism to compensate invalid quotas through automatic processing at regular intervals to ensure data consistency. That is, the system of the present invention also includes a quota compensation module, which is used when the deduction operation of the remaining quantity of the pre-purchased goods succeeds but the generating transaction operation fails, and the maximum saleable quantity of the goods minus the actual purchase total quantity of the pre-purchased goods does not equal the remaining quantity of the goods Perform quota compensation operations.
[0105] Specifically, the quota compensation module performs quota compensation as follows:
[0106] Make sure that the remaining quantity of commodities in the quota table is 0, and the corresponding commodity sales status is the unsold commodity identification and the maximum quantity of commodities that can be sold;
[0107] According to the product identifier, determine the actual purchase total amount of the corresponding pre-purchased product in the transaction table;
[0108] Compare the maximum saleable quantity of the commodity with the actual purchase total amount, if the two are not equal, modify the remaining quantity of the corresponding commodity to the maximum saleable quantity of the commodity minus the actual purchase total amount; If they are equal, modify the corresponding product sales status to sold out;
[0109] The quota table also includes the maximum number of corresponding merchandise that can be sold and the corresponding merchandise sales status; the corresponding merchandise sales status includes sold-out status and unsold-out status.
[0110] Among them, the product identifier in the quota table can be the name of the product, or the serial number of the product, and it can be any form that can identify the product; the maximum saleable quantity in the quota table (or the maximum saleable quota) It is a fixed value; the product sales status in the quota table is used to mark whether the product is really sold out and whether quota compensation is still needed. The default initial value is not sold out. The data in the quota table has been maintained through the business before the system goes online. The transaction table is to record the information of customers' purchases and sales.
[0111] In specific implementation, the transaction data processing module and the quota compensation module run in different processes, and only the remaining quota of the commodity recorded in the quota table is 0, but the sales status is not sold out, the quota compensation operation will be performed, and the online sales transaction It is not possible to buy and sell commodities whose remaining quota of commodities recorded in the quota table is 0, so the quota compensation module will not affect the transaction data processing module.
[0112] As used above, the term "unit" or "module" can be a combination of software and/or hardware that implements a predetermined function. Although the system described in the above embodiments is preferably implemented by software, implementation by hardware or a combination of software and hardware is also possible and conceived.
[0113] When implementing, image 3 It is a specific flow chart of the concurrent transaction data processing device provided by the present invention for processing concurrent transaction data. Figure 4 It can be seen that the online sales module included in the device is the transaction data processing module. The basic process of the device is:
[0114] 1. Customers log in to the system;
[0115] 2. Inquire about the goods that can be reserved (mainly in the database for the goods whose remaining quota is not 0);
[0116] 3. The customer selects the product and fills in the pre-order data;
[0117] 4. Submit the transaction;
[0118] Online sales module processing:
[0119] 5. Deduction of quota (from the quota table in the database);
[0120] 6. Insert the transaction data submitted by the customer to generate the transaction (insert into the transaction table in the database);
[0121] 7. If the quota is deducted and the transaction data submitted by the customer is successfully inserted, the transaction is submitted;
[0122] Credit compensation module processing:
[0123] 8. If the deduction of the quota is successful and the insertion transaction fails, the regular processing shall be carried out, and the quota compensation shall be made to the commodities with the quota of 0.
[0124] In specific implementation, the online sales module (ie, transaction data processing module) is a WEB application, which mainly includes two transactions, which are respectively querying remaining quota information and buying and selling transactions. The timing diagram of its online sales is as follows Figure 4 Shown, including:
[0125] 1: User: log in to the system;
[0126] 1.1: Front-end page: request online sales APP to query for saleable product information;
[0127] 1.1.1: Online sales APP: query the product information in the database, filter the saleable products whose remaining quota is not 0;
[0128] 3: Customer: select the commodity to be bought and sold, and fill in the customer-related information; (4: belong to the return process)
[0129] 5: Client: submit a sale and purchase transaction;
[0130] 5.1: Front-end page: In response to customer requests, call online sales APP to submit transactions;
[0131] 5.1.1: Online sales APP: In response to the page request, one of the x records is obtained through the Hassi algorithm to respond to the customer and deduct the remaining quota, that is, the remaining quota of the recorded product minus the customer's purchase and sale quantity. If the deduction is successful, proceed to follow-up operations. If the deduction fails, it will directly respond to the customer transaction failure.
[0132] 5.1.3: Online sales APP: insert customer transaction information into the database. If the insertion is successful, the result information will be returned in response to the successful transaction of the customer. If the insertion fails, it responds to the customer transaction failure.
[0133] Among them, 1.1.2: query product information, filter and observe products; 1.2: query saleable product information; 2: log in to the system; 5.1.2: deduct remaining quota; 5.1.4: insert transaction data; 5.2: submit transaction; 6 : Submitting a transaction belongs to the return process.
[0134] In the specific implementation, the detailed process of submitting the sale and purchase transaction is as follows Figure 5 Shown, including:
[0135] 1. The transaction begins;
[0136] 2. Perform deduction operations (one transaction control);
[0137] When horizontal transaction separation is included: the system obtains the data connection, locks the quota table, obtains one of the x records through the hash algorithm to respond to the customer, and subtracts the remaining quota of the goods in the record from the customer's purchase and sale quantity;
[0138] When horizontal transaction separation is not included: the system obtains the data connection, locks the quota table, and deducts the remaining quota. If the operation of deducting the remaining quota of the commodity fails, respond to the customer transaction failure and the transaction ends;
[0139] If the operation of deducting the remaining quota of the commodity is successful, submit the transaction (commit);
[0140] 3. Carry out generating transaction operation (another transaction control):
[0141] Get data connection;
[0142] Lock the transaction table, insert the transaction data, and put the records corresponding to the separated quota table into the consent partition. If the operation of inserting data fails, respond to the customer transaction failure and the transaction ends;
[0143] If the operation of inserting data is successful, submit the transaction (commit), and respond to the client's successful transaction, the transaction ends.
[0144] In specific implementation, the quota compensation module is a regular and automatic processing application to compensate for the data inconsistency caused by the use of de-transactional control for submitting and selling transactions in the online sales module. The timing diagram of the quota compensation is as follows Image 6 Shown, including:
[0145] 1: Clock: Call quota compensation transaction in a regular loop;
[0146] 1.1: Quota compensation APP: query the product information in the database, filter the remaining quota is 0, and the status is not sold out;
[0147] 1.3: Quota compensation APP: For each commodity, calculate the total amount sold in the transaction table according to the commodities in the transaction table;
[0148] 1.5: Quota compensation APP: Determine whether the actual total sold amount of the product is equal to the maximum saleable quota of the product. If they are equal, it means that the product has indeed been sold out. 1: Set the status of the product to sold out. If it is not equal, it means that the commodity has been deducted but the transaction data has not been successfully inserted. It is necessary to compensate the invalid deduction to the remaining quota, ie 2: modify the remaining quota: the maximum possible Sales-the actual total sold.
[0149] 2: Credit compensation.
[0150] Among them, 1.2: Query product information and filter products with a remaining quota of 0; 1.4: Calculate the total sold amount in the transaction table based on the product; 1.6: Determine whether the maximum saleable quota of the product is equal to the actual total sold amount; 1: Change the status of the product Set as sold out; 2: Modify the remaining quota: the maximum saleable amount-the actual total sold amount belongs to the return process.
[0151] When implementing, Figure 7 It is a schematic diagram of the time required for an existing online spike system to respond to customers, such as Figure 7 As shown, assuming that the time taken to deduct the remaining quota of the commodity is a second, and the time taken to insert the transaction data is b second, then the time to respond to a customer transaction is a+b second. Assuming that in the case of high concurrency, the system has no idle time, the time required to respond to the requests of n customers is n*(a+b) seconds.
[0152] When the present invention uses horizontal transaction separation alone, since a record is split into x copies, and the customer request is mapped to x copies of the record through the Hassy algorithm, the simultaneous locking of x records can be supported. That is, the maximum number of concurrent connections can be x. Assuming that the time taken for deduction is a second, and the time taken for inserting transaction data is b second, the time required to respond to the requests of n customers is n*(a+b)/x.
[0153] When the present invention uses vertical transaction separation alone, assuming that the time taken for deduction is a second, and the time taken for inserting transaction data is b second, the time for responding to a customer transaction is a+b second. Suppose a Figure 8 Shown. Assuming a> b. In the case of high concurrency, the system has no idle time, and the time required to respond to n customer requests is n*a+b seconds, such as Picture 9 Shown.
[0154] If the present invention performs horizontal transaction separation and vertical transaction separation at the same time, it takes (n*a+b)/x seconds or (n*b+a)/x seconds to respond to n client requests.
[0155] According to the above analysis, compared with the prior art, which takes n(a+b) seconds to respond to n client requests, the present invention is approximately 2x times higher. In the case of high concurrency, the present invention has higher performance than the prior art.
[0156] Based on the same inventive concept, the embodiment of the present invention also provides a concurrent transaction data processing method, as described in the following embodiment. Since the problem-solving principle of the concurrent transaction data processing method is similar to that of the concurrent transaction data processing device, the implementation of the concurrent transaction data processing method can refer to the implementation of the concurrent transaction data processing device, and the repetition will not be repeated.
[0157] The concurrent transaction data processing method proposed by the present invention includes:
[0158] Receiving concurrent transaction data submitted by multiple customers, where the concurrent transaction data includes the pre-purchased product identifier and the pre-purchased product quantity;
[0159] According to the commodity identification and the quantity of pre-purchased commodities in the concurrent transaction data submitted by one of the multiple customers, the remaining quantity of the corresponding pre-purchased commodities is deducted from the quota table; the quota table includes the commodity identification and the corresponding remaining quantity of commodities ;
[0160] When the deduction of the remaining quantity of the pre-ordered goods fails, respond to the customer transaction failure;
[0161] When the deduction of the remaining quantity of pre-ordered goods is successful, a transaction is generated based on the concurrent transaction data;
[0162] When the generated transaction is successful, respond to the customer's successful transaction;
[0163] When the generated transaction fails, respond to the customer transaction failure;
[0164] After the current customer has completed the deduction of the remaining quantity of the pre-purchased goods, the next customer is deducted the remaining quantity of the pre-purchased goods without waiting for the current customer to complete the transaction generation operation;
[0165] The deduction of the remaining quantity of pre-purchased commodities and the generation transaction are controlled by two independent transactions.
[0166] In specific implementation, according to the product identifier and the quantity of pre-purchased products in the concurrent transaction data submitted by one of the multiple customers, deduct the remaining quantity of the corresponding pre-purchased product from the quota table, which specifically includes:
[0167] Find the corresponding product identifier and the corresponding remaining quantity of the product from the quota table according to the product identifier;
[0168] Subtract the quantity of the pre-ordered goods from the remaining quantity of the corresponding goods. If the deduction result is greater than or equal to 0, the deduction of the remaining quantity of the pre-ordered goods is successful; if the deduction result is less than 0, the deduction of the remaining quantity of the pre-ordered goods fails.
[0169] During specific implementation, transactions are generated based on concurrent transaction data, including:
[0170] Insert concurrent transaction data into the transaction table to generate transactions;
[0171] If the concurrent transaction data is inserted successfully, respond to the success of the customer transaction;
[0172] If the concurrent transaction data insertion fails, respond to the customer transaction failure;
[0173] The transaction table includes customer information, product identifiers, and corresponding pre-ordered product quantities.
[0174] In specific implementation, it also includes:
[0175] When the operation of deducting the remaining quantity of the pre-purchased goods succeeds, but the operation of generating the transaction fails, the maximum saleable quantity of the goods minus the actual purchase total quantity of the pre-purchased goods does not equal the remaining quantity of the goods, and the quota compensation operation is performed.
[0176] In one embodiment, the credit compensation is performed as follows:
[0177] During the specific implementation, the amount compensation shall be carried out as follows:
[0178] Confirm that the remaining quantity of commodities in the quota table is 0, and the corresponding commodity sales status is the unsold commodity identification and the maximum quantity of commodities that can be sold;
[0179] According to the commodity identifier, determine the actual purchase total amount of the corresponding pre-purchased commodities in the transaction table;
[0180] Compare the maximum saleable quantity of the commodity with the actual purchase total. If the two are not equal, modify the remaining quantity of the corresponding commodity to the maximum saleable quantity of the commodity minus the actual purchase total; if two If they are equal, modify the corresponding product sales status to sold out;
[0181] The quota table also includes the corresponding maximum quantity of merchandise for sale and the corresponding merchandise sales status; the corresponding merchandise sales status includes the sold out status and the unsold status.
[0182] In summary, the advantages of the present invention are:
[0183] 1. The present invention uses transaction separation for transactions, which can shorten transaction processing time and improve transaction processing capabilities.
[0184] 2. Use the quota compensation mechanism to compensate for the data inconsistency caused by the separation of vertical transactions.
[0185] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0186] The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment can be generated In the process Figure one Process or multiple processes and/or boxes Figure one A device with functions specified in a block or multiple blocks.
[0187] These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device is implemented in the process Figure one Process or multiple processes and/or boxes Figure one Functions specified in a box or multiple boxes.
[0188] These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. Instructions are provided to implement the process Figure one Process or multiple processes and/or boxes Figure one Steps of functions specified in a box or multiple boxes.
[0189] The foregoing descriptions are only preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc., made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.

Similar technology patents

CT image-based lung lobe segmentation method and device

ActiveCN107392910Ashorten the time
Owner:SHENYANG NEUSOFT MEDICAL SYST CO LTD

Quick heating type heat pump water heater for recovering shower waste heat

ActiveCN102607170Ashorten the timeIncrease power and efficiency
Owner:佛山市三角洲电器科技有限公司 +1

Classification and recommendation of technical efficacy words

  • shorten the time
  • Improve transaction processing efficiency

Transaction processing control method and system

InactiveCN106970934AImprove transaction processing efficiency
Owner:PING AN BANK CO LTD

Blockchain transaction processing auxiliary system and blockchain data processing system and method

ActiveCN108846745AImprove transaction processing efficiency
Owner:SHENZHEN THUNDER NETWORK TECH +1
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products