Resource transfer method, device, electronic device and storage medium

By introducing cache queues and asynchronous storage mechanisms into the microservice architecture, the database pressure problem caused by the large number of user requests is solved, and efficient resource management and system throughput improvements are achieved.

CN115080610BActive Publication Date: 2025-08-19JINGDONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110274811.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-15
Publication Date
2025-08-19
Estimated Expiration
2041-03-15

AI Technical Summary

Technical Problem

In the microservice architecture, when the user requests are of a large order, directly sending the requested traffic to the database storage layer cannot guarantee normal service provision.

Method used

By deploying functional microservices and listening microservices in the microservice architecture, the listening microservices are used to store the target resources in the cache queue, and when the target resources are stored in the cache queue, the resource issuance notification is sent to the requesting party, and the resources are stored in the database asynchronously.

Benefits of technology

It alleviates the pressure on the database and increases the system's throughput capabilities, ensuring that users can receive resource issuance notifications when resources are stored in the cache queue, avoiding database bottlenecks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080610B_ABST
    Figure CN115080610B_ABST
Patent Text Reader

Abstract

The present invention relates to a resource transfer method, device, electronic device and storage medium, the method comprising: receiving a resource acquisition request; calling a functional microservice corresponding to the resource acquisition request to determine a target resource; calling a monitoring microservice to store the target resource in a cache queue, and storing the target resource in the cache queue in a database; when the target resource is stored in the cache queue, sending a resource issuance notification to the requester of the resource acquisition request. The embodiment of the present application uses the buffering of the cache queue so that when a large number of resource acquisition requests are received, the target resource corresponding to each request can be first stored in the cache queue and then stored in the database. The user can receive a resource issuance notification when the target resource is stored in the cache queue, but the target resource is not actually stored in the database at this time. This asynchronous storage method can relieve the pressure on the database and increase the throughput of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource transfer method, device, electronic device, and storage medium. Background Art

[0002] Microservices is an architectural style that divides a single application into smaller service units and uses HTTP APIs between microservices for resource access and operations.

[0003] The existing microservice architecture design patterns mainly include aggregator microservice pattern, proxy microservice pattern, chain microservice pattern, branch microservice pattern, data sharing microservice pattern, asynchronous messaging microservice pattern, etc.

[0004] However, in some activity scenarios, the volume of user requests is large. If the request traffic is simply directed to the database storage layer, no storage layer can guarantee normal service provision. Summary of the Invention

[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a resource transfer method, device, electronic device and storage medium.

[0006] In a first aspect, the present application provides a resource transfer method, wherein a functional microservice and a monitoring microservice are deployed in a microservice architecture, and the method comprises:

[0007] receiving a resource acquisition request for requesting to acquire a resource;

[0008] Calling the function microservice corresponding to the resource acquisition request to determine the target resource;

[0009] Calling the monitoring microservice to store the target resource in the cache queue, and storing the target resource in the cache queue in the database;

[0010] When the target resource is stored in the cache queue, a resource release notification is sent to the requester of the resource acquisition request.

[0011] Optionally, a gateway microservice is further deployed in the microservice architecture, and the method further includes:

[0012] Calling the gateway microservice to verify the resource acquisition request;

[0013] If the verification passes, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0014] If the verification fails, the resource acquisition request is intercepted.

[0015] Optionally, a configuration microservice is further deployed in the microservice architecture, and the calling gateway microservice verifies the resource acquisition request, including:

[0016] Call the gateway microservice and obtain permission configuration information for permission verification from the configuration microservice, wherein the permission configuration information includes: interface permission information for verifying interface permission, method permission information for verifying method permission, and dimension permission information for verifying permission of the requester dimension;

[0017] Based on the interface permission information, verify whether the resource acquisition request has the permission to call the requested interface; based on the method permission information, verify whether the resource acquisition request has the permission to call the requested method; and based on the dimension permission information, verify whether the requester dimension sending the resource acquisition request has the permission to access the resource.

[0018] Optionally, a configuration microservice is further deployed in the microservice architecture, and the calling gateway microservice verifies the resource acquisition request, including:

[0019] Call the gateway microservice and obtain current limiting configuration information for limiting access frequency from the configuration microservice, wherein the current limiting configuration information includes: a single caller access frequency threshold and a global access frequency threshold;

[0020] Counting the single caller access frequency of the resource acquisition request sent by the requester of the resource acquisition request and the current global access frequency of the system;

[0021] Verify whether the single caller access frequency is less than the single caller access frequency threshold, and verify whether the current global access frequency is less than the global access frequency threshold.

[0022] Optionally, a configuration microservice is further deployed in the microservice architecture, and the calling gateway microservice verifies the resource acquisition request, including:

[0023] Obtaining anti-brushing configuration information for preventing order fraud from the configuration microservice, wherein the anti-brushing configuration information includes an anti-brushing threshold;

[0024] Call the gateway microservice and count the number of resource acquisition requests sent by the requester of the resource acquisition request per unit time;

[0025] Verify whether the number of requests is less than the anti-brushing threshold.

[0026] Optionally, a rule microservice is further deployed in the microservice architecture, and the method further includes:

[0027] Calling the rule microservice to determine the resource requested by the resource acquisition request and the identifier of the requester that sent the resource acquisition request;

[0028] Find the resource acquisition permission corresponding to the requester identifier;

[0029] Determining whether the resource requested by the resource acquisition request matches the resource acquisition permission;

[0030] If there is a match, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0031] If there is no match, the resource acquisition request is intercepted.

[0032] Optionally, a scheduling microservice is further deployed in the microservice architecture, and the method further includes:

[0033] Call the scheduling microservice to perform a global traversal of the database;

[0034] Match the traversed information with the preset data to be cleaned;

[0035] If the match is successful, the information is pushed into the pipeline queue, and when the number of pieces of information in the pipeline queue reaches a threshold, the information in the pipeline queue is deleted.

[0036] In a second aspect, the present application provides a device for resource transfer, wherein a functional microservice and a monitoring microservice are deployed in the microservice architecture, and the device includes:

[0037] A receiving module, configured to receive a resource acquisition request for requesting to acquire a resource;

[0038] A first calling module is used to call the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0039] The second calling module is used to call the monitoring microservice to store the target resource in the cache queue, and store the target resource in the cache queue in the database;

[0040] The sending module is used to send a resource issuance notification to the requester of the resource acquisition request when the target resource is stored in the cache queue.

[0041] Optionally, a gateway microservice is further deployed in the microservice architecture, and the device further includes:

[0042] A third calling module is used to call the gateway microservice to verify the resource acquisition request;

[0043] A first execution module is configured to, if the verification passes, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0044] The first interception module is used to intercept the resource acquisition request if the verification fails.

[0045] Optionally, a configuration microservice is further deployed in the microservice architecture, and the first calling module includes:

[0046] A first acquisition unit is configured to acquire permission configuration information for permission verification from the configuration microservice;

[0047] The first calling unit is used to call the gateway microservice and verify, based on the permission configuration information, whether the request interface, method, and requester dimension of the resource acquisition request match the permission configuration information.

[0048] Optionally, a configuration microservice is further deployed in the microservice architecture, and the first calling module includes:

[0049] A second acquisition unit is used to obtain current limiting configuration information for access frequency limitation from the configuration microservice;

[0050] The second calling unit is used to call the gateway microservice and count the single caller access frequency of the resource acquisition request sent by the requester of the resource acquisition request and the current global access frequency of the system;

[0051] The first verification unit is used to verify whether the single caller access frequency is less than the single caller access frequency threshold in the current limiting configuration information, and to verify whether the current global access frequency is less than the global access frequency threshold in the current limiting configuration information.

[0052] Optionally, a configuration microservice is further deployed in the microservice architecture, and the first calling module includes:

[0053] A third acquisition unit is used to obtain anti-brushing configuration information for preventing order brushing from the configuration microservice;

[0054] The third calling unit is used to call the gateway microservice and count the number of resource acquisition requests sent by the requester of the resource acquisition request per unit time;

[0055] The second verification unit is used to verify whether the number of requests is less than the anti-brushing number threshold in the anti-brushing configuration information.

[0056] Optionally, a rule microservice is further deployed in the microservice architecture, and the device further includes:

[0057] A third calling module is used to call the rule microservice to determine the resource requested by the resource acquisition request and the requester identifier that sends the resource acquisition request;

[0058] A search module, configured to search for the resource acquisition authority corresponding to the requester identifier;

[0059] A determination module, configured to determine whether the resource requested by the resource acquisition request matches the resource acquisition permission;

[0060] The second execution module is configured to, if a match is found, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0061] The second interception module is used to intercept the resource acquisition request if there is no match.

