CN112613912A - Coupon getting system design under high concurrency scene - Google Patents
Coupon getting system design under high concurrency scene Download PDFInfo
- Publication number
- CN112613912A CN112613912A CN202011571202.3A CN202011571202A CN112613912A CN 112613912 A CN112613912 A CN 112613912A CN 202011571202 A CN202011571202 A CN 202011571202A CN 112613912 A CN112613912 A CN 112613912A
- Authority
- CN
- China
- Prior art keywords
- coupon
- message
- distributed
- unit
- user
- 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.)
- Granted
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 getting system under 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; a user enters a display unit and submits a request message of a user for receiving a coupon to a message unit, the message unit is packaged and delivered to a distributed message queue RocktMQ cluster, namely the request message is delivered to a message middleware of the message unit, and the distributed message queue RocktMQ cluster calls a coupon receiving interface and monitors a distributed locking unit; the distributed message queue based on the invention can ensure strict message sequence, and can effectively avoid a large amount of requests to execute repeated information query and robbery operation under a large-flow environment; the distributed message queue has the capability of message reading and writing concurrency, so that the coupon picking efficiency 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 getting coupons.
Background
As the commercial economy has developed and market competition has become more intense, competition for customers has become more important, and coupons have been raised that are specifically designed to attract customers. The coupon is discount information that can be added to the consumption amount as a cash rebate or can provide a certain consumption right with the consumption behavior of the customer.
Because of the time-limited promotion activity, a large number of requests are rushed into the platform within a short time when the activity starts, if the platform is not in a good concurrent design, the conditions of overhigh platform connection number, overlarge database load pressure, slow interface response, even system paralysis and excessive coupon are caused, and if the activity flow is also connected with an interface of a third-party platform, a large number of requests are rushed into the third-party system instantly, so that the problems of overhigh third-party system load, interruption of interface requests and the like are caused; for example, chinese patent CN108090058A discloses a high concurrency activity interaction method, which employs a token lock mechanism based on distributed cache memcached and having atomic characteristics, and executes a preemptive logic by a mechanism of preempting a lock bit in advance by a platform, so as to implement repeated information query and preemptive operation, but in this method, when the content capacity reaches a specified value, an algorithm automatically deletes an unused cache, which has a certain risk, and in some special cases, the coupon is also overdissured.
Disclosure of Invention
The invention aims to provide a coupon getting system design under a high concurrency scene, and the coupon getting system design is delivered to a distributed message queue RocktMQ through the operation of getting the coupon, so that the locking of the coupon is realized, and the phenomenon of oversending of the coupon is avoided.
In order to achieve the purpose, the invention provides the following technical scheme:
the invention provides a coupon getting system under 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; a user enters the display unit and submits a request message of a user for receiving a coupon to the message unit, the message unit encapsulates and delivers the request message to a distributed message queue RocktMQ cluster, namely the request message is delivered to message middleware of the message unit, the distributed message queue RocktMQ cluster calls a coupon receiving interface and monitors the distributed locking unit, one thread of the distributed locking unit is successfully occupied, other threads are in a blocking state and a waiting state at the same time, the first check group carries out check, if the first check result is yes, the second check group is carried out, if the first check result is not, the thread is executed to be finished, the lock is released, and other threads continue to be occupied; if the second check result of the second check group is yes, the thread is executed and ended, the lock is released, other threads continue to seize, if the second check result is not, the coupon processing module is entered, after the coupon processing module is completed, the coupon is successfully received, the thread is executed and ended, the lock is released, other threads continue to seize until the balance of the coupon 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 by short message.
Further, the display unit is used for interaction between the user and the system, and is used for logging in and displaying the message reminding for the user.
Further, the first check group is used for checking whether the coupon residual amount of the user is larger than zero, the first check group inquires a first database stored in the coupon, and the first database inquires the coupon residual amount.
Further, the second check group is used for checking whether the user has received the coupon, the second check group calls a second database of the coupon record, and whether the user has received the coupon is inquired from the second database.
Further, the coupon processing module is used for processing coupon picking and coupon deduction.
Further, the distributed message queue RocktMQ cluster listens and calls a service method of the coupon processing module.
Furthermore, after the coupon is received by the delay queue in the distributed message queue, the short message reminds the user of using the coupon;
further, the coupon getting design method under the high concurrency scene comprises the following steps:
(1) the user logs in a coupon getting page;
(2) the user receives the coupon request and delivers the coupon request to the message middleware;
(3) a distributed message queue RocketMQ cluster monitors messages;
(4) checking whether the coupon residual quantity is greater than 0;
(5) verifying whether the user has received the coupon;
(6) receiving the coupons and deducting the coupon inventory;
(7) the coupon is successfully received.
Further, a computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor when executing the computer program can implement the coupon getting system design method in a high concurrency scenario described in any one of the above.
Further, a computer readable storage medium, on which a computer program is stored, which when executed by a processor, is capable of implementing the coupon getting system design method in a high concurrency scenario described in any one of the above.
The invention has the following beneficial effects: (1) the distributed message queue based on the invention can ensure strict message sequence, and can effectively avoid a large amount of requests to execute repeated information query and robbery operation under a large-flow environment; (2) the invention solves the problem of the superdistribution of the movable commodities by locking the coupons by utilizing the distributed lock; (3) the distributed message queue has the capability of message reading and writing concurrency, so that the coupon picking efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of the inventive unit.
Fig. 2 is a schematic diagram of a distributed lock unit of the present invention.
FIG. 3 is a flow chart of coupon design according to the present invention.
Fig. 4 is a logic diagram of a computer program loaded in memory.
Detailed Description
The following detailed description of the embodiments of the present invention is provided in conjunction with the accompanying drawings, and it should be noted that the embodiments are merely specific illustrations of the present invention, and should not be considered as limitations of the present invention, and the purpose of the embodiments is to make technical solutions of the present invention better understood and reproduced by those skilled in the art, and the protection scope of the present invention should be subject to the scope defined by the claims.
The invention is further described with reference to the following detailed description and accompanying drawings:
as shown in fig. 1-2, the present invention provides a coupon getting system in a high concurrency scenario, where the getting system includes a display unit 1, a message unit 2, and a distributed lock unit 3, the distributed lock unit 3 includes a verification module 31 and a coupon processing module 32, and the verification module 31 includes a first verification group 311 and a second verification group 312; a user enters the display unit 1, a request message for the user to receive the coupon is delivered to the message unit 2, the message unit 2 is packaged and delivered to a distributed message queue RocktMQ cluster, namely the request message is delivered to message middleware of the message unit 2, the distributed message queue RocktMQ cluster calls a coupon receiving interface and monitors the distributed locking unit 3, one thread of the distributed locking unit 3 is successfully preempted, other threads are in a blocking state and a waiting state at the same time, the first check group 311 conducts check, if the first check result is yes, the second check group 312 is conducted, if the first check result is not, the thread is executed and ended, 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 is executed to end, the lock is released, and other threads continue to seize, if the second check result is no, the coupon processing module 32 is entered, after the coupon processing module 32 is completed, the coupon getting is successful, the thread is executed to end, the lock is released, and other threads continue to seize until the balance of the coupon is zero; if the coupon is close to expiring, the message unit 1 sends a message to the display unit to remind the user of using the coupon by short message.
Further, the display unit 1 is used for interaction between a user and a system, and is used for logging in and displaying message reminders for the user.
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 issued coupon from the first database.
Further, the second check group 312 is used to check whether the user has received the coupon, and the second check group 312 calls the second database of the coupon record to query the second database whether the user has received the coupon.
Further, the coupon processing module 32 is used for processing coupon pickup and coupon deduction.
Further, the distributed message queue RocktMQ cluster listens and calls a service method of the coupon processing module.
Furthermore, after the coupon is received by the delay queue in the distributed message queue, the short message reminds the user of using the coupon;
as shown in fig. 3, a coupon getting design method in a high concurrency scenario includes the following steps:
(1) the user logs in a coupon getting page;
(2) the user receives the coupon request and delivers the coupon request to the message middleware;
(3) a distributed message queue RocketMQ cluster monitors messages;
(4) checking whether the coupon residual quantity is greater than 0;
(5) verifying whether the user has received the coupon;
(6) receiving the coupons and deducting the coupon inventory;
(7) the coupon is successfully received.
Further, a computer device 10 includes a memory 11, a processor 12, and a computer program stored on the memory and executable on the processor, and the processor when executing the computer program can implement the coupon getting system design method in a high concurrency scenario described in any one of the above.
As shown in fig. 4, a computer readable storage medium 20, on which a computer program is stored, which when executed by a processor, is capable of implementing the coupon getting system design method in a high concurrency scenario described in any one of the above.
While the 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. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
Claims (10)
1. The coupon picking 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 checking module and a coupon processing module, and the checking module comprises a first checking group and a second checking group; a user enters the display unit and submits a request message of a user for receiving a coupon to the message unit, the message unit encapsulates and delivers the request message to a distributed message queue RocktMQ cluster, namely the request message is delivered to message middleware of the message unit, the distributed message queue RocktMQ cluster calls a coupon receiving interface and monitors the distributed locking unit, one thread of the distributed locking unit is successfully occupied, other threads are in a blocking state and a waiting state at the same time, the first check group carries out check, if the first check result is yes, the second check group is carried out, if the first check result is not, the thread is executed to be finished, the lock is released, and other threads continue to be occupied; if the second check result of the second check group is yes, the thread is executed and ended, the lock is released, other threads continue to seize, if the second check result is not, the coupon processing module is entered, after the coupon processing module is completed, the coupon is successfully received, the thread is executed and ended, the lock is released, other threads continue to seize until the balance of the coupon 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 by short message.
2. The coupon getting system under the high concurrency scenario of claim 1, wherein the display unit is used for interaction between a user and the system, for user login and displaying message reminding.
3. The coupon getting system under the high concurrency scenario as claimed in claim 1, wherein the first check group is configured to check whether a remaining amount of the coupon for the user is greater than zero, and the first check group queries a first database stored in the coupon and queries the remaining amount of the issued coupon from the first database.
4. The coupon getting system under the high concurrency scenario of claim 1, wherein the second check group is used for checking whether a user gets a coupon, and the second check group invokes a second database of coupon records to query whether the user has got the coupon from the second database.
5. The coupon getting system under the high concurrency scenario of claim 1, wherein the coupon processing module is configured to process coupon getting and coupon deduction.
6. The coupon getting system under the high concurrency scenario of claim 1, wherein the distributed message queue, RocketMQ, cluster listens for a service method invoking the coupon processing module.
7. The coupon getting system under the high concurrency scenario of claim 1, wherein a delay queue in the distributed message queues reminds a user of using the coupon by a short message after the coupon is got.
8. Coupon picking design method in high concurrency scenario, characterized in that the design method is used for designing the system according to any one of claims 1-7 and comprises the following steps:
(1) the user logs in a coupon getting page;
(2) the user receives the coupon request and delivers the coupon request to the message middleware;
(3) a distributed message queue RocketMQ cluster monitors messages;
(4) checking whether the coupon residual quantity is greater than 0;
(5) verifying whether the user has received the coupon;
(6) receiving the coupons and deducting the coupon inventory;
(7) the coupon is successfully received.
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 when executing the computer program is capable of implementing the method of coupon picking system design in a high concurrency scenario of any one of claims 1 to 8.
10. A computer-readable storage medium, on which a computer program is stored, wherein the computer program, when being executed by a processor, is capable of implementing the method for designing a coupon getting system in a high concurrency scenario according to any one of claims 1 to 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 true CN112613912A (en) | 2021-04-06 |
CN112613912B 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 |
---|---|
CN112613912B (en) | 2023-06-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10528405B2 (en) | Methods, apparatus and computer programs for managing persistence | |
WO2021180025A1 (en) | Message processing method and apparatus, electronic device and medium | |
US20100179994A1 (en) | Preserving message order using a message ordering manager | |
US8763012B2 (en) | Scalable, parallel processing of messages while enforcing custom sequencing criteria | |
CN111813791B (en) | Distributed transaction compensation method and equipment | |
CN111459575B (en) | Call request processing method and device and computer storage medium | |
CN110737388A (en) | Data pre-reading method, client, server and file system | |
CN107197050A (en) | The method and system that file writes in a kind of distributed memory system | |
CN110659971B (en) | Transaction data processing method and device | |
WO2022111733A1 (en) | Message processing method and apparatus, and electronic device | |
CN111324622A (en) | Resource first-aid-purchase processing method, device, equipment and storage medium | |
CN114119129A (en) | High-concurrency second killing system | |
CN112613912A (en) | Coupon getting system design under high concurrency scene | |
EP0747812A3 (en) | Customer information control system and method with API start and cancel transaction functions in a loosely coupled parallel processing environment | |
CN111930528A (en) | Message writing method, device and equipment of message middleware and readable storage medium | |
CN106357557A (en) | Message processing method and device | |
CN115858668A (en) | Distributed transaction processing method, device, electronic device and storage medium | |
CN111611104B (en) | InfluxDB data backup method, system and terminal equipment | |
CN112767978B (en) | DDR command scheduling method, device, equipment and medium | |
CN113641614A (en) | Single-channel multi-service parallel processing method and chip based on SPI | |
CN113761051A (en) | Message pushing method, data acquisition method, device, system, equipment and medium | |
CN112084048B (en) | Kafka synchronous disk brushing method and device and message server | |
CN113704297B (en) | Processing method, module and computer readable storage medium for business processing request | |
JP2604717B2 (en) | Write control method for journal records | |
US20120296951A1 (en) | System and method to execute steps of an application function asynchronously |
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 |