Method and device for determining right receiving mode, electronic equipment and storage medium
By switching the rights collection method based on the current resource occupancy and the number of requests, the problem of transaction system crash and response delay caused by high concurrent requests is solved, and a high concurrency performance and low-latency rights collection process is achieved.
Patent Information
- Application Number
- CN202410682753.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-05-29
AI Technical Summary
Existing technologies can easily cause the trading system to crash or respond slowly when processing high concurrent requests, and lack effective solutions.
When receiving a rights claim request, the current claim switch value is determined based on the current resource occupancy and the number of rights claim requests, switching to a high-concurrency or low-concurrency claim method, and issuing rights in an asynchronous or synchronous manner to improve concurrency. performance and reduced response latency.
It avoids system crashes in high concurrency scenarios, reduces response delays in low concurrency scenarios, and improves the concurrency performance and user experience of rights collection.
Smart Images

Figure CN118660084A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a method for determining a method for receiving benefits, a device thereof, an electronic device and a storage medium. Background Art
[0002] Currently, with the development of Internet technology, more and more financial institutions choose to issue equity resources to customers online to promote product sales and improve customer loyalty. However, in the process of issuing equity resources, there will be high concurrent requests, that is, a large number of customers' collection requests need to be processed in a short period of time, for example, during promotional activities or specific holidays, a large number of customers collect equity resources at the same time.
[0003] In the related art, the use of low-concurrency distribution of equity resources will cause the transaction system to crash when a large number of requests appear in an instant, while the use of high-concurrency distribution of equity resources will cause response delays in the customer collection process.
[0004] Therefore, there is an urgent need for a method to determine the method of claiming benefits in order to solve the problem of trading system crash risk or slow transaction response.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] The embodiments of the present invention provide a method for determining a rights collection method and its device, electronic device and storage medium, so as to at least solve the technical problems in the related technology that there is a risk of transaction system crash or slow transaction response when collecting rights resources.
[0007] According to one aspect of an embodiment of the present invention, a method for determining a rights collection method is provided, comprising: upon receiving a rights collection request sent by a target terminal, determining a current collection switch value, wherein the current collection switch value is determined based on a current resource occupancy rate and a current number of rights collection requests; when the current collection switch value is a first switch value, using a first collection method to issue rights to the target terminal, wherein the first collection method is an asynchronous collection method; when the current collection switch value is a second switch value, using a second collection method to issue rights to the target terminal, wherein the second collection method is a synchronous collection method, and the concurrency performance of the first collection method is higher than the concurrency performance of the second collection method.
[0008] Furthermore, the step of determining the current collection switch value includes: based on a preset time interval, detecting the current resource occupancy rate and the current number of rights collection requests of the rights issuance system; when the current resource occupancy rate is greater than a preset resource threshold or the current number of rights collection requests is greater than a preset collection threshold, updating the current collection switch value to the first switch value; when the current resource occupancy rate is less than a preset resource switchback threshold and the current number of rights collection requests is less than a preset switchback threshold, updating the current collection switch value to the second switch value.
[0009] Furthermore, based on a preset time interval, the step of detecting the current resource occupancy rate and the current number of rights collection requests of the rights issuance system includes: obtaining log information of the operating system used by the rights issuance system; based on the log information, determining the current CPU utilization rate of the rights issuance system at the current time point, and characterizing the current CPU utilization rate as the current resource occupancy rate; obtaining the number of rights collection requests for the hot key corresponding to the previous time point from the cache database, and characterizing the number of rights collection requests as the current number of rights collection requests.
[0010] Furthermore, the method for determining the rights collection method also includes: creating a hot key in the cache database at intervals of a preset time unit, and determining the key identifier of the hot key based on the creation time point of the hot key; determining the reception time point of the rights collection request each time a rights collection request is received; determining a target creation time point equal to the reception time point, and increasing the key value of the target hot key with the key identifier as the target creation time point; when the current time point reaches the next reception time point, determining the key value of the target hot key as the number of rights collection requests at the reception time point.
[0011] Furthermore, the step of issuing rights to the target terminal by using the first collection method includes: when the rights collection request is received, performing inventory verification and activity verification on the rights to be collected; when both the inventory verification and the activity verification are passed, performing inventory deduction on the rights to be collected, and returning the rights locking information to the target terminal; adding the rights collection request to a preset message queue; when the message consumption thread monitors that the preset message queue has the rights collection request, using the message consumption thread to forward the rights collection request to a rights collection platform, wherein the rights collection platform processes the rights collection request and writes the processing result to the preset message queue; when it is detected that the processing result in the preset message queue is a successful collection, the processing result is returned to the target terminal.
[0012] Furthermore, the step of issuing rights and interests to the target terminal using the second collection method includes: upon receiving the rights and interests collection request, performing inventory verification and activity verification on the rights and interests to be collected; when both the inventory verification and the activity verification are passed, performing inventory deduction on the rights and interests to be collected, and forwarding the rights and interests collection request to a rights and interests collection platform, wherein the rights and interests collection platform issues the rights and interests to the target terminal.
[0013] Furthermore, the method for determining the rights collection method also includes: adopting a stress testing strategy to determine the number of concurrent requests and the number of concurrent switchbacks; simulating the rights collection requests of the concurrent number of requests to determine the preset resource threshold and the preset collection threshold; simulating the rights collection requests of the concurrent number of switchbacks to determine the preset resource switchback threshold and the preset collection switchback threshold.
[0014] According to another aspect of an embodiment of the present invention, a device for determining a rights collection method is also provided, including: a determination unit, used to determine a current collection switch value when a rights collection request sent by a target terminal is received, wherein the current collection switch value is determined based on the current resource occupancy rate and the current number of rights collection requests; a first issuance unit, used to, when the current collection switch value is the first switch value, use a first collection method to issue rights to the target terminal, wherein the first collection method is an asynchronous collection method; a second issuance unit, used to, when the current collection switch value is the second switch value, use a second collection method to issue rights to the target terminal, wherein the second collection method is a synchronous collection method, and the concurrency performance of the first collection method is higher than the concurrency performance of the second collection method.
[0015] Furthermore, the determination unit includes: a first detection module, used to detect the current resource occupancy rate and the current number of equity collection requests of the equity issuance system based on a preset time interval; a first update module, used to update the current collection switch value to the first switch value when the current resource occupancy rate is greater than a preset resource threshold or the current number of equity collection requests is greater than a preset collection threshold; and a second update module, used to update the current collection switch value to the second switch value when the current resource occupancy rate is less than a preset resource switchback threshold and the current number of equity collection requests is less than a preset switchback threshold.
[0016] Furthermore, the first detection module includes: a first acquisition submodule, used to obtain log information of the operating system used by the equity issuance system; a first determination submodule, used to determine the current CPU utilization of the equity issuance system at the current time point based on the log information, and represent the current CPU utilization as the current resource occupancy rate; a second acquisition submodule, used to obtain the number of equity collection requests for the hot key corresponding to the previous time point from the cache database, and represent the number of equity collection requests as the current number of equity collection requests.
[0017] Furthermore, the determination device also includes: a first creation module, which is used to create a hot key in the cache database at intervals of a preset time unit, and determine the key identifier of the hot key based on the creation time point of the hot key; a first determination module, which is used to determine the reception time point of the benefit collection request each time a benefit collection request is received; a second determination module, which is used to determine a target creation time point equal to the reception time point, and increase the key value of the target hot key with the key identifier as the target creation time point; and a third determination module, which is used to determine the key value of the target hot key as the number of benefit collection requests at the reception time point when the current time point reaches the next reception time point.
[0018] Furthermore, the first issuance unit includes: a first verification module, which is used to perform inventory verification and activity verification on the rights to be collected when the rights collection request is received; a first deduction module, which is used to perform inventory deduction on the rights to be collected when both the inventory verification and the activity verification are passed, and return the rights locking information to the target terminal; a first adding module, which is used to add the rights collection request to a preset message queue; a first forwarding module, which is used to forward the rights collection request to a rights collection platform using the message consumption thread when the message consumption thread monitors that the preset message queue has the rights collection request, wherein the rights collection platform processes the rights collection request and writes the processing result to the preset message queue; a first returning module, which is used to return the processing result to the target terminal when it is detected that the processing result in the preset message queue is successfully collected.
[0019] Furthermore, the second issuance unit includes: a second verification module, which is used to perform inventory verification and activity verification on the rights to be received when the rights collection request is received; a second deduction module, which is used to perform inventory deduction on the rights to be received when both the inventory verification and the activity verification are passed, and forward the rights collection request to the rights collection platform, wherein the rights collection platform distributes the rights to the target terminal.
[0020] Furthermore, the determination device also includes: a fourth determination module, which is used to adopt a stress testing strategy to determine the number of concurrent requests and the number of concurrent switchbacks; a fifth determination module, which is used to simulate the rights and interests collection requests of the number of concurrent requests, determine the preset resource threshold and the preset collection threshold; a sixth determination module, which is used to simulate the rights and interests collection requests of the number of concurrent switchbacks, determine the preset resource switchback threshold and the preset collection switchback threshold.
[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for determining the rights and interests collection method.
[0022] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a method for determining any one of the above-mentioned rights collection methods.
[0023] In the present invention, when a rights collection request is received from a target terminal, the current collection switch value is determined. When the current collection switch value is a first switch value, a first collection method is used to issue rights to the target terminal. When the current collection switch value is a second switch value, a second collection method is used to issue rights to the target terminal.
[0024] In the present invention, the switch value of the current claim switch can be determined in advance according to the current resource occupancy rate of the trading system and the current number of rights claim requests, and then the rights claim method can be selected according to the current claim switch value. When instantaneous high-concurrency requests occur, it can switch to a high-concurrency rights claim process in time to claim rights, so as to avoid system crashes. In low-concurrency scenarios, it can adopt a low-concurrency rights claim process to claim rights, so as to effectively reduce the claim response delay, thereby solving the technical problem in the related technology that there is a risk of trading system crash or slow transaction response when claiming rights resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0026] Figure 1 is a flow chart of a method for determining an optional benefit claiming method according to an embodiment of the present invention;
[0027] Figure 2 is an optional flow chart for determining the number of equity claim requests at each time point according to an embodiment of the present invention;
[0028] Figure 3 is a schematic diagram of a device for determining an optional benefit claiming method according to an embodiment of the present invention;
[0029] Figure 4 It is a hardware structure block diagram of an electronic device (or mobile device) for determining a method for receiving benefits according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] It should be noted that the method for determining the method for receiving benefits and the device thereof in the present invention can be used in the field of financial technology when the method for receiving benefits is determined, and can also be used in any field other than the field of financial technology when the method for receiving benefits is determined. The present invention does not limit the application field of the method for determining the method for receiving benefits and the device thereof.
[0033] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set between the system and the relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0034] In order to solve the problem that in the scenario where high-concurrency requests appear instantly, it is impossible to switch from a low-concurrency rights issuance process to a high-concurrency rights issuance process in time, which easily leads to system crash, the present invention proposes an automatic switching mechanism between high-concurrency rights issuance and low-concurrency rights issuance. By detecting the usage of system resources and the popularity of the current rights collection, and setting the corresponding traffic threshold, it is determined whether the traffic threshold is triggered. If triggered, it switches to the high-concurrency issuance process for issuance, and when the traffic decreases, it can automatically switch to the low-concurrency issuance process for issuance.
[0035] The present invention is described in detail below in conjunction with various embodiments.
[0036] Embodiment 1
[0037] According to an embodiment of the present invention, an embodiment of a method for determining a method for collecting benefits is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0038] Figure 1 is a flow chart of a method for determining an optional benefit claiming method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0039] Step S101, when receiving a benefit claiming request sent by a target terminal, determining a current claiming switch value, wherein the current claiming switch value is determined based on a current resource occupancy rate and a current number of benefit claiming requests.
[0040] Step S102: when the current claim switch value is the first switch value, the first claim method is used to issue rights and interests to the target terminal, wherein the first claim method is an asynchronous claim method.
[0041] Step S103, when the current collection switch value is the second switch value, the second collection method is used to issue rights and interests to the target terminal, wherein the second collection method is a synchronous collection method, and the concurrency performance of the first collection method is higher than the concurrency performance of the second collection method.
[0042] Through the above steps, when a request for claiming rights sent by a target terminal is received, the current claim switch value can be determined. When the current claim switch value is the first switch value, the first claim method is used to issue rights to the target terminal. When the current claim switch value is the second switch value, the second claim method is used to issue rights to the target terminal. In an embodiment of the present invention, the switch value of the current claim switch can be determined in advance based on the current resource occupancy rate of the trading system and the current number of claims for claiming rights. Then, based on the current claim switch value, the rights claim method is selected. When instantaneous high-concurrency requests occur, it is possible to switch to a high-concurrency rights claim process in time to claim rights to avoid system crashes, and it is possible to use a low-concurrency rights claim process to claim rights in low-concurrency scenarios to effectively reduce the claim response delay, thereby solving the technical problem in the related art that there is a risk of trading system crashes or slow transaction responses when claiming rights resources.
[0043] The embodiment of the present invention is described in detail below in combination with the above steps.
[0044] Step S101, when receiving a benefit claiming request sent by a target terminal, determining a current claiming switch value, wherein the current claiming switch value is determined based on a current resource occupancy rate and a current number of benefit claiming requests.
[0045] In step S101, when the trading system receives a benefit claim request sent by the target terminal, it can first determine the current claim switch value, which is determined based on the current resource occupancy rate and the current number of benefit claim requests. The claim switch value is divided into two values, which can be identified by different numbers or characters, for example, the claim switch value = 1 or the claim switch value = 0, representing different processing procedures for the benefit claim request.
[0046] In the embodiment of the present invention, the benefit claiming request may include a benefit resource identifier, which is used to indicate the benefit resource to be claimed. The benefit resource includes: discount coupons, instant discount coupons, etc.
[0047] For example, when a customer clicks to receive the payment, the background of the transaction system first queries the high-concurrency payment switch (i.e., the current payment switch value), and based on the switch value, determines whether to proceed with the high-concurrency payment process (i.e., the first payment method) or the ordinary payment process (i.e., the second payment method, which is also a low-concurrency payment process).
[0048] Optionally, the step of determining the current claim switch value includes: based on a preset time interval, detecting the current resource occupancy rate and the current number of claim requests of the rights issuance system; when the current resource occupancy rate is greater than a preset resource threshold or the current number of claim requests is greater than a preset claim threshold, updating the current claim switch value to a first switch value; when the current resource occupancy rate is less than a preset resource cutback threshold and the current number of claim requests is less than a preset claim cutback threshold, updating the current claim switch value to a second switch value.
[0049] In an embodiment of the present invention, a timed task can be designed to be executed once every preset time interval (for example, every 2 seconds, the interval can be adjusted according to demand). During execution, a preset detection method is used to obtain the current resource occupancy of the equity issuance system (i.e., the current CPU (Central Processing Unit, i.e., processor) utilization) and the current number of equity collection requests (i.e., the TPS (Transactions Per Second, i.e., the number of transactions per second) of the equity resource collection in the last second). If the CPU utilization exceeds the preset resource threshold or the TPS of the equity resource collection exceeds the preset collection threshold, the current collection switch value is updated to the first switch value (i.e., the high-concurrency collection switch needs to be switched to the high-concurrency collection process). If the CPU utilization is lower than the preset resource switchback threshold, and the TPS of the equity resource collection is also lower than the preset switchback threshold, the current collection switch value is updated to the second switch value (i.e., the high-concurrency collection switch needs to be switched to the low-concurrency collection process). In this way, the collection switch value can be updated regularly to timely update the collection switch value when an instantaneous high-concurrency request is detected.
[0050] In the embodiment of the present invention, the preset detection method is a method for detecting the current resource occupancy rate and the current number of requests for claiming rights of the rights issuance system, and the rights issuance system is a certain trading system.
[0051] Optionally, the method for determining the rights collection method also includes: adopting a stress testing strategy to determine the number of concurrent requests and the number of concurrent switchbacks; simulating the number of concurrent request rights collection requests to determine the preset resource threshold and the preset collection threshold; simulating the number of concurrent switchback rights collection requests to determine the preset resource switchback threshold and the preset collection switchback threshold.
[0052] In an embodiment of the present invention, the high concurrency threshold of CPU utilization (i.e., the preset resource threshold) and the high concurrency threshold for receiving TPS (i.e., the preset receiving threshold) and the corresponding high concurrency switchback threshold (i.e., the preset resource switchback threshold and the preset receiving switchback threshold) can be pre-determined through stress testing, and these four thresholds are used as the basis for automatically switching high concurrency and switching back. Specifically, the stress testing strategy can be first adopted to determine the number of concurrent requests and the number of switchback concurrency, and then the preset resource threshold and the preset receiving threshold are determined by simulating the equity collection requests of the number of concurrent requests (i.e., sending the equity collection requests of the number of concurrent requests at the same time), and the preset resource switchback threshold and the preset receiving switchback threshold are determined by simulating the equity collection requests of the number of switchback concurrency (i.e., sending the equity collection requests of the number of switchback concurrency at the same time). In this way, the high concurrency threshold and the high concurrency switchback threshold can be accurately determined.
[0053] Optionally, based on a preset time interval, the step of detecting the current resource occupancy of the rights issuance system and the current number of rights collection requests includes: obtaining log information of the operating system used by the rights issuance system; based on the log information, determining the current CPU utilization of the rights issuance system at the current time point, and characterizing the current CPU utilization as the current resource occupancy; obtaining the number of rights collection requests for the hot key corresponding to the previous time point from the cache database, and characterizing the number of rights collection requests as the current number of rights collection requests.
[0054] In an embodiment of the present invention, the preset detection method is as follows: a code statement for obtaining operating system related information can be written in a certain programming language, and the log information of the operating system used by the equity issuance system can be obtained by using the code statement, and then the current CPU utilization of the equity issuance system at the current time point is determined according to the log information, and the current CPU utilization rate is the current resource occupancy rate. At the same time, the number of equity collection requests for the hot key corresponding to the previous time point can be obtained from the cache database, and the number of equity collection requests is the current number of equity collection requests.
[0055] In the embodiment of the present invention, the current resource occupancy rate and the current number of rights and interests claiming requests can be accurately obtained through the above-mentioned preset detection method.
[0056] In the embodiment of the present invention, since the number of rights collection requests at the current time point has been completed (i.e., rights collection requests are still being received at the current time point), the number of rights collection requests in the previous second is taken as the current number of rights collection requests.
[0057] Exemplarily, the getOperatingSystemMXBean() method in a Java (ie, a programming language) class (eg, java.lang.management.ManagementFactory) is used to obtain operating system related information, and then the getSystemCpuLoad() method is used to obtain the CPU utilization of the current system.
[0058] Optionally, the method for determining the rights collection method also includes: creating a hot key in the cache database at intervals of a preset time unit, and determining the key identifier of the hot key based on the creation time point of the hot key; determining the reception time point of the rights collection request each time a rights collection request is received; determining a target creation time point equal to the reception time point, and increasing the key value of the target hot key with the key identifier as the target creation time point; when the current time point reaches the next reception time point, determining the key value of the target hot key as the number of rights collection requests at the reception time point.
[0059] Figure 2 is an optional flow chart for determining the number of equity claim requests at each time point according to an embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:
[0060] Step S201, creating a hot key in the cache database at every preset time unit interval, and determining a key identifier of the hot key based on the creation time point of the hot key;
[0061] Step S202, each time a benefit claiming request is received, determining the receiving time point of the benefit claiming request;
[0062] Step S203, determining a target creation time point equal to the receiving time point, and adding a key value of a target heat key whose key identifier is the target creation time point;
[0063] Step S204, when the current time point reaches the next receiving time point, the key value of the target heat key is determined as the number of rights collection requests at the receiving time point.
[0064] In an embodiment of the present invention, a hot key key is created in a cache database (i.e., a high-concurrency cache database) at intervals of a preset time unit (e.g., 1 second) (e.g., a key is created every second), and the naming of the key can be distinguished by the date plus the hour, minute, and second, that is, the key identifier of the hot key is determined by the creation time point of the hot key (e.g., the key identifier (name) of a key is **year**month**day*hour*minute*second). Then, each time the claim of the rights is triggered, the value (i.e., the key value) of the corresponding key is accumulated, that is, each time a claim request is received, the receiving time point of the claim request is determined, and the target creation time point equal to the receiving time point is determined to increase the key value of the target hot key whose key identifier is the target creation time point. Afterwards, if the current time point reaches the next receiving time point (i.e., the next preset time unit has been reached, for example, the next second has been reached), the key value of the target hot key can be determined as the number of claim requests at the receiving time point. In this way, the number of equity claim requests at each time point can be stored in the cache database, so that the current number of equity claim requests can be quickly obtained when determining the claim switch value.
[0065] In some optional embodiments, in order to calculate the instantaneous TPS, the retention time of the hot key can be set, and the retention time of each hot key can be determined based on a preset time interval, for example, if the preset time interval is two seconds, the retention time of the hot key can be set to two seconds. In this way, cache space can be saved.
[0066] Step S102: when the current claim switch value is the first switch value, the first claim method is used to issue rights and interests to the target terminal, wherein the first claim method is an asynchronous claim method.
[0067] In step S102, if the current collection switch value is the first switch value, it indicates that the current scenario is highly concurrent, and the first collection method (i.e., asynchronous collection method, which is a highly concurrent collection method) needs to be used to issue rights and interests to the target terminal. In this way, the system can avoid crashes due to a large number of requests pouring in within a short period of time.
[0068] Optionally, the step of issuing rights to the target terminal using the first collection method includes: when a rights collection request is received, performing inventory verification and activity verification on the rights to be collected; when both the inventory verification and the activity verification are passed, deducting the inventory of the rights to be collected, and returning the rights locking information to the target terminal; adding the rights collection request to a preset message queue; when the message consumption thread monitors that there is a rights collection request in the preset message queue, using the message consumption thread to forward the rights collection request to the rights collection platform, wherein the rights collection platform processes the rights collection request and writes the processing result to the preset message queue; when it is detected that the processing result in the preset message queue is a successful collection, the processing result is returned to the target terminal.
[0069] In an embodiment of the present invention, the high-concurrency collection process is as follows: after the customer clicks to collect, an inventory check is performed (i.e., checking whether the inventory of the current equity resource is greater than 0), and an activity and resource check is performed (i.e., checking whether the current activity and the resources required to be issued for the activity are valid) (i.e., when a request for equity collection is received, an inventory check and an activity check are performed on the equity to be collected), and after the check is passed, the inventory is deducted through the flash sale platform, and the customer is prompted that the qualification has been locked, and the collection result will be notified later (i.e., when both the inventory check and the activity check are passed, the inventory is deducted for the equity to be collected, and the equity locking information is returned to the target terminal). In addition, after the flash sale platform makes inventory deductions, the rights collection request is written into the database, and the rights collection request is entered into the message queue (that is, the rights collection request is added to the preset message queue). The message consumer forwards the rights collection request to the third-party platform (that is, the rights collection platform). The third-party platform processes the rights collection request, writes the collection result into the database, and enters the collection result into the message queue (that is, when the message consumption thread monitors that there is a rights collection request in the preset message queue, the message consumption thread is used to forward the rights collection request to the rights collection platform, and the rights collection platform processes the rights collection request and writes the processing result into the preset message queue). The message consumer pushes the success message to the message platform, and the message platform notifies the customer of the message (that is, when it is detected that the processing result in the preset message queue is a successful collection, the processing result is returned to the target terminal).
[0070] In the embodiment of the present invention, the preset message queue may adopt a distributed stream processing queue.
[0071] In the embodiment of the present invention, the high-concurrency collection process is an asynchronous process. The customer only knows that the qualification has been locked, but has not actually received the benefit. In the event of a collection failure, the customer needs to manually re-process it.
[0072] Step S103, when the current collection switch value is the second switch value, the second collection method is used to issue rights and interests to the target terminal, wherein the second collection method is a synchronous collection method, and the concurrency performance of the first collection method is higher than the concurrency performance of the second collection method.
[0073] In step S103, if the current collection switch value is the second switch value, it indicates that the current scenario is low concurrency, and the second collection method (i.e., synchronous collection method, which is a low concurrency collection method) needs to be used to issue rights and interests to the target terminal. In this way, the problem of transaction response delay can be reduced.
[0074] In the embodiment of the present invention, the concurrency performance of the first collection method is higher than the concurrency performance of the second collection method.
[0075] Optionally, the step of issuing rights to the target terminal using the second collection method includes: when a rights collection request is received, performing inventory verification and activity verification on the rights to be collected; when both the inventory verification and the activity verification are passed, performing inventory deduction on the rights to be collected, and forwarding the rights collection request to the rights collection platform, wherein the rights collection platform distributes the rights to the target terminal.
[0076] In an embodiment of the present invention, the low-concurrency collection process is as follows: after the customer clicks to collect, inventory verification is performed, and activity and resource verification is performed (that is, when a benefit collection request is received, inventory verification and activity verification are performed on the benefit to be collected). After the verification is passed, inventory deduction is performed through the flash sale platform, and the collection details are written into the database. At the same time, the benefit collection request is forwarded to the third-party platform. The third-party platform processes the benefit collection request, writes the collection result into the database, and displays the collection result directly on the page (that is, when both the inventory verification and the activity verification are passed, the inventory deduction is performed on the benefit to be collected, and the benefit collection request is forwarded to the benefit collection platform, and the benefit collection platform distributes the benefit to the target terminal).
[0077] In the embodiment of the present invention, the low-concurrency collection process is a synchronous process. The customer can see the success or failure of the collection in real time, and the interactive experience is better. After success, the result can be viewed synchronously on the third-party platform.
[0078] In an embodiment of the present invention, an automatic switching mechanism between high-concurrency issuance rights and low-concurrency issuance rights is established, which can identify instantaneous high-concurrency request situations, that is, the system's resource usage and the current collection request TPS can be detected first, and then the corresponding threshold is set to determine whether the current limiting threshold is triggered (that is, the resource occupancy is greater than the threshold or the TPS is greater than the threshold). If triggered, it indicates that a high-concurrency request situation has occurred, and it is necessary to switch to a high-concurrency collection process. In this way, when a high-concurrency request occurs, it is possible to switch from a low-concurrency collection process to a high-concurrency collection process in a timely manner, thereby improving concurrency performance and customer collection experience.
[0079] The following is a detailed description in conjunction with another embodiment.
[0080] Embodiment 2
[0081] The device for determining a rights collection method provided in this embodiment includes multiple implementation units, each of which corresponds to each implementation step in the above-mentioned embodiment 1.
[0082] Figure 3 is a schematic diagram of a device for determining an optional benefit claiming method according to an embodiment of the present invention, such as Figure 3 As shown, the determining device may include: a determining unit 30 , a first issuing unit 31 , and a second issuing unit 32 .
[0083] The determining unit 30 is used to determine the current claim switch value when receiving the benefit claim request sent by the target terminal, wherein the current claim switch value is determined based on the current resource occupancy rate and the current number of benefit claim requests;
[0084] The first issuing unit 31 is used to issue the rights and interests to the target terminal in a first receiving mode when the current receiving switch value is the first switch value, wherein the first receiving mode is an asynchronous receiving mode;
[0085] The second issuing unit 32 is used to issue rights to the target terminal using a second receiving method when the current receiving switch value is the second switch value, wherein the second receiving method is a synchronous receiving method, and the concurrency performance of the first receiving method is higher than the concurrency performance of the second receiving method.
[0086] The above-mentioned determination device can determine the current collection switch value through the determination unit 30 when receiving the rights collection request sent by the target terminal, and use the first collection method to issue rights to the target terminal through the first issuance unit 3 when the current collection switch value is the first switch value, and use the second collection method to issue rights to the target terminal through the second issuance unit 32 when the current collection switch value is the second switch value. In the embodiment of the present invention, the switch value of the current collection switch can be determined in advance according to the current resource occupancy rate of the trading system and the current number of rights collection requests, and then the rights collection method can be selected according to the current collection switch value, so that when an instantaneous high-concurrency request occurs, it can be switched to a high-concurrency rights collection process in time to collect rights, so as to avoid system crashes, and can use a low-concurrency rights collection process to collect rights in low-concurrency scenarios, so as to effectively reduce the collection response delay, thereby solving the technical problem in the related technology that there is a risk of trading system crash or slow transaction response when collecting rights resources.
[0087] Optionally, the determination unit includes: a first detection module, used to detect the current resource occupancy rate and the current number of equity collection requests of the equity issuance system based on a preset time interval; a first update module, used to update the current collection switch value to a first switch value when the current resource occupancy rate is greater than a preset resource threshold or the current number of equity collection requests is greater than a preset collection threshold; a second update module, used to update the current collection switch value to a second switch value when the current resource occupancy rate is less than a preset resource cutback threshold and the current number of equity collection requests is less than a preset cutback threshold.
[0088] Optionally, the first detection module includes: a first acquisition sub-module, used to obtain log information of the operating system used by the rights issuance system; a first determination sub-module, used to determine the current CPU utilization of the rights issuance system at the current time point based on the log information, and represent the current CPU utilization as the current resource occupancy rate; a second acquisition sub-module, used to obtain the number of rights collection requests for the hot key corresponding to the previous time point from the cache database, and represent the number of rights collection requests as the current number of rights collection requests.
[0089] Optionally, the determination device also includes: a first creation module, which is used to create a hot key in the cache database at intervals of a preset time unit, and determine the key identifier of the hot key based on the creation time point of the hot key; a first determination module, which is used to determine the receiving time point of the benefit claim request each time a benefit claim request is received; a second determination module, which is used to determine a target creation time point equal to the receiving time point, and increase the key value of the target hot key with the key identifier as the target creation time point; and a third determination module, which is used to determine the key value of the target hot key as the number of benefit claim requests at the receiving time point when the current time point reaches the next receiving time point.
[0090] Optionally, the first issuance unit includes: a first verification module, which is used to perform inventory verification and activity verification on the rights to be collected when a rights collection request is received; a first deduction module, which is used to perform inventory deduction on the rights to be collected when both the inventory verification and the activity verification are passed, and return the rights locking information to the target terminal; a first adding module, which is used to add the rights collection request to a preset message queue; a first forwarding module, which is used to forward the rights collection request to the rights collection platform using the message consumption thread when the message consumption thread monitors that there is a rights collection request in the preset message queue, wherein the rights collection platform processes the rights collection request and writes the processing result to the preset message queue; a first return module, which is used to return the processing result to the target terminal when it is detected that the processing result in the preset message queue is a successful collection.
[0091] Optionally, the second issuance unit includes: a second verification module, which is used to perform inventory verification and activity verification on the rights to be received when a rights collection request is received; a second deduction module, which is used to perform inventory deduction on the rights to be received when both the inventory verification and the activity verification are passed, and forward the rights collection request to the rights collection platform, wherein the rights collection platform distributes the rights to the target terminal.
[0092] Optionally, the determination device also includes: a fourth determination module, used to adopt a stress testing strategy to determine the number of concurrent requests and the number of concurrent switchbacks; a fifth determination module, used to simulate the rights and interests collection requests of the concurrent request number, determine the preset resource threshold and the preset collection threshold; a sixth determination module, used to simulate the rights and interests collection requests of the concurrent number of switchbacks, determine the preset resource switchback threshold and the preset collection switchback threshold.
[0093] The above-mentioned determination device may also include a processor and a memory. The above-mentioned determination unit 30, the first issuance unit 31, the second issuance unit 32, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0094] The processor includes a kernel, and the kernel retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to use the first receiving method to issue rights to the target terminal when the current receiving switch value is the first switch value, and use the second receiving method to issue rights to the target terminal when the current receiving switch value is the second switch value.
[0095] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (fl ash RAM), and the memory includes at least one storage chip.
[0096] The present invention also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: when a rights collection request sent by a target terminal is received, the current collection switch value is determined, and when the current collection switch value is a first switch value, the first collection method is used to issue rights to the target terminal; when the current collection switch value is a second switch value, the second collection method is used to issue rights to the target terminal.
[0097] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned method for determining the rights and interests collection method.
[0098] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned method for determining the benefit collection method.
[0099] Figure 4 is a hardware structure block diagram of an electronic device (or mobile device) for determining a method for receiving benefits according to an embodiment of the present invention. Figure 4 As shown, the electronic device may include one or more processors (e.g., Figure 4 The processor 402a, processor 402b, ..., processor 402n, etc., which may include but are not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 404 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown.
[0100] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0101] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0102] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0103] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0104] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0105] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0106] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for determining a method for receiving benefits, characterized in that: include: When receiving a benefit claiming request sent by a target terminal, determining a current claiming switch value, wherein the current claiming switch value is determined based on a current resource occupancy rate and a current number of benefit claiming requests; When the current claim switch value is the first switch value, the first claim method is used to issue the rights and interests to the target terminal, wherein the first claim method is an asynchronous claim method; When the current collection switch value is the second switch value, a second collection method is used to issue rights and interests to the target terminal, wherein the second collection method is a synchronous collection method, and the concurrency performance of the first collection method is higher than the concurrency performance of the second collection method.
2. The determination method according to claim 1, characterized in that: The steps to determine the current pick-up switch value include: Based on a preset time interval, detecting the current resource occupancy rate of the equity issuance system and the current number of equity claiming requests; When the current resource occupancy rate is greater than a preset resource threshold or the current number of equity claiming requests is greater than a preset claiming threshold, updating the current claiming switch value to the first switch value; When the current resource occupancy rate is less than the preset resource switching back threshold and the current number of rights claiming requests is less than the preset claim switching back threshold, the current claiming switch value is updated to the second switch value.
3. The determination method according to claim 2, characterized in that: The step of detecting the current resource occupancy rate and the current number of equity claiming requests of the equity issuance system based on a preset time interval includes: Obtaining log information of the operating system used by the equity issuance system; Based on the log information, determine the current CPU utilization of the equity issuance system at the current time point, and characterize the current CPU utilization as the current resource occupancy; The number of rights claiming requests corresponding to the hot key at the previous time point is obtained from the cache database, and the number of rights claiming requests is represented as the current number of rights claiming requests.
4. The determination method according to claim 3, characterized in that: The method for determining the method of receiving the benefits also includes: At each preset time unit interval, a hot key is created in the cache database, and a key identifier of the hot key is determined based on a creation time point of the hot key; Each time a request for claiming the rights is received, determining a time point at which the request for claiming the rights is received; Determine a target creation time point equal to the receiving time point, and increase the key value of the target heat key whose key identifier is the target creation time point; When the current time point reaches the next receiving time point, the key value of the target heat key is determined as the number of rights collection requests at the receiving time point.
5. The determination method according to claim 1, characterized in that: The step of issuing the rights and interests to the target terminal in the first receiving method includes: When receiving the claim request, perform inventory verification and activity verification on the claim; When both the inventory verification and the activity verification are passed, the inventory of the rights to be collected is deducted, and the rights locking information is returned to the target terminal; Add the rights claim request to the preset message queue; When the message consumption thread monitors that the preset message queue has the rights claim request, the message consumption thread is used to forward the rights claim request to the rights claim platform, wherein the rights claim platform processes the rights claim request and writes the processing result to the preset message queue; When it is detected that the processing result in the preset message queue is successfully received, the processing result is returned to the target terminal.
6. The determination method according to claim 1, characterized in that: The step of issuing the rights and interests to the target terminal by using the second receiving method includes: When receiving the claim request, perform inventory verification and activity verification on the claim; When both the inventory verification and the activity verification are passed, the inventory of the rights to be collected is deducted, and the rights collection request is forwarded to the rights collection platform, wherein the rights collection platform distributes the rights to the target terminal.
7. The determination method according to claim 1, characterized in that: The method for determining the method of receiving the benefits also includes: Use stress testing strategies to determine the number of concurrent requests and the number of concurrent switchbacks; Simulate the equity claiming requests of the number of concurrent requests to determine the preset resource threshold and the preset claiming threshold; Simulate the switchback and concurrent number of equity claim requests to determine a preset resource switchback threshold and a preset claim switchback threshold.
8. A device for determining a method for receiving benefits, characterized in that: include: A determination unit, configured to determine a current claim switch value when receiving a claim request sent by a target terminal, wherein the current claim switch value is determined based on a current resource occupancy rate and a current number of claim requests; A first issuing unit, configured to issue the rights and interests to the target terminal in a first receiving method when the current receiving switch value is a first switch value, wherein the first receiving method is an asynchronous receiving method; The second issuing unit is used to issue rights and interests to the target terminal using a second receiving method when the current receiving switch value is a second switch value, wherein the second receiving method is a synchronous receiving method, and the concurrency performance of the first receiving method is higher than the concurrency performance of the second receiving method.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for determining the rights and interests collection method described in any one of claims 1 to 7.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining the benefit collection method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Block chain-based rights and interests issuing method and device, electronic device and storage medium
CN110148017A
User rights and interests information processing method and device and electronic equipment
CN111415179A
User right card management method and device
CN114549069A
Right and interest issuing method and device, right and interest platform server and storage medium
CN116976969A
Electronic rights issuing method and device, electronic equipment and storage medium
CN117934075A