[0062] Optionally, a scheduling microservice is further deployed in the microservice architecture, and the device further includes:

[0063] The fourth calling module is used to call the scheduling microservice to perform a global traversal of the database;

[0064] A matching module is used to match the traversed information with the preset data to be cleaned;

[0065] The push module is used to push the information into the pipeline queue if the match is successful, and to wait for the number of pieces of information in the pipeline queue to reach a threshold, and then delete the information in the pipeline queue.

[0066] In a third aspect, the present application provides an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0067] Memory for storing computer programs;

[0068] The processor is configured to implement any resource transfer method described in the first aspect when executing a program stored in the memory.

[0069] In a fourth aspect, the present application provides a computer-readable storage medium, on which a resource transfer method program is stored. When the resource transfer method program is executed by a processor, the steps of any resource transfer method described in the first aspect are implemented.

[0070] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0071] The embodiment of the present application can store the target resources in the cache queue by calling the monitoring microservice, and store the target resources in the cache queue in the database. Through the buffering of the cache queue, when a large number of resource acquisition requests are received, the target resources corresponding to each request can be first stored in the cache queue and then stored in the database. The user can receive a resource release notification when the target resource is stored in the cache queue, but the target resource is not actually in the database at this time. This asynchronous storage method can relieve the pressure on the database and increase the system throughput. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0073] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0074] Figure 1 A flowchart of a resource transfer method provided in an embodiment of the present application;

[0075] Figure 2 A structural diagram of a resource transfer device provided in an embodiment of the present application;

[0076] Figure 3 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0077] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0078] In the related art, in some activity scenarios, the magnitude of user requests is large. If the request traffic is simply sent to the storage layer of the database, any storage layer cannot guarantee the normal provision of services. To this end, the embodiment of the present application provides a resource transfer method, device, electronic device and storage medium, wherein the resource transfer method can be applied to a server, a microservice architecture is provided in the terminal device, and a functional microservice and a monitoring microservice are deployed in the microservice architecture. In the embodiment of the present application, the functional microservice can be an activity microservice, an instant reduction microservice, an allowance microservice or a coupon microservice, wherein the activity microservice is used to provide functions related to marketing coupon activities, such as an activity of receiving a 30 yuan discount coupon for purchases over 100 yuan; the instant reduction microservice is used to provide functions related to marketing instant reduction activities, such as an activity of 30 yuan discount for purchases over 100 yuan; the gold sticker microservice is used to provide gold stickers or cash prizes; the coupon microservice is used to provide coupon prizes; and the monitoring microservice is used to process asynchronous messages.

[0079] like Figure 1 As shown, the resource transfer method includes:

[0080] Step S101: receiving a resource acquisition request for requesting to acquire a resource;

[0081] In the embodiment of the present application, the resource may refer to a coupon, an instant discount, an allowance, a cash prize, or a coupon prize, etc.

[0082] In actual applications, a terminal device used by a user may send a resource acquisition request to a server. The resource acquisition request may carry information such as a user identifier, an identifier of the resource requested, and an interface.

[0083] Step S102: calling the function microservice corresponding to the resource acquisition request to determine the target resource;

[0084] In this step, the corresponding functional microservice can be found according to the resource identifier carried in the resource acquisition request, and the found functional microservice can be called to generate the target resource corresponding to the resource acquisition request using the functional microservice.

[0085] Step S103: calling the monitoring microservice to store the target resource in the cache queue, and storing the target resource in the cache queue in the database;

[0086] The listening microservice is called to perform asynchronous processing on the target resource, that is, the target resource is stored in the cache queue, and after the target resource is stored in the cache queue, the target resource in the cache queue is stored in the database.

[0087] Step S104: When the target resource is stored in the cache queue, a resource release notification is sent to the requester of the resource acquisition request.

[0088] The embodiment of the present application can store the target resources in the cache queue by calling the monitoring microservice, and store the target resources in the cache queue in the database. Through the buffering of the cache queue, when a large number of resource acquisition requests are received, the target resources corresponding to each request can be first stored in the cache queue and then stored in the database. The user can receive a resource release notification when the target resource is stored in the cache queue, but the target resource is not actually in the database at this time. This asynchronous storage method can relieve the pressure on the database. If the MySQL bottleneck is reached, the queue buffering or retry can be used to increase the system throughput and better provide services to users.

[0089] In another embodiment of the present application, a gateway microservice is further deployed in the microservice architecture. The gateway microservice is used to provide a unified access portal to provide functions such as authentication, current limiting, and system protection, thereby avoiding duplication of a set of authentication, current limiting, and system protection functions at each service layer, improving development and operation and maintenance efficiency, and reducing implementation risks. The method further includes:

[0090] Calling the gateway microservice to verify the resource acquisition request;

[0091] The embodiment of the present application can perform basic verification on resource acquisition requests (for example, whether the request parameters are legal) and qualification verification (for example, whether the user has participated in the activity multiple times, whether the activity's requirements for new and old users are met, and whether the user is a blacklisted user). After layers of verification, coupon information is generated for requests that the system considers valid.

[0092] If the verification passes, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0093] If the verification fails, the resource acquisition request is intercepted.

[0094] The embodiment of the present application can verify the resource acquisition request through the gateway microservice. When the resource acquisition request fails to pass the verification, the resource acquisition request can be intercepted. By verifying the resource acquisition request, illegal resource acquisition requests can be filtered out to avoid resource loss caused by illegal resource acquisition requests.

[0095] In another embodiment of the present application, a configuration microservice is further deployed in the microservice architecture. In the embodiment of the present application, the configuration microservice is used to provide configuration management services for operations. Operation and maintenance personnel can configure corresponding configuration information through the configuration microservice, such as interface permission information, method permission information, and dimension permission information. The calling gateway microservice verifies the resource acquisition request, including:

[0096] Call the gateway microservice and obtain permission configuration information for permission verification from the configuration microservice, wherein the permission configuration information includes: interface permission information for verifying interface permission, method permission information for verifying method permission, and dimension permission information for verifying permission of the requester dimension;

[0097] Based on the interface permission information, verify whether the resource acquisition request has the permission to call the requested interface; based on the method permission information, verify whether the resource acquisition request has the permission to call the requested method; and based on the dimension permission information, verify whether the requester dimension sending the resource acquisition request has the permission to access the resource.

[0098] The embodiment of the present application can perform interface-based permission verification on requests. For example, some requesters can access interfaces A and B, while some requesters can only access interface A. The specific implementation is: the operation and maintenance personnel configure relevant permission information for the requester for each interface and method based on the configuration microservice. When the resource acquisition request reaches the gateway microservice, the request is verified based on the permission configuration information to decide whether to release the resource acquisition request.

[0099] The gateway microservice serves as the unified external entrance for all service layers. Unified authentication operations can be performed in the gateway microservice, thus avoiding the repeated implementation of a set of authentication microservices in each service layer, improving development and operation efficiency, and reducing implementation risks.

[0100] In another embodiment of the present application, a configuration microservice is further deployed in the microservice architecture. In this embodiment of the present application, the configuration microservice is used to provide configuration management services for operations. Operation and maintenance personnel can configure corresponding configuration information through the configuration microservice, such as current limiting configuration information, to limit the global access frequency of the system and the access frequency of a single caller. The calling gateway microservice verifies the resource acquisition request, including:

[0101] Call the gateway microservice and obtain current limiting configuration information for limiting access frequency from the configuration microservice, wherein the current limiting configuration information includes: a single caller access frequency threshold and a global access frequency threshold;

[0102] Counting the single caller access frequency of the resource acquisition request sent by the requester of the resource acquisition request and the current global access frequency of the system;

[0103] Verify whether the single caller access frequency is less than the single caller access frequency threshold, and verify whether the current global access frequency is less than the global access frequency threshold.

[0104] The embodiment of the present application is based on configuring the microservice to limit the access frequency for a single caller and the system globally. For example, the global access frequency of the system is 10W / S, the access frequency of requester one is 1K / S, and the access frequency of requester two is 2K / S. When the resource acquisition request reaches the gateway microservice, the access frequency is increased by 1, and then the current global access frequency counted is compared with the configured global access frequency threshold. If it does not exceed, it is released; otherwise, it is intercepted.

[0105] In addition, in another embodiment of the present application, access frequency limits can be set for each interface and method to avoid excessive access frequency to the interface or method, thereby avoiding system freezes and long system response times.

[0106] The gateway microservice serves as the unified external entrance for all service layers. In this microservice, unified current limiting and other operations can be performed, thus avoiding the need to repeatedly implement a set of current limiting microservices in each service layer, improving development and operation efficiency, and reducing implementation risks.

[0107] In another embodiment of the present application, a configuration microservice is also deployed in the microservice architecture. In this embodiment of the present application, the configuration microservice is used to provide configuration management services for operations. Operation and maintenance personnel can configure corresponding configuration information through the configuration microservice, such as anti-brushing configuration information, etc. Anti-brushing refers to a single user illegally accessing the interface by some means. For example, if a certain coupon activity is very strong, users frequently request the interface using request scripts. If no restrictions are imposed, it will affect the availability of the system and affect the fairness of the activity. The calling gateway microservice verifies the resource acquisition request, including:

[0108] Obtaining anti-brushing configuration information for preventing order fraud from the configuration microservice, wherein the anti-brushing configuration information includes an anti-brushing threshold;

[0109] Call the gateway microservice and count the number of resource acquisition requests sent by the requester of the resource acquisition request per unit time;

[0110] Verify whether the number of requests is less than the anti-brushing threshold.

[0111] The embodiment of the present application is based on configuring frequency limits for a single user based on the configuration microservice. For example, a single user can only access a certain interface once in 3 seconds. When a user request comes in, the number of user requests will be increased by 1. When the configured threshold is reached, it will be intercepted.

[0112] The gateway microservice serves as the unified external entrance for all service layers. In this microservice, unified anti-swiping operations can be performed, thereby avoiding the need to repeatedly implement a set of anti-swiping microservices in each service layer, improving development and operation efficiency, and reducing implementation risks.

[0113] In another embodiment of the present application, a rule microservice is further deployed in the microservice architecture. In this embodiment of the present application, the rule microservice is used to provide restriction rules for prizes and activities, for example, limiting participation to new users. The method further includes:

[0114] Calling the rule microservice to determine the resource requested by the resource acquisition request and the identifier of the requester that sent the resource acquisition request;

[0115] Find the resource acquisition permission corresponding to the requester identifier;

[0116] Determining whether the resource requested by the resource acquisition request matches the resource acquisition permission;

[0117] If there is a match, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0118] If there is no match, the resource acquisition request is intercepted.

[0119] The embodiment of the present application uses rule microservices to easily determine whether the user has the authority to obtain the resources they want, thereby avoiding mistakenly sending resources to unauthorized users and causing resource waste.

[0120] In another embodiment of the present application, a scheduling microservice is further deployed in the microservice architecture. In this embodiment of the present application, the scheduling microservice is used to execute certain programs on a regular basis. For example, at 3:00 a.m. every month, the Redis cache is automatically cleaned up, and useless or expired keys from the past month are actively deleted from the cache to free up Redis memory space. The method further includes:

[0121] Call the scheduling microservice to perform a global traversal of the database;

[0122] Match the traversed information with the preset data to be cleaned;

[0123] If the match is successful, the information is pushed into the pipeline queue, and when the number of pieces of information in the pipeline queue reaches a threshold, the information in the pipeline queue is deleted.

[0124] Because the marketing scenario has a large number of users and thus a large amount of data, and there are some batch processing scenarios (for example, sending coupon expiration reminder messages to users in batches), the scheduling microservice is used to regularly execute data recycling, space release operations, or regularly send coupon expiration reminder messages.

[0125] The Redis cache cleanup operation is an example scenario for scheduling microservice applications. There are many actual scenarios. The Redis cache cleanup operation process: the scan technology will be used to globally traverse the primary shard of the Redis cluster (the number of rows traversed each time should not be too large to avoid affecting normal business). The traversed information is compared with the information to be cleaned. If a match is successful, the information is pushed to the pipeline for deletion (note that the number of pipeline pushes cannot be greater than 1000 to avoid affecting business). When the number of pipeline entries reaches the threshold (for example, 1000), a deletion request is executed to the Redis server.

[0126] In another embodiment of the present application, a device for resource transfer is also provided, wherein the microservice architecture is deployed with functional microservices and monitoring microservices, such as Figure 2 As shown, the device includes:

[0127] The receiving module 11 is used to receive a resource acquisition request for requesting to acquire a resource;

[0128] The first calling module 12 is used to call the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0129] The second calling module 13 is used to call the monitoring microservice to store the target resource in the cache queue, and store the target resource in the cache queue in the database;

[0130] The sending module 14 is configured to send a resource release notification to the requester of the resource acquisition request when the target resource is stored in the cache queue.

[0131] Optionally, a gateway microservice is further deployed in the microservice architecture, and the device further includes:

[0132] A third calling module is used to call the gateway microservice to verify the resource acquisition request;

[0133] A first execution module is configured to, if the verification passes, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0134] The first interception module is used to intercept the resource acquisition request if the verification fails.

[0135] Optionally, a configuration microservice is further deployed in the microservice architecture, and the first calling module includes:

[0136] A first acquisition unit is configured to acquire permission configuration information for permission verification from the configuration microservice;

[0137] The first calling unit is used to call the gateway microservice and verify, based on the permission configuration information, whether the request interface, method, and requester dimension of the resource acquisition request match the permission configuration information.

[0138] Optionally, a configuration microservice is further deployed in the microservice architecture, and the first calling module includes:

[0139] A second acquisition unit is used to obtain current limiting configuration information for access frequency limitation from the configuration microservice;

[0140] The second calling unit is used to call the gateway microservice and count the single caller access frequency of the resource acquisition request sent by the requester of the resource acquisition request and the current global access frequency of the system;

[0141] The first verification unit is used to verify whether the single caller access frequency is less than the single caller access frequency threshold in the current limiting configuration information, and to verify whether the current global access frequency is less than the global access frequency threshold in the current limiting configuration information.

[0142] Optionally, a configuration microservice is further deployed in the microservice architecture, and the first calling module includes:

[0143] A third acquisition unit is used to obtain anti-brushing configuration information for preventing order brushing from the configuration microservice;

[0144] The third calling unit is used to call the gateway microservice and count the number of resource acquisition requests sent by the requester of the resource acquisition request per unit time;

[0145] The second verification unit is used to verify whether the number of requests is less than the anti-brushing number threshold in the anti-brushing configuration information.

[0146] Optionally, a rule microservice is further deployed in the microservice architecture, and the device further includes:

[0147] A third calling module is used to call the rule microservice to determine the resource requested by the resource acquisition request and the requester identifier that sends the resource acquisition request;

[0148] A search module, configured to search for the resource acquisition authority corresponding to the requester identifier;

[0149] A determination module, configured to determine whether the resource requested by the resource acquisition request matches the resource acquisition permission;

[0150] The second execution module is configured to, if a match is found, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource;

[0151] The second interception module is used to intercept the resource acquisition request if there is no match.

[0152] Optionally, a scheduling microservice is further deployed in the microservice architecture, and the device further includes:

[0153] The fourth calling module is used to call the scheduling microservice to perform a global traversal of the database;

[0154] A matching module is used to match the traversed information with the preset data to be cleaned;

[0155] The push module is used to push the information into the pipeline queue if the match is successful, and to wait for the number of pieces of information in the pipeline queue to reach a threshold, and then delete the information in the pipeline queue.

[0156] In another embodiment of the present application, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0157] Memory for storing computer programs;

[0158] The processor is configured to implement the resource transfer method described in the aforementioned method embodiment when executing the program stored in the memory.

[0159] In another embodiment of the present application, a computer-readable storage medium is provided, on which a resource transfer method program is stored. When the resource transfer method program is executed by a processor, the steps of the resource transfer method described in the above method embodiment are implemented.

[0160] In an electronic device provided by an embodiment of the present invention, a processor implements a microservice architecture in which a functional microservice and a listening microservice are deployed by executing a program stored in a memory, receives a resource acquisition request for requesting resource acquisition; calls a functional microservice corresponding to the resource acquisition request to determine a target resource; calls a listening microservice to store the target resource in a cache queue, and stores the target resource in the cache queue in a database; when the target resource is stored in the cache queue, sends a resource issuance notification to the requester of the resource acquisition request. The embodiment of the present application can store the target resource in the cache queue and store the target resource in the cache queue in the database by calling the listening microservice. Through the buffering of the cache queue, when a large number of resource acquisition requests are received, the target resource corresponding to each request can be first stored in the cache queue and then in the database. The user can receive a resource issuance notification when the target resource is stored in the cache queue, but the target resource is not actually in the database at this time. This asynchronous storage method can relieve the pressure on the database and increase the throughput of the system.

[0161] The communication bus 1140 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 1140 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0162] The communication interface 1120 is used for communication between the electronic device and other devices.

[0163] The memory 1130 may include a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0164] The above-mentioned processor 1110 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0165] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0166] The foregoing description is intended only to provide specific embodiments of the present invention, which will enable those skilled in the art to understand and implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown herein, but is intended to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A resource transfer method, characterized in that: Functional microservices and monitoring microservices are deployed in the microservice architecture, and the method includes: receiving a resource acquisition request for requesting to acquire a resource; Calling the function microservice corresponding to the resource acquisition request to determine the target resource; Calling the monitoring microservice to store the target resource in the cache queue, and storing the target resource in the cache queue in the database; When the target resource is stored in the cache queue, sending a resource release notification to the requester of the resource acquisition request; A scheduling microservice is also deployed in the microservice architecture, and the method further includes: Call the scheduling microservice to perform a global traversal of the database; Match the traversed information with the preset data to be cleaned; If the match is successful, the information is pushed into the pipeline queue, and when the number of pieces of information in the pipeline queue reaches a threshold, the information in the pipeline queue is deleted.

2. The method according to claim 1, characterized in that A gateway microservice is also deployed in the microservice architecture, and the method further includes: Calling the gateway microservice to verify the resource acquisition request; If the verification passes, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource; If the verification fails, the resource acquisition request is intercepted.

3. The method according to claim 2, characterized in that The microservice architecture further includes a configuration microservice, and the calling of the gateway microservice to verify the resource acquisition request includes: Call the gateway microservice and obtain permission configuration information for permission verification from the configuration microservice, wherein the permission configuration information includes: interface permission information for verifying interface permission, method permission information for verifying method permission, and dimension permission information for verifying permission of the requester dimension; Based on the interface permission information, verify whether the resource acquisition request has the permission to call the requested interface; based on the method permission information, verify whether the resource acquisition request has the permission to call the requested method; and based on the dimension permission information, verify whether the requester dimension sending the resource acquisition request has the permission to access the resource.

4. The method according to claim 2, characterized in that The microservice architecture further includes a configuration microservice, and the calling of the gateway microservice to verify the resource acquisition request includes: Call the gateway microservice and obtain current limiting configuration information for limiting access frequency from the configuration microservice, wherein the current limiting configuration information includes: a single caller access frequency threshold and a global access frequency threshold; Counting the single caller access frequency of the resource acquisition request sent by the requester of the resource acquisition request and the current global access frequency of the system; Verify whether the single caller access frequency is less than the single caller access frequency threshold, and verify whether the current global access frequency is less than the global access frequency threshold.

5. The method according to claim 2, characterized in that The microservice architecture further includes a configuration microservice, and the calling of the gateway microservice to verify the resource acquisition request includes: Obtaining anti-brushing configuration information for preventing order fraud from the configuration microservice, wherein the anti-brushing configuration information includes an anti-brushing threshold; Call the gateway microservice and count the number of resource acquisition requests sent by the requester of the resource acquisition request per unit time; Verify whether the number of requests is less than the anti-brushing threshold.

6. The method according to claim 1, characterized in that A rule microservice is also deployed in the microservice architecture, and the method further includes: Calling the rule microservice to determine the resource requested by the resource acquisition request and the identifier of the requester that sent the resource acquisition request; Find the resource acquisition permission corresponding to the requester identifier; Determining whether the resource requested by the resource acquisition request matches the resource acquisition permission; If there is a match, execute the step of calling the functional microservice corresponding to the resource acquisition request to determine the target resource; If there is no match, the resource acquisition request is intercepted.

7. A device for resource transfer, characterized in that: Functional microservices and monitoring microservices are deployed in the microservice architecture, and the device includes: A receiving module, configured to receive a resource acquisition request for requesting to acquire a resource; A first calling module is used to call the functional microservice corresponding to the resource acquisition request to determine the target resource; The second calling module is used to call the monitoring microservice to store the target resource in the cache queue, and store the target resource in the cache queue in the database; a sending module, configured to send a resource release notification to the requester of the resource acquisition request when the target resource is stored in the cache queue; A scheduling microservice is also deployed in the microservice architecture, and the device further includes: The fourth calling module is used to call the scheduling microservice to perform a global traversal of the database; A matching module is used to match the traversed information with the preset data to be cleaned; The push module is used to push the information into the pipeline queue if the match is successful, and to wait for the number of pieces of information in the pipeline queue to reach a threshold, and then delete the information in the pipeline queue.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor is configured to implement the resource transfer method according to any one of claims 1 to 6 when executing a program stored in a memory.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a resource transfer method program, and when the resource transfer method program is executed by a processor, the steps of the resource transfer method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Identity authentication method and device for platform user, equipment and medium

    CN112149072A

  • Micro-service calling method and device, electronic equipment and storage medium

    CN112416616A