CN112613912B - Coupon retrieval system design in high concurrency scenarios - Google Patents
Coupon retrieval system design in high concurrency scenarios Download PDFInfo
- Publication number
- CN112613912B CN112613912B CN202011571202.3A CN202011571202A CN112613912B CN 112613912 B CN112613912 B CN 112613912B CN 202011571202 A CN202011571202 A CN 202011571202A CN 112613912 B CN112613912 B CN 112613912B
- Authority
- CN
- China
- Prior art keywords
- coupon
- message
- user
- unit
- distributed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0207—Discounts or incentives, e.g. coupons or rebates
- G06Q30/0239—Online discounts or incentives
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0207—Discounts or incentives, e.g. coupons or rebates
- G06Q30/0208—Trade or exchange of goods or services in exchange for incentives or rewards
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Finance (AREA)
- Accounting & Taxation (AREA)
- Strategic Management (AREA)
- Theoretical Computer Science (AREA)
- Development Economics (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Entrepreneurship & Innovation (AREA)
- Game Theory and Decision Science (AREA)
- Software Systems (AREA)
- Economics (AREA)
- Marketing (AREA)
- General Business, Economics & Management (AREA)
- General Engineering & Computer Science (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides a coupon taking system in a high concurrency scene, which comprises a display unit, a message unit and a distributed lock unit, wherein the distributed lock unit comprises a verification module and a coupon processing module, and the verification module comprises a first verification group and a second verification group; the method comprises the steps that a user enters a display unit, a request message of a coupon received by the user is transmitted to a message unit, the message unit packages a method of transmitting the request message to a distributed message queue RocketMQ cluster, namely, the request message is transmitted to a message middleware of the message unit, and the distributed message queue RocketMQ cluster calls a coupon receiving interface and monitors a distributed lock unit; the invention can ensure strict message sequence based on the distributed message queue, and can effectively avoid repeated information inquiry and preemption operation of a large number of requests under a large-flow environment; the distributed message queue has the concurrent capability of reading and writing messages, so that the efficiency of coupon acquisition is improved.
Description
Technical Field
The invention relates to the technical field of high concurrency scene processing, in particular to a method and a system for acquiring coupons.
Background
With the development of commercial economy and the increasing growth of market competition, it is becoming important for customers to compete, and coupons specifically designed to attract customers are generated. Coupons are discount information that can be added to the amount of consumption as cash deductions or that can provide certain rights to consume with the consumer's consumption.
Because of the time-limited popularization activity, a large number of requests are gushed into a platform in a short time when the activity starts, if the platform is not well designed, the conditions of too high connection number of the platform, too high load pressure of a database, slow interface response, even system paralysis and excessive issuing of coupons can be caused, if the activity flow is also in butt joint with an interface of a third party platform, a large number of requests are gushed into a third party system instantly, and the problems of too high load of the third party system, interruption of interface requests and the like are caused; for example, chinese patent CN108090058A discloses a high concurrency interaction method, which adopts a token lock mechanism with atomic characteristics based on a distributed cache, and executes a preemptive logic through a mechanism of preemptive lock for a platform in advance to realize the request of executing repeated information inquiry and preemptive operation.
Disclosure of Invention
The invention aims to provide a coupon acquisition system design under a high concurrency scene, and the coupon acquisition system is delivered to a distributed message queue RocketMQ through the operation of acquiring coupons, so that the locking of the coupons is realized, and the phenomenon of superissuing of the coupons is avoided.
In order to achieve the above object, the present invention provides the following technical solutions:
the invention provides a coupon taking system in a high concurrency scene, which comprises a display unit, a message unit and a distributed lock unit, wherein the distributed lock unit comprises a verification module and a coupon processing module, and the verification module comprises a first verification group and a second verification group; the method comprises the steps that a user enters a display unit, a request message of a coupon received by the user is transmitted to a message unit, the message unit packages a method of transmitting the request message to a distributed message queue RocketMQ cluster, namely, the request message is transmitted to a message middleware of the message unit, the distributed message queue RocketMQ cluster calls a coupon receiving interface and monitors the distributed lock unit, one thread of the distributed lock unit is successfully preempted, other threads are in blocking and waiting states at the same moment, the first check group performs check, if the first check result is yes, the second check group is performed, if the first check result is that the thread execution is not finished, the lock is released, and other threads continue to preempt; if the second checking result of the second checking group is yes, the thread execution is finished, the lock is released, other threads continue to preempt, if the second checking result is that the coupon processing module is not entered, after the coupon processing module is finished, the coupon is successfully taken, the thread execution is finished, the lock is released, and other threads continue to preempt until the coupon balance is zero; and if the coupon is close to expiration, the message unit sends a message to the display unit to remind the user of using the coupon.
Further, the display unit is used for interaction between the user and the system, and is used for user login and message reminding display.
Further, the first check group is used for checking whether the residual quantity of the coupons of the user is greater than zero, the first check group inquires a first database for storing the coupons, and the residual quantity of the coupons issued is inquired from the first database.
Further, the second check group is used for checking whether the user gets the coupon, the second check group calls a second database of the coupon record, and whether the user gets the coupon is inquired from the second database.
Further, the coupon processing module is used for processing coupon retrieval and coupon deduction.
Further, the distributed message queue RocketMQ cluster listens for a service method calling the coupon processing module.
Further, after the delay queues in the distributed message queues are used for receiving coupons, the short message reminds the user to use the coupons;
further, a coupon pickup design method in a high concurrency scene comprises the following steps:
(1) The user logs in to get the coupon page;
(2) The user gets the coupon request and delivers the coupon request to the message middleware;
(3) The distributed message queue RocketMQ cluster monitors messages;
(4) Checking whether the coupon remaining amount is >0;
(5) Checking whether the user has picked up the coupon;
(6) Retrieving coupons and deducting the coupon inventory;
(7) The coupon is successfully retrieved.
Further, a computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor is capable of implementing a coupon retrieval system design method under a high concurrence scenario as described in any one of the above when executing the computer program.
Further, a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, enables a coupon retrieval system design method under a high concurrency scenario as set forth in any one of the above.
The invention has the following beneficial effects: (1) The invention can ensure strict message sequence based on the distributed message queue, and can effectively avoid repeated information inquiry and preemption operation of a large number of requests under a large-flow environment; (2) The invention solves the problem of excessive distribution of movable commodities by locking the coupons by using the distributed locks; (3) The distributed message queue has the concurrent capability of reading and writing messages, so that the efficiency of coupon acquisition is improved.
Drawings
FIG. 1 is a schematic diagram of the unit of the present invention.
Fig. 2 is a schematic diagram of a distributed lock unit of the present invention.
FIG. 3 is a coupon design flow chart of the present invention.
Fig. 4 is a logic diagram of a computer program loaded in memory.
Detailed Description
The following detailed description of the present invention is provided with reference to the accompanying drawings, and it should be noted that the examples are merely illustrative of the present invention and should not be construed as limiting the invention, and the scope of the present invention should be defined by the appended claims for better understanding and reproduction of the technical solutions of the present invention.
The invention is further described with reference to the drawings and detailed description which follow:
as shown in fig. 1-2, the present invention provides a coupon retrieval system in a high concurrence scenario, the retrieval system comprises a display unit 1, a message unit 2 and a distributed lock unit 3, the distributed lock unit 3 comprises a check module 31 and a coupon processing module 32, and the check module 31 comprises a first check group 311 and a second check group 312; the user enters the display unit 1, the request message of the coupon received by the user is transmitted to the message unit 2, the message unit 2 packages the method of transmitting the request message to the distributed message queue RocketMQ cluster, namely, the request message is transmitted to the message middleware of the message unit 2, the distributed message queue RocketMQ cluster calls a coupon receiving interface and monitors the distributed lock unit 3, one thread of the distributed lock unit 3 is successfully preempted, other threads are in blocking and waiting states at the same moment, the first check group 311 performs check, if the first check result is yes, the second check group 312 is performed, if the first check result is that the thread execution is finished, the lock is released, and other threads continue to preempt; if the second check result of the second check group 312 is yes, the thread execution is finished, the lock is released, other threads continue to preempt, if the second check result is that the coupon processing module 32 is entered, after the coupon processing module 32 is finished, the coupon is successfully taken, the thread execution is finished, the lock is released, and other threads continue to preempt until the coupon balance is zero; and if the coupon is close to expiration, the message unit 1 sends a message to the display unit to remind the user of using the coupon.
Further, the display unit 1 is used for interaction between a user and the system, and is used for user login and message reminding display.
Further, the first check group 311 is configured to check whether the remaining amount of the coupon of the user is greater than zero, and the first check group 311 queries a first database in which the coupon is stored, and queries the remaining amount of the coupon issued from the first database.
Further, the second check group 312 is configured to check whether the user has received the coupon, and the second check group 312 invokes a second database of coupon records, and queries from the second database whether the user has received the coupon.
Further, the coupon processing module 32 is configured to process coupon retrieval and coupon deduction.
Further, the distributed message queue RocketMQ cluster listens for a service method calling the coupon processing module.
Further, after the delay queues in the distributed message queues are used for receiving coupons, the short message reminds the user to use the coupons;
as shown in fig. 3, a coupon pickup design method in a high concurrency scenario includes the following steps:
(1) The user logs in to get the coupon page;
(2) The user gets the coupon request and delivers the coupon request to the message middleware;
(3) The distributed message queue RocketMQ cluster monitors messages;
(4) Checking whether the coupon remaining amount is >0;
(5) Checking whether the user has picked up the coupon;
(6) Retrieving coupons and deducting the coupon inventory;
(7) The coupon is successfully retrieved.
Further, a computer device 10 comprises a memory 11, a processor 12 and a computer program stored on the memory and executable on the processor, the processor being capable of implementing a coupon retrieval system design method under a high concurrency scenario as described in any one of the above when executing the computer program.
As shown in fig. 4, a computer-readable storage medium 20 has stored thereon a computer program that, when executed by a processor, is capable of implementing a coupon retrieval system design method in a high concurrency scenario as set forth in any one of the above.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
Claims (10)
1. The coupon retrieval system under the high concurrency scene is characterized by comprising a display unit, a message unit and a distributed lock unit, wherein the distributed lock unit comprises a verification module and a coupon processing module, and the verification module comprises a first verification group and a second verification group; the method comprises the steps that a user enters a display unit, a request message of a coupon received by the user is transmitted to a message unit, the message unit packages a method of transmitting the request message to a distributed message queue RocketMQ cluster, namely, the request message is transmitted to a message middleware of the message unit, the distributed message queue RocketMQ cluster calls a coupon receiving interface and monitors the distributed lock unit, one thread of the distributed lock unit is successfully preempted, other threads are in blocking and waiting states at the same moment, the first check group performs check, if the first check result is yes, the second check group is performed, if the first check result is that the thread execution is not finished, the lock is released, and other threads continue to preempt; if the second checking result of the second checking group is yes, the thread execution is finished, the lock is released, other threads continue to preempt, if the second checking result is that the coupon processing module is not entered, after the coupon processing module is finished, the coupon is successfully taken, the thread execution is finished, the lock is released, and other threads continue to preempt until the coupon balance is zero; and if the coupon is close to expiration, the message unit sends a message to the display unit to remind the user of using the coupon.
2. The coupon retrieval system in a high concurrency scenario of claim 1, wherein the display unit is for interaction between a user and the system for user sign-in and displaying message alerts.
3. The coupon retrieval system according to claim 1, wherein the first check group is configured to check whether the remaining amount of coupons for the user is greater than zero, the first check group querying a first database in which coupons are stored, and querying the first database for the remaining amount of coupons issued.
4. The coupon retrieval system of claim 1, wherein the second check group is configured to check whether a user has retrieved a coupon, the second check group invoking a second database of coupon records, and querying the second database for whether the user has retrieved the coupon.
5. The coupon retrieval system of claim 1, wherein the coupon processing module is configured to process coupon retrieval and coupon deduction.
6. The coupon retrieval system of claim 1, wherein said distributed message queue, dockmq cluster listens for a service method calling said coupon processing module.
7. The coupon retrieval system in a high concurrency scenario of claim 1, wherein a delay queue in the distributed message queues alerts a user to use coupons after coupon retrieval.
8. A coupon retrieval design method in a high concurrency scenario, characterized in that the design method is used for designing a system according to any one of claims 1-7, and comprises the steps of:
(1) The user logs in to get the coupon page;
(2) The user gets the coupon request and delivers the coupon request to the message middleware;
(3) The distributed message queue RocketMQ cluster monitors messages;
(4) Checking whether the coupon remaining amount is >0;
(5) Checking whether the user has picked up the coupon;
(6) Retrieving coupons and deducting the coupon inventory;
(7) The coupon is successfully retrieved.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor is capable of implementing a coupon retrieval system design method under a high concurrency scenario as set forth in claim 8 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor, is capable of implementing a coupon retrieval system design method under a high concurrency scenario as claimed in claim 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011571202.3A CN112613912B (en) | 2020-12-27 | 2020-12-27 | Coupon retrieval system design in high concurrency scenarios |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011571202.3A CN112613912B (en) | 2020-12-27 | 2020-12-27 | Coupon retrieval system design in high concurrency scenarios |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112613912A CN112613912A (en) | 2021-04-06 |
CN112613912B true CN112613912B (en) | 2023-06-16 |
Family
ID=75247991
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011571202.3A Active CN112613912B (en) | 2020-12-27 | 2020-12-27 | Coupon retrieval system design in high concurrency scenarios |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112613912B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110363579A (en) * | 2019-06-28 | 2019-10-22 | 北京奇才天下科技有限公司 | A kind of user's marketing method, device and electronic equipment based on discount coupon |
CN111415146A (en) * | 2020-06-08 | 2020-07-14 | 浙江口碑网络技术有限公司 | Resource data processing method, device and equipment |
WO2020238365A1 (en) * | 2019-05-31 | 2020-12-03 | 深圳前海微众银行股份有限公司 | Message consumption method, apparatus and device, and computer storage medium |
-
2020
- 2020-12-27 CN CN202011571202.3A patent/CN112613912B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020238365A1 (en) * | 2019-05-31 | 2020-12-03 | 深圳前海微众银行股份有限公司 | Message consumption method, apparatus and device, and computer storage medium |
CN110363579A (en) * | 2019-06-28 | 2019-10-22 | 北京奇才天下科技有限公司 | A kind of user's marketing method, device and electronic equipment based on discount coupon |
CN111415146A (en) * | 2020-06-08 | 2020-07-14 | 浙江口碑网络技术有限公司 | Resource data processing method, device and equipment |
Also Published As
Publication number | Publication date |
---|---|
CN112613912A (en) | 2021-04-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8200765B2 (en) | Preserving message order using a message ordering manager | |
US10013278B2 (en) | Methods and systems for batch processing in an on-demand service environment | |
US8763012B2 (en) | Scalable, parallel processing of messages while enforcing custom sequencing criteria | |
US7752370B2 (en) | Splitting one hardware interrupt to multiple handlers | |
US20160357619A1 (en) | Methods, apparatus and computer programs for managing persistence | |
US8505015B2 (en) | Placing a group work item into every prioritized work queue of multiple parallel processing units based on preferred placement of the work queues | |
TWI394074B (en) | Methods, apparatus and computer programs for managing access to storage | |
CN107197050A (en) | The method and system that file writes in a kind of distributed memory system | |
US20070245111A1 (en) | Methods, systems, and computer program products for managing temporary storage | |
CN110659971B (en) | Transaction data processing method and device | |
US20090157832A1 (en) | How to enable "out of box" messages tracking in messaging system | |
CN109614270A (en) | Data read-write method, device, equipment and storage medium based on Hbase | |
CN112613912B (en) | Coupon retrieval system design in high concurrency scenarios | |
WO2022111733A1 (en) | Message processing method and apparatus, and electronic device | |
CN111400053B (en) | Database access system, method, apparatus and computer readable storage medium | |
CN115687491A (en) | Data analysis task scheduling system based on relational database | |
CN115858668A (en) | Distributed transaction processing method, device, electronic device and storage medium | |
CN112767978B (en) | DDR command scheduling method, device, equipment and medium | |
CN113360570A (en) | High-concurrency system inventory module implementation method | |
CN112181671B (en) | Method and device for processing delay message | |
CN114610467A (en) | Multitask timeout management method and system | |
CN113761051A (en) | Message pushing method, data acquisition method, device, system, equipment and medium | |
CN111210288A (en) | Tax control server-based invoicing batch invoicing job optimized scheduling method and system | |
CN113704297B (en) | Processing method, module and computer readable storage medium for business processing request | |
US20060048154A1 (en) | Organizing transmission of repository data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |