Method and device for determining equity taking mode, electronic equipment and storage medium

By detecting the resource occupancy rate and request count of the trading system, and dynamically switching between asynchronous and synchronous acquisition methods, the problems of trading system crashes and response delays during the acquisition of equity resources were solved, achieving stability under high concurrency and fast response under low concurrency.

CN118660084BActive Publication Date: 2025-12-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410682753.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2025-12-09
Estimated Expiration
2044-05-29

AI Technical Summary

Technical Problem

In the process of claiming equity resources, existing technologies have the risk of transaction system crashes or response delays, especially when there are high concurrency requests, they cannot switch to a high concurrency distribution process in a timely manner.

Method used

By monitoring the resource occupancy rate and the number of rights claim requests in the trading system, the system dynamically switches between asynchronous and synchronous claiming methods. The asynchronous claiming method avoids crashes under high concurrency, while the synchronous method reduces response latency. The system automatically switches between these methods by setting traffic thresholds using preset time intervals and stress testing strategies.

Benefits of technology

It effectively prevented the transaction system from crashing, improved concurrency performance in high-concurrency scenarios, reduced response latency in low-concurrency scenarios, and improved the stability and efficiency of rights and benefits redemption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118660084B_ABST
    Figure CN118660084B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for determining a right and interest collection mode, electronic equipment and a storage medium, and relates to the field of financial technology or other related fields. The method comprises the following steps: in the case that a right and interest collection request sent by a target terminal is received, a current collection switch value is determined; in the case that the current collection switch value is a first switch value, a first collection mode is used to issue the right and interest to the target terminal; and in the case that the current collection switch value is a second switch value, a second collection mode is used to issue the right and interest to the target terminal. The application solves the technical problem that the transaction system is prone to collapse or the transaction response is slow when the right and interest resources are collected in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of financial technology, in particular to a method and device for determining a rights collection method, an electronic device and a storage medium. BACKGROUND

[0002] Currently, with the development of Internet technology, more and more financial institutions choose to issue rights resources to customers on the network to promote product sales and improve customer loyalty. However, in the process of issuing rights resources, there may be a high-concurrency request situation, that is, a large number of customer collection requests need to be processed in a short time, for example, during a promotion or a specific holiday, a large number of customers simultaneously collect rights resources.

[0003] In related technologies, issuing rights resources in a low-concurrency manner may cause the transaction system to crash in an instant when a large number of requests occur, and issuing rights resources in a high-concurrency manner may cause response delays during customer collection.

[0004] Therefore, there is an urgent need for a method for determining a rights collection method to solve the problem of transaction system crash risk or slow transaction response.

[0005] To solve the above problems, no effective solution has been proposed so far. SUMMARY

[0006] The embodiments of the present application provide a method and device for determining a rights collection method, an electronic device and a storage medium to at least solve the technical problems of the related art that the transaction system is prone to crash or the transaction response is slow when collecting rights resources.

[0007] According to an aspect of an embodiment of the present application, a method for determining a rights collection method is provided, comprising: determining 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 a current resource occupancy rate and a current number of rights collection requests; in a case where the current collection switch value is a first switch value, issuing rights to the target terminal using a first collection method, wherein the first collection method is an asynchronous collection method; in a case where the current collection switch value is a second switch value, issuing rights to the target terminal using a second collection method, wherein the second collection method is a synchronous collection method, and the concurrency performance of the first collection method is higher than that of the second collection method.

[0008] Further, the step of determining the current taking switch value comprises: detecting the current resource occupancy rate and the current benefit taking request number of the benefit issuing system based on a preset time interval; updating the current taking switch value to the first switch value in a case that the current resource occupancy rate is greater than a preset resource threshold or the current benefit taking request number is greater than a preset taking threshold; updating the current taking switch value to the second switch value in a case that the current resource occupancy rate is less than a preset resource rollback threshold and the current benefit taking request number is less than a preset taking rollback threshold.

[0009] Further, the step of detecting the current resource occupancy rate and the current benefit taking request number of the benefit issuing system based on a preset time interval comprises: obtaining log information of an operating system used by the benefit issuing system; determining a current CPU utilization rate of the benefit issuing system at a current time point based on the log information, and taking the current CPU utilization rate as the current resource occupancy rate; obtaining a benefit taking request number of a hotness key corresponding to a previous time point from a cache database, and taking the benefit taking request number as the current benefit taking request number.

[0010] Further, the method for determining the benefit taking mode further comprises: creating a hotness key in the cache database every interval of a preset time length unit, and determining a key identifier of the hotness key at a creation time point of the hotness key; determining a reception time point of the benefit taking request every time a benefit taking request is received; determining a target creation time point equal to the reception time point, and increasing a key value of a target hotness key of the target creation time point; in a case that the current time point reaches a next reception time point, determining the key value of the target hotness key as a benefit taking request number of the reception time point.

[0011] Further, the step of issuing the benefit for the target terminal in the first taking mode comprises: performing inventory checking and activity checking on the benefit to be taken in a case that the benefit taking request is received; performing inventory deduction on the benefit to be taken, and returning benefit locking information to the target terminal in a case that both the inventory checking and the activity checking are passed; adding the benefit taking request to a preset message queue; forwarding the benefit taking request to a benefit taking platform by using a message consumption thread in a case that the message consumption thread listens that the preset message queue has the benefit taking request, wherein the benefit taking platform processes the benefit taking request, and writes a processing result to the preset message queue; returning the processing result to the target terminal in a case that the processing result in the preset message queue is successful taking.

[0012] Further, the step of issuing the benefit to the target terminal by the second taking mode comprises: in the case that the benefit taking request is received, performing inventory checking and activity checking on the benefit to be taken; in the case that the inventory checking and the activity checking are both passed, performing inventory deduction on the benefit to be taken, and forwarding the benefit taking request to a benefit taking platform, wherein the benefit taking platform issues the benefit to the target terminal.

[0013] Further, the method for determining the benefit taking mode further comprises: determining a number of concurrent requests and a number of concurrent back switches by using a stress test strategy; simulating the number of concurrent requests of the benefit taking request to determine a preset resource threshold and a preset taking threshold; and simulating the number of concurrent back switches of the benefit taking request to determine a preset resource back switch threshold and a preset taking back switch threshold.

[0014] According to another aspect of the embodiment of the present application, a device for determining a benefit taking mode is further provided, comprising: a determination unit configured to determine a current taking switch value in the case that a benefit taking request sent by a target terminal is received, wherein the current taking switch value is determined based on a current resource occupancy rate and a current number of benefit taking requests; a first issuing unit configured to issue a benefit to the target terminal by a first taking mode in the case that the current taking switch value is a first switch value, wherein the first taking mode is an asynchronous taking mode; and a second issuing unit configured to issue a benefit to the target terminal by a second taking mode in the case that the current taking switch value is a second switch value, wherein the second taking mode is a synchronous taking mode, and a concurrent performance of the first taking mode is higher than that of the second taking mode.

[0015] Further, the determination unit comprises: a first detection module configured to detect the current resource occupancy rate and the current number of benefit taking requests of a benefit issuing system based on a preset time interval; a first updating module configured to update the current taking switch value to the first switch value in the case that the current resource occupancy rate is greater than a preset resource threshold or the current number of benefit taking requests is greater than a preset taking threshold; and a second updating module configured to update the current taking switch value to the second switch value in the case that the current resource occupancy rate is less than a preset resource back switch threshold and the current number of benefit taking requests is less than a preset taking back switch threshold.

[0016] Further, the first detection module comprises: a first acquisition submodule, configured to acquire log information of an operating system used by the benefit issuing system; a first determination submodule, configured to determine a current CPU utilization of the benefit issuing system at a current time point based on the log information, and represent the current CPU utilization as the current resource occupancy rate; and a second acquisition submodule, configured to acquire, from a cache database, a number of benefit taking requests of a hotness key corresponding to a previous time point, and represent the number of benefit taking requests as the current number of benefit taking requests.

[0017] Further, the determination apparatus further comprises: a first creation module, configured to create a hotness key in the cache database every interval of a preset time length unit, and determine a key identifier of the hotness key according to a creation time point of the hotness key; a first determination module, configured to determine a receiving time point of the benefit taking request every time the benefit taking request is received; a second determination module, configured to determine a target creation time point equal to the receiving time point, and increase a key value of a target hotness key of the target creation time point as the key identifier; and a third determination module, configured to determine the key value of the target hotness key as the number of benefit taking requests of the receiving time point in a case where the current time point reaches a next receiving time point.

[0018] Further, the first issuing unit comprises: a first verification module, configured to, in a case where the benefit taking request is received, perform inventory verification and activity verification on the benefit to be taken; a first deduction module, configured to, in a case where the inventory verification and the activity verification are both passed, perform inventory deduction on the benefit to be taken, and return benefit locking information to the target terminal; a first adding module, configured to add the benefit taking request to a preset message queue; a first forwarding module, configured to, in a case where a message consumption thread listens to the preset message queue and finds that the benefit taking request exists in the preset message queue, forward, by using the message consumption thread, the benefit taking request to a benefit taking platform, wherein the benefit taking platform processes the benefit taking request, and writes a processing result into the preset message queue; and a first returning module, configured to, in a case where it is detected that the processing result in the preset message queue is successful taking, return the processing result to the target terminal.

[0019] Further, the second issuing unit comprises: a second verification module, configured to, in a case where the benefit taking request is received, perform inventory verification and activity verification on the benefit to be taken; a second deduction module, configured to, in a case where the inventory verification and the activity verification are both passed, perform inventory deduction on the benefit to be taken, and forward the benefit taking request to a benefit taking platform, wherein the benefit taking platform issues the benefit to the target terminal.

[0020] Further, the determining apparatus further comprises: a fourth determining module, configured to determine the number of concurrent requests and the number of concurrent back-switching by using a pressure test strategy; a fifth determining module, configured to simulate the number of concurrent requests for the benefit taking request, and determine the preset resource threshold and the preset taking threshold; and a sixth determining module, configured to simulate the number of concurrent back-switching for the benefit taking request, and determine the preset resource back-switching threshold and the preset taking back-switching threshold.

[0021] According to another aspect of the embodiments of the present application, a computer readable storage medium is also provided, which comprises a stored computer program, wherein the computer program, when executed, controls the device where the computer readable storage medium is located to perform the determining method of any one of the above-mentioned benefit taking manners.

[0022] According to another aspect of the embodiments of the present application, an electronic device is also provided, which comprises one or more processors and a memory, the memory being configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the determining method of any one of the above-mentioned benefit taking manners.

[0023] In the present application, in the case that a benefit taking request sent by a target terminal is received, a current taking switch value is determined, in the case that the current taking switch value is a first switch value, a first taking manner is used to issue the benefit to the target terminal, and in the case that the current taking switch value is a second switch value, a second taking manner is used to issue the benefit to the target terminal.

[0024] In the present application, the switch value of the current taking switch can be determined in advance according to the current resource occupancy rate of the transaction system and the current number of benefit taking requests, and then the benefit taking manner is selected according to the current taking switch value, so that the benefit taking can be switched to the high-concurrency benefit taking process in time when the instantaneous high-concurrency request occurs, to avoid system collapse, and the low-concurrency benefit taking process can be used to take the benefit in the low-concurrency scenario, to effectively reduce the taking response delay, thereby solving the technical problems in the related art that the transaction system is prone to collapse or the transaction response is slow when the benefit resource is taken. BRIEF DESCRIPTION OF DRAWINGS

[0025] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and serve to explain the present application. In the drawings:

[0026] Figure 1 is a flowchart of a determining method of an optional benefit taking manner according to an embodiment of the present application;

[0027] Figure 2 is a flow chart of an optional determination of the number of benefit collection requests at each time point according to an embodiment of the present application;

[0028] Figure 3 is a schematic diagram of an optional determination device of a benefit collection mode according to an embodiment of the present application;

[0029] Figure 4 is a hardware structure block diagram of an electronic device (or a mobile device) for a determination method of a benefit collection mode according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the personnel in the art better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0032] It should be noted that the determination method of the benefit collection mode and the device thereof in the present application can be used in the case of determining the benefit collection mode in the field of financial technology, and can also be used in the case of determining the benefit collection mode in any field other than the field of financial technology. The application field of the determination method of the benefit collection mode and the device thereof in the present application is not limited.

[0033] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and related to the present application are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards in the relevant region, necessary security measures are taken, it does not violate public order and good custom, and provides corresponding operation portal for user to choose authorization or refusal. For example, an interface is provided between the system and the related users or agencies, and before obtaining the relevant information, the interface needs to send a request to the aforementioned user or agency, and after receiving the consent information feedback from the aforementioned user or agency, the relevant information is obtained.

[0034] In order to solve the problem that in the scene of instant high concurrency request, it is unable to switch from low concurrency benefit distribution process to high concurrency benefit distribution process in time, which easily leads to system crash, the present application provides an automatic switching mechanism between high concurrency benefit distribution and low concurrency benefit distribution, by detecting the usage of system resources and the current hotness of benefit collection, and setting corresponding flow threshold, to determine whether the flow threshold is triggered, if triggered, switch to high concurrency distribution process for distribution, and when the flow decreases, it can automatically switch to low concurrency distribution process for distribution.

[0035] The present application will be described in detail below in conjunction with various embodiments.

[0036] Embodiment one

[0037] According to the embodiment of the present application, an embodiment of a method for determining a benefit collection mode 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 the 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 flowchart of an optional method for determining a benefit collection mode according to an embodiment of the present application, as shown in Figure 1 The method comprises the following steps:

[0039] Step S101, in the case of receiving a benefit 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 benefit collection request number.

[0040] Step S102, in the case of the current collection switch value being a first switch value, using a first collection mode to distribute benefits to the target terminal, wherein the first collection mode is an asynchronous collection mode.

[0041] In a case where the current taking switch value is the second switch value, the second taking mode is used to issue the benefit to the target terminal, and the second taking mode is a synchronous taking mode, and the concurrency performance of the first taking mode is higher than that of the second taking mode.

[0042] Through the above steps, in a case where the benefit taking request sent by the target terminal is received, the current taking switch value is determined, in a case where the current taking switch value is the first switch value, the first taking mode is used to issue the benefit to the target terminal, and in a case where the current taking switch value is the second switch value, the second taking mode is used to issue the benefit to the target terminal. In the embodiment of the present application, the switch value of the current taking switch can be determined in advance according to the current resource occupancy rate and the current benefit taking request number of the transaction system, and then the benefit taking mode is selected according to the current taking switch value, so that the benefit taking process can be switched to the high-concurrency benefit taking process in time when a high-concurrency request occurs, so as to avoid system collapse, and the low-concurrency benefit taking process can be used to take the benefit in a low-concurrency scenario, so as to effectively reduce the taking response delay, thereby solving the technical problems that the transaction system is prone to collapse or the transaction response is slow in the related art when the benefit resource is taken.

[0043] The embodiment of the present application will be described in detail below in combination with the above steps.

[0044] In a case where the benefit taking request sent by the target terminal is received, the current taking switch value is determined, and the current taking switch value is determined based on the current resource occupancy rate and the current benefit taking request number.

[0045] In step S101, when the transaction system receives the benefit taking request sent by the target terminal, the current taking switch value can be determined first, and the current taking switch value is determined based on the current resource occupancy rate and the current benefit taking request number. The taking switch value is divided into two values, which can be identified by different numbers or characters, for example, taking switch value = 1 or taking switch value = 0, which represents different processing flows for the benefit taking request.

[0046] In the embodiment of the present application, the benefit taking request can contain a benefit resource identifier for indicating the benefit resource to be taken, and the benefit resource includes: discount coupons, instant-off coupons, etc.

[0047] For example, when the customer clicks to take, the background of the transaction system first queries the high-concurrency taking switch (i.e. the current taking switch value), and determines whether to perform the high-concurrency taking process (i.e. the first taking mode) or the normal taking process (i.e. the second taking mode, which is also a low-concurrency taking process) according to the switch value.

[0048] Optionally, the step of determining the current taking switch value comprises: detecting the current resource occupancy rate of the benefit issuing system and the current benefit taking request number based on a preset time interval; updating the current taking switch value to the first switch value in a case that the current resource occupancy rate is greater than a preset resource threshold or the current benefit taking request number is greater than a preset taking threshold; updating the current taking switch value to the second switch value in a case that the current resource occupancy rate is less than a preset resource rollback threshold and the current benefit taking request number is less than a preset taking rollback threshold.

[0049] In the embodiment of the application, a timing task can be designed to be executed once every preset time (for example, every 2 seconds, which can be adjusted according to requirements), and a preset detection method is used to obtain the current resource occupancy rate (i.e., the current CPU (Central Processing Unit, i.e., processor) utilization rate) of the benefit issuing system and the current benefit taking request number (i.e., the TPS (Transactions Per Second, i.e., transactions per second) of taking the benefit resource in the last second) when the timing task is executed. If the CPU utilization rate exceeds the preset resource threshold or the TPS of taking the benefit resource exceeds the preset taking threshold, the current taking switch value is updated to the first switch value (i.e., the high-concurrency taking switch needs to be switched to the high-concurrency taking process). If the CPU utilization rate is lower than the preset resource rollback threshold and the TPS of taking the benefit resource is also lower than the preset taking rollback threshold, the current taking switch value is updated to the second switch value (i.e., the high-concurrency taking switch needs to be switched to the low-concurrency taking process). In this way, the taking switch value can be updated in a timely manner to update the taking switch value in a timely manner when a transient high-concurrency request is monitored.

[0050] In the embodiment of the application, the preset detection method is a method for detecting the current resource occupancy rate of the benefit issuing system and the current benefit taking request number, and the benefit issuing system is a certain transaction system.

[0051] Optionally, the method for determining the benefit taking mode further comprises: determining the number of concurrent requests and the number of rollback concurrent requests by using a stress test strategy; simulating the benefit taking requests of the number of concurrent requests to determine the preset resource threshold and the preset taking threshold; and simulating the benefit taking requests of the number of rollback concurrent requests to determine the preset resource rollback threshold and the preset taking rollback threshold.

[0052] In the embodiment of the present application, the high concurrency threshold of CPU utilization (i.e., the preset resource threshold) and the high concurrency threshold of TPS (i.e., the preset TPS threshold) and the corresponding high concurrency switching threshold (i.e., the preset resource switching threshold and the preset TPS switching threshold) can be determined in advance through stress testing, and the four thresholds are used as the basis for automatic switching of high concurrency and switching back. Specifically, the stress testing strategy can be used to determine the number of concurrent requests and the number of switching back concurrent requests, and then the benefit withdrawal request with the number of concurrent requests is simulated to determine the preset resource threshold and the preset TPS threshold (i.e., the benefit withdrawal request with the number of concurrent requests is sent at the same time), and the benefit withdrawal request with the number of switching back concurrent requests is simulated to determine the preset resource switching threshold and the preset TPS switching threshold. In this way, the high concurrency threshold and the high concurrency switching threshold can be accurately determined.

[0053] Optionally, based on the preset time interval, the step of detecting the current resource occupancy rate of the benefit distribution system and the current number of benefit withdrawal requests comprises: obtaining log information of an operating system used by the benefit distribution system; determining a current CPU utilization rate of the benefit distribution system at a current time point based on the log information, and representing the current CPU utilization rate as the current resource occupancy rate; obtaining the number of benefit withdrawal requests of the hotness key corresponding to the previous time point from the cache database, and representing the number of benefit withdrawal requests as the current number of benefit withdrawal requests.

[0054] In the embodiment of the present application, the preset detection method is as follows: a code statement for obtaining operating system related information can be written in a certain programming language, the log information of the operating system used by the benefit distribution system is obtained by using the code statement, and then the current CPU utilization rate of the benefit distribution 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 benefit withdrawal requests of the hotness key corresponding to the previous time point can be obtained from the cache database, and the number of benefit withdrawal requests is the current number of benefit withdrawal requests.

[0055] In the embodiment of the present application, the current resource occupancy rate and the current number of benefit withdrawal requests can be accurately obtained by using the above-mentioned preset detection method.

[0056] In the embodiment of the present application, since the number of benefit withdrawal requests at the current time point is in the process of being counted (i.e., the benefit withdrawal request is still being received at the current time point), the number of benefit withdrawal requests of the previous second is used as the current number of benefit withdrawal requests.

[0057] Exemplarily, the operating system related information is acquired by using a getOperatingSystemMXBean() method in a Java (i.e., a programming language) class (such as java.lang.management.ManagementFactory), and the CPU utilization of the current system is acquired by using a getSystemCpuLoad() method therein.

[0058] Optionally, the method for determining the benefit taking manner further includes: creating a hotness key in the cache database every interval of a preset time length unit, and determining a key identifier of the hotness key according to a creation time point of the hotness key; determining a receiving time point of a benefit taking request every time a benefit taking request is received; determining a target creation time point equal to the receiving time point, and increasing a key value of a target hotness key with the key identifier as the target creation time point; and in a case where a current time point reaches a next receiving time point, determining the key value of the target hotness key as a benefit taking request number of the receiving time point.

[0059] Figure 2 is a flow chart of determining the benefit taking request number of each time point according to an embodiment of the present application, as shown in Figure 2 The method includes the following steps:

[0060] In step S201, a hotness key is created in the cache database every interval of a preset time length unit, and a key identifier of the hotness key is determined according to a creation time point of the hotness key.

[0061] In step S202, a receiving time point of a benefit taking request is determined every time a benefit taking request is received.

[0062] In step S203, a target creation time point equal to the receiving time point is determined, and a key value of a target hotness key with the key identifier as the target creation time point is increased.

[0063] In step S204, in a case where a current time point reaches a next receiving time point, the key value of the target hotness key is determined as a benefit taking request number of the receiving time point.

[0064] In the embodiment of the present application, every interval of a preset time length unit (for example, 1 second), a hotness key (for example, a key is created every second) is created in the cache database (that is, a kind of high concurrency cache database), the naming of the key can be distinguished according to the date plus the time, that is, the key identification (for example, the key identification (name) of a certain key is ** year ** month ** day * hour * minute * second) is determined according to the creation time point of the created hotness key. Then every time the benefit is triggered, the value (that is, the key value) of the corresponding key is accumulated, that is, every time a benefit request is received, the receiving time point of the benefit request is determined, and the target creation time point equal to the receiving time point is determined, so as to increase the key value of the target hotness key with the target creation time point as the key identification. After that, if the current time point reaches the next receiving time point (that is, the next preset time length unit has been reached, for example, the next second is reached), the key value of the target hotness key can be determined as the number of benefit request at the receiving time point. In this way, the number of benefit requests at each time point can be stored in the cache database, so as to quickly obtain the current number of benefit requests when determining the value of the take-up switch.

[0065] In some optional embodiments, since the instantaneous TPS is calculated, the retention time of the hotness key can be set, and the retention time of each hotness key can be determined based on the preset time interval, for example, the preset time interval is two seconds, and the retention time of the hotness key can be set to two seconds. In this way, the cache space can be saved.

[0066] Step S102, in the case that the current take-up switch value is the first switch value, the first take-up mode is used to issue the benefit to the target terminal, wherein the first take-up mode is an asynchronous take-up mode.

[0067] In step S102, if the current take-up switch value is the first switch value, it indicates that the current is in a high concurrency scenario, and the first take-up mode (that is, an asynchronous take-up mode, which is a kind of high concurrency take-up mode) is used to issue the benefit to the target terminal. In this way, the system can be prevented from crashing due to a large number of requests in a short time.

[0068] Optionally, the step of issuing the interest to the target terminal in the first collection mode comprises: in the case of receiving the interest collection request, checking the inventory and the activity of the interest to be collected; in the case of passing the inventory and the activity check, deducting the inventory of the interest to be collected, and returning the interest locking information to the target terminal; adding the interest collection request to the preset message queue; in the case of the message consumption thread detecting that the preset message queue has the interest collection request, forwarding the interest collection request to the interest collection platform by using the message consumption thread, wherein the interest collection platform processes the interest collection request, and writes the processing result to the preset message queue; and in the case of detecting that the processing result in the preset message queue is successful collection, returning the processing result to the target terminal.

[0069] In the embodiment of the application, the high-concurrency collection process is as follows: after the customer clicks to collect, inventory checking (i.e., checking whether the current interest resource inventory is greater than 0) and activity and resource checking (i.e., checking whether the current activity and the resource to be issued by the activity are valid) are performed (i.e., in the case of receiving the interest collection request, checking the inventory and the activity of the interest to be collected), and then, after the checking passes, inventory deduction is performed by the killing platform, and the customer is prompted that the qualification has been locked, and the collection result will be notified later (i.e., in the case of passing the inventory and the activity check, deducting the inventory of the interest to be collected, and returning the interest locking information to the target terminal). Moreover, after the inventory deduction is performed by the killing platform, the interest collection request is written to the database, and the interest collection request is put into the message queue (i.e., the interest collection request is added to the preset message queue), the interest collection request is forwarded to the third-party platform (i.e., the interest collection platform) by the message consumer, the third-party platform processes the interest collection request, the collection result is written to the database, and the collection result is put into the message queue (i.e., in the case of the message consumption thread detecting that the preset message queue has the interest collection request, the interest collection request is forwarded to the interest collection platform by using the message consumption thread, the interest collection platform processes the interest collection request, and the processing result is written to 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 (i.e., in the case of detecting that the processing result in the preset message queue is successful collection, the processing result is returned to the target terminal).

[0070] In the embodiment of the application, the preset message queue can adopt a distributed stream processing queue.

[0071] In the embodiment of the application, the high-concurrency collection process belongs to an asynchronous process, the customer only knows that the qualification is locked, and does not actually have it, and the customer needs to manually handle the collection failure.

[0072] In step S103, if the current taking switch value is the second switch value, it indicates that the current is in a low concurrency scenario, and the second taking mode (i.e., a synchronous taking mode, which is a low concurrency taking mode) is used to issue the interest to the target terminal.

[0073] In step S103, if the current taking switch value is the second switch value, it indicates that the current is in a low concurrency scenario, and the second taking mode (i.e., a synchronous taking mode, which is a low concurrency taking mode) is used to issue the interest to the target terminal.

[0074] In the embodiment of the present application, the concurrency performance of the first taking mode is higher than that of the second taking mode.

[0075] Optionally, the step of issuing the interest to the target terminal by using the second taking mode comprises: in the case of receiving the interest taking request, inventory checking and activity checking are performed on the interest to be taken; in the case of passing the inventory checking and the activity checking, inventory deduction is performed on the interest to be taken, and the interest taking request is forwarded to an interest taking platform, wherein the interest taking platform issues the interest to the target terminal.

[0076] In the embodiment of the present application, the low concurrency taking process is as follows: after the customer clicks to take, inventory checking is performed, and activity and resource checking are performed (i.e., in the case of receiving the interest taking request, inventory checking and activity checking are performed on the interest to be taken), after the checking passes, inventory deduction is performed through the killing platform, and the taking details are written into the database, and at the same time, the interest taking request is forwarded to the third party platform, the third party platform processes the interest taking request, and the taking result is written into the database, and the taking result is directly displayed on the page (i.e., in the case of passing the inventory checking and the activity checking, inventory deduction is performed on the interest to be taken, and the interest taking request is forwarded to an interest taking platform, and the interest taking platform issues the interest to the target terminal).

[0077] In the embodiment of the present application, the low concurrency taking process belongs to a synchronous process, the customer can see the taking success or failure in real time, the interactive experience is good, and after the success, the result can be viewed in the third party platform.

[0078] In the embodiment of the present application, an automatic switching mechanism between high-concurrency benefit distribution and low-concurrency benefit distribution is established, which can identify the instantaneous high-concurrency request condition, that is, the resource usage of the system and the current TPS of the request can be detected first, and then a corresponding threshold is set to determine whether the flow limiting threshold is triggered (that is, the resource occupation degree is greater than the threshold or the TPS is greater than the threshold), if the threshold is triggered, it indicates that the high-concurrency request condition occurs, and the high-concurrency taking process needs to be switched to. In this way, the low-concurrency taking process can be switched to the high-concurrency taking process in time in the case of high-concurrency request, and the concurrency performance and the taking experience of the customer are improved.

[0079] The following will be described in detail in combination with another embodiment.

[0080] Embodiment two

[0081] The benefit taking mode determination device provided in the embodiment comprises a plurality of implementation units, and each implementation unit corresponds to each implementation step in the above embodiment one.

[0082] Figure 3 is a schematic diagram of an optional benefit taking mode determination device according to the embodiment of the present application, as shown in the figure, the determination device can comprise: a determination unit 30, a first distribution unit 31 and a second distribution unit 32. Figure 3

[0083] The determination unit 30 is configured to determine a current taking switch value when receiving a benefit taking request sent by a target terminal, wherein the current taking switch value is determined based on a current resource occupation rate and a current number of benefit taking requests.

[0084] The first distribution unit 31 is configured to distribute benefits to the target terminal by using a first taking mode when the current taking switch value is a first switch value, wherein the first taking mode is an asynchronous taking mode.

[0085] The second distribution unit 32 is configured to distribute benefits to the target terminal by using a second taking mode when the current taking switch value is a second switch value, wherein the second taking mode is a synchronous taking mode, and the concurrency performance of the first taking mode is higher than that of the second taking mode.

[0086] ​The determination device can determine the current taking switch value when the benefit taking request sent by the target terminal is received, and the first distribution unit can distribute the benefits to the target terminal in the first taking mode when the current taking switch value is the first switch value, and the second distribution unit can distribute the benefits to the target terminal in the second taking mode when the current taking switch value is the second switch value. In the embodiment of the present application, the switch value of the current taking switch can be determined in advance according to the current resource occupancy rate of the transaction system and the current benefit taking request number, and then the benefit taking mode is selected according to the current taking switch value, so that the benefit taking process can be switched to the high-concurrency benefit taking process in time when a high-concurrency request occurs, so as to avoid system collapse, and the low-concurrency benefit taking process can be used in a low-concurrency scenario to effectively reduce the taking response delay, thereby solving the technical problems that the transaction system is prone to collapse or the transaction response is slow in the related art when taking the benefit resources.

[0087] Optionally, the determination unit comprises: a first detection module configured to detect the current resource occupancy rate of the benefit distribution system and the current benefit taking request number based on a preset time interval; a first update module configured to update the current taking switch value to the first switch value when the current resource occupancy rate is greater than a preset resource threshold or the current benefit taking request number is greater than a preset taking threshold; and a second update module configured to update the current taking switch value to the second switch value when the current resource occupancy rate is less than a preset resource threshold and the current benefit taking request number is less than a preset taking threshold.

[0088] Optionally, the first detection module comprises: a first acquisition submodule configured to acquire log information of an operating system used by the benefit distribution system; a first determination submodule configured to determine the current CPU utilization of the benefit distribution system at a current time point based on the log information, and represent the current CPU utilization as the current resource occupancy rate; and a second acquisition submodule configured to acquire the benefit taking request number of the hotness key corresponding to a previous time point from the cache database, and represent the benefit taking request number as the current benefit taking request number.

[0089] Optionally, the determination device further comprises: a first creation module configured to create a hotness key in the cache database every preset time length unit, and determine the key identifier of the hotness key according to the creation time point of the hotness key; a first determination module configured to determine the reception time point of a benefit taking request every time a benefit taking request is received; a second determination module configured to determine a target creation time point equal to the reception time point, and increase the key value of a target hotness key of the target creation time point; and a third determination module configured to determine the key value of the target hotness key as the benefit taking request number of the reception time point when the current time point reaches the next reception time point.

[0090] Optionally, the first issuing unit comprises: a first checking module, configured to, in response to receiving the benefit taking request, check the inventory and the activity of the benefit to be taken; a first deduction module, configured to, in response to the inventory and the activity being both passed, deduct the inventory of the benefit to be taken, and return the benefit locking information to the target terminal; a first adding module, configured to add the benefit taking request to a preset message queue; a first forwarding module, configured to, in response to the message consumption thread detecting that the preset message queue has the benefit taking request, forward the benefit taking request to the benefit taking platform by using the message consumption thread, wherein the benefit taking platform processes the benefit taking request, and writes the processing result to the preset message queue; and a first returning module, configured to, in response to detecting that the processing result in the preset message queue is a successful taking, return the processing result to the target terminal.

[0091] Optionally, the second issuing unit comprises: a second checking module, configured to, in response to receiving the benefit taking request, check the inventory and the activity of the benefit to be taken; and a second deduction module, configured to, in response to the inventory and the activity being both passed, deduct the inventory of the benefit to be taken, and forward the benefit taking request to the benefit taking platform, wherein the benefit taking platform issues the benefit to the target terminal.

[0092] Optionally, the determining device further comprises: a fourth determining module, configured to determine the number of concurrent requests and the number of concurrent back-switching by using the stress test strategy; a fifth determining module, configured to determine the preset resource threshold and the preset taking threshold by simulating the number of concurrent requests of the benefit taking request; and a sixth determining module, configured to determine the preset resource back-switching threshold and the preset taking back-switching threshold by simulating the number of concurrent back-switching of the benefit taking request.

[0093] The determining device described above can further comprise a processor and a memory, and the determining unit 30, the first issuing unit 31, the second issuing unit 32, etc. are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize the corresponding functions.

[0094] The processor described above comprises a core, and the core calls the corresponding program units from the memory. The core can be one or more, and by adjusting the core parameters, the first taking mode is used to issue the benefit to the target terminal when the current taking switch value is the first switch value, and the second taking mode is used to issue the benefit to the target terminal when the current taking switch value is the second switch value.

[0095] The memory can include a non-persistent memory in a computer readable medium, a random access memory (RAM) and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory includes at least one memory chip.

[0096] The application further provides a computer program product, which is adapted to execute a program of the following method steps when executed on a data processing device: in the case that a benefit collection request sent by a target terminal is received, determining a current collection switch value, in the case that the current collection switch value is a first switch value, issuing the benefit to the target terminal by using a first collection mode, and in the case that the current collection switch value is a second switch value, issuing the benefit to the target terminal by using a second collection mode.

[0097] According to another aspect of the embodiments of the application, a computer readable storage medium is further provided, which includes a stored computer program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to execute the above-mentioned benefit collection mode determination method when the computer program is executed.

[0098] According to another aspect of the embodiments of the application, an electronic device is further provided, which includes one or more processors and a memory, and the memory is used to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the above-mentioned benefit collection mode determination method.

[0099] Figure 4 is a hardware structure block diagram of an electronic device (or a mobile device) for a benefit collection mode determination method according to an embodiment of the application. As shown in Figure 4 , the electronic device can include one or more processors (for example, processors 402a, 402b, …, 402n, etc. in Figure 4 , which can include but are not limited to processing devices such as microprocessors MCU or programmable logic devices FPGA), a memory 404 for storing data. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. Those skilled in the art can understand that the structure shown in Figure 4 is only schematic, and does not limit the structure of the above-mentioned electronic device. For example, the electronic device can include more or less components than those shown in Figure 4 , or have a different configuration from Figure 4 .

[0100] The above-mentioned embodiment numbers of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0101] In the above-described embodiments of the present application, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0102] In the several embodiments of the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the unit embodiment described above is only schematic. For example, the division of the units can be a logical function division, and there can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection between the units can be indirect coupling or communication connection through some interface, and can be electrical or other forms.

[0103] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0104] In addition, each functional unit in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software functional unit.

[0105] When the integrated unit is realized 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 solutions of the present application essentially or the part that makes a contribution to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0106] The above merely describes the preferred embodiments of the present application, and it should be pointed out that, for those skilled in the art, several improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements should also be considered as falling within the protection scope of the present application.

Claims

1. A method of determining a benefit payment regime, characterized by, The method comprises the following steps: In the case of receiving the benefit collection request sent by the target terminal, determining the current collection switch value, wherein the current collection switch value is determined based on the current resource occupancy rate and the current benefit collection request number; In the case that the current collection switch value is a first switch value, the first collection mode is used to issue benefits to the target terminal, wherein the first collection mode is an asynchronous collection mode; In the case that the current collection switch value is a second switch value, the second collection mode is used to issue benefits to the target terminal, wherein the second collection mode is a synchronous collection mode, and the concurrency performance of the first collection mode is higher than that of the second collection mode.

2. The determination method according to claim 1, characterized in that, The step of determining the current collection switch value comprises: Based on a preset time interval, detecting the current resource occupancy rate and the current benefit collection request number of the benefit issuing system; In the case that the current resource occupancy rate is greater than a preset resource threshold or the current benefit collection request number is greater than a preset collection threshold, the current collection switch value is updated to the first switch value; In the case that the current resource occupancy rate is less than a preset resource rollback threshold and the current benefit collection request number is less than a preset collection rollback threshold, the current collection 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 benefit collection request number of the benefit issuing system based on a preset time interval comprises: Obtaining log information of an operating system used by the benefit issuing system; Based on the log information, determining the current CPU utilization rate of the benefit issuing system at the current time point, and representing the current CPU utilization rate as the current resource occupancy rate; Obtaining the benefit collection request number of the hotness key corresponding to the last time point from the cache database, and representing the benefit collection request number as the current benefit collection request number.

4. The determination method according to claim 3, characterized in that, The method for determining the benefit collection mode further comprises: Every interval of a preset time length unit, creating a hotness key in the cache database, and determining the key identifier of the hotness key at the creation time point of creating the hotness key; Every time a benefit collection request is received, determining the reception time point of the benefit collection request; Determining a target creation time point equal to the reception time point, and increasing the key value of the target hotness key of the target creation time point; In the case that the current time point reaches the next reception time point, the key value of the target hotness key is determined as the benefit collection request number of the reception time point.

5. The determination method of claim 1, wherein, The step of issuing benefits to the target terminal by using the first collection mode comprises: In the case of receiving the benefit collection request, performing inventory verification and activity verification on the benefits to be collected; In the case that both the inventory verification and the activity verification are passed, performing inventory deduction on the benefits to be collected, and returning benefit locking information to the target terminal; Adding the benefit collection request to a preset message queue; In a case where the message consumption thread detects that the preset message queue has the benefit taking request, the message consumption thread is used to forward the benefit taking request to a benefit taking platform, wherein the benefit taking platform processes the benefit taking request and writes a processing result into the preset message queue; In a case where the processing result in the preset message queue is successful taking, the processing result is returned to the target terminal.

6. The determination method of claim 1, wherein, The step of issuing the benefit to the target terminal by using the second taking manner includes: In a case where the benefit taking request is received, inventory checking and activity checking are performed on the benefit to be taken; In a case where the inventory checking and the activity checking are both passed, inventory deduction is performed on the benefit to be taken, and the benefit taking request is forwarded to a benefit taking platform, wherein the benefit taking platform issues the benefit to the target terminal.

7. The determination method of claim 1, wherein, The method for determining the benefit taking manner further includes: A pressure test strategy is used to determine a concurrent request quantity and a concurrent return quantity; Benefit taking requests of the concurrent request quantity are simulated to determine a preset resource threshold and a preset taking threshold; Benefit taking requests of the concurrent return quantity are simulated to determine a preset resource return threshold and a preset taking return threshold.

8. An apparatus for determining a benefit payment mode, characterized by The method includes: A determination unit is configured to determine a current taking switch value in a case where a benefit taking request sent by a target terminal is received, wherein the current taking switch value is determined based on a current resource occupancy rate and a current benefit taking request quantity; A first issuing unit is configured to issue a benefit to the target terminal by using a first taking manner in a case where the current taking switch value is a first switch value, wherein the first taking manner is an asynchronous taking manner; A second issuing unit is configured to issue a benefit to the target terminal by using a second taking manner in a case where the current taking switch value is a second switch value, wherein the second taking manner is a synchronous taking manner, and a concurrent performance of the first taking manner is higher than that of the second taking manner.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium includes a stored computer program, wherein the computer program controls a device where the computer readable storage medium is located to execute the method for determining the benefit taking manner according to any one of claims 1 to 7 when the computer program is running.

10. An electronic device, comprising: The device includes one or more processors and a memory, and the memory is configured to store one or more programs, wherein the one or more programs make the one or more processors implement the method for determining the benefit taking manner according to any one of claims 1 to 7 when the one or more programs are executed by the one or more processors.

Citation Information

Patent Citations

  • User right card management method and device

    CN114549069A

  • Right and interest issuing method and device, right and interest platform server and storage medium

    CN116976969A