A Distributed-Based Virtual Resource Request Matching Method and Device

By using global distributed cache to register and match virtual resource requests in the distributed application architecture, the user experience problem caused by uneven consumption of virtual resources in distributed databases is solved, and efficient and transparent resource scheduling and deduction are achieved.

CN114637607BActive Publication Date: 2025-06-10INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210364061.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-08
Publication Date
2025-06-10
Estimated Expiration
2042-04-08

AI Technical Summary

Technical Problem

Under the distributed application architecture, the problem of poor user experience due to unbalanced consumption in different distributed databases is caused by different virtual resources.

Method used

By registering the number of virtual resources stored in each distributed database into the global distributed cache, and receiving the user's virtual resource request, the virtual resource request is sent to the corresponding distributed database according to the global distributed cache.

Benefits of technology

This solves the problem that there is still remaining resources in the overall resource but some sets are unavailable due to the differences in loads of different sets, and realizes transparent, flexible and efficient resource scheduling and deduction to users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114637607B_ABST
    Figure CN114637607B_ABST
Patent Text Reader

Abstract

The present invention can be used in the technical field of the application of distributed technology in the financial aspect. The present invention provides a distributed-based virtual resource request matching method and device. The distributed-based virtual resource request matching method includes: registering the quantity of virtual resources stored in each distributed database into the global distributed cache; receiving a virtual resource request from a user; and sending the virtual resource request to the corresponding distributed database according to the global distributed cache. The present invention solves the problem of poor user experience caused by uneven consumption of different virtual resources in different distributed databases under a distributed application architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of distributed technologies, and particularly relates to a distributed-based virtual resource request matching method and apparatus. Background Art

[0002] With the application of distributed technologies, the problem that the performance capacity of conventional single-point application servers and databases is difficult to expand has been greatly solved. The distributed architecture is a stable and reliable architecture with elastic scalability of capacity and service capabilities, featuring automated horizontal splitting, transparent read-write separation, and online smooth expansion of service capabilities. It provides relatively favorable technical support for business systems with long-term growth or fluctuating business volumes.

[0003] However, with the gradual increase in application scenarios, existing distributed technologies can no longer adapt to some application scenarios. Taking the allocation scenario of e-commerce activity resources as an example, the existing method is as follows: requests from different users are routed through consistent hashing and transferred to the specified set for processing, thereby achieving flexible expansion of the system's concurrent throughput capacity. For process data such as transaction logs and transaction details, and user-related protocol data, this rule can be well adapted. However, for resource data such as product inventory, there may be certain problems. For example: Refer to Figure 1 , after dividing into 10 sets and conducting a popular activity, the inventory is evenly distributed to sets 1 to 10, with 1 million coupon codes for each set. After the activity has been carried out for a certain period, the inventory in each set begins to show an irregular distribution, and eventually, the inventory in some sets is used up. User A is routed to set 1 according to the routing, but the inventory in set 1 has been used up; at this time, user B is routed to set 2 according to the routing, and there is still remaining inventory at this time. This will cause user A to be unable to participate in the activity due to technical reasons. Summary of the Invention

[0004] The present invention can be used in the technical field of the application of distributed technologies in the financial field, and can also be used in any field other than the financial field. The present invention solves the problem of poor user experience caused by uneven consumption of different virtual resources in different distributed databases under a distributed application architecture.

[0005] To solve the technical problems in the background art of this application, the present invention provides the following technical solutions:

[0006] In a first aspect, the present invention provides a distributed-based virtual resource request matching method, including:

[0007] Registering the quantity of virtual resources stored in each distributed database into the global distributed cache;

[0008] Receive the virtual resource request of the user;

[0009] Send the virtual resource request to the corresponding distributed database according to the global distributed cache.

[0010] In one embodiment, the distributed-based virtual resource request matching method further includes:

[0011] Update the global distributed cache in real time according to the quantity of the virtual resources.

[0012] In one embodiment, the distributed-based virtual resource request matching method further includes:

[0013] Analyze the virtual resource request to determine the user ID and the virtual resource ID requested by the user.

[0014] In one embodiment, sending the virtual resource request to the corresponding distributed database according to the global distributed cache includes:

[0015] Traverse the global distributed cache according to the virtual resource ID to find the distributed database storing the virtual resource;

[0016] Send the virtual resource request to the distributed database storing the virtual resource.

[0017] In one embodiment, sending the virtual resource request to the distributed database storing the virtual resource includes:

[0018] When the number of distributed databases storing the virtual resource is multiple, determine the optimal distributed database according to the user ID, and send the virtual resource request to the optimal distributed database.

[0019] In one embodiment, after sending the virtual resource request to the corresponding distributed database according to the global distributed cache, it further includes:

[0020] Modify the version number of the virtual resource ID.

[0021] In one embodiment, registering the quantity of the virtual resources stored in each distributed database into the global distributed cache includes:

[0022] Register the quantity of the virtual resources of this category into the global distributed cache according to the virtual resource category.

[0023] In a second aspect, the present invention provides a distributed-based virtual resource request matching device, and the device includes:

[0024] A virtual resource registration module, configured to register the quantity of virtual resources stored in each distributed database into the global distributed cache;

[0025] A virtual resource request module, configured to receive a user's virtual resource request;

[0026] A virtual resource request sending module, configured to send the virtual resource request to the corresponding distributed database according to the global distributed cache.

[0027] In one embodiment, the distributed-based virtual resource request matching device further includes:

[0028] A data update module, configured to update the global distributed cache in real time according to the quantity of the virtual resources.

[0029] In one embodiment, the distributed-based virtual resource request matching device further includes:

[0030] A request parsing module, configured to parse the virtual resource request to determine the user ID and the virtual resource ID requested by the user.

[0031] In one embodiment, the virtual resource request sending module includes:

[0032] A resource lookup unit, configured to traverse the global distributed cache according to the virtual resource ID to find the distributed database storing the virtual resource;

[0033] A virtual resource request sending unit, configured to send the virtual resource request to the distributed database storing the virtual resource.

[0034] In one embodiment, the virtual resource request sending unit includes:

[0035] An optimal database determination unit, configured to, when the number of distributed databases storing the virtual resource is multiple, determine the optimal distributed database according to the user ID, and send the virtual resource request to the optimal distributed database.

[0036] In one embodiment, the distributed-based virtual resource request matching device further includes:

[0037] A version number modification module, configured to modify the version number of the virtual resource ID.

[0038] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the distributed-based virtual resource request matching method are implemented.

[0039] Fourthly, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the virtual resource request matching method based on distribution are implemented.

[0040] As can be seen from the above description, the embodiments of the present invention provide a virtual resource request matching method and device based on distribution. The corresponding method includes: First, register the quantity of virtual resources stored in each distributed database into the global distributed cache; then, receive the virtual resource request of the user; finally, send the virtual resource request to the corresponding distributed database according to the global distributed cache. The present invention first performs service-oriented abstraction on the deduction of virtual resources (inventory), and then instantaneously updates the global cache of the sub-set library resources during use, thereby providing a method for flexible scheduling and deduction of resources (inventory) that is transparent to users, flexible, efficient, simple and easy to use. Description of the Drawings

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0042] Figure 1 Schematic diagram of the method for virtual resource allocation in the prior art in the embodiments of the present invention;

[0043] Figure 2 Flow chart of the virtual resource allocation method based on distribution in the embodiments of the present invention Figure 1 ;

[0044] Figure 3 Flow chart of the virtual resource allocation method based on distribution in the embodiments of the present invention Figure 2 ;

[0045] Figure 4 Flow chart of the virtual resource allocation method based on distribution in the embodiments of the present invention Figure 3 ;

[0046] Figure 5 Schematic diagram of the flow of step 300 in the embodiments of the present invention;

[0047] Figure 6 Schematic diagram of the flow of step 302 in the embodiments of the present invention;

[0048] Figure 7 Flow chart of the virtual resource allocation method based on distribution in the embodiments of the present invention Figure 4 ;

[0049] Figure 8 It is a schematic flowchart of the distributed-based virtual resource allocation method in the specific embodiment of the present invention;

[0050] Figure 9 It is a schematic diagram of the method for virtual resource allocation provided in the specific embodiment of the present invention;

[0051] Figure 10 It is a block diagram of the distributed-based virtual resource allocation device in the embodiment of the present invention Figure 1 ;

[0052] Figure 11 It is a block diagram of the distributed-based virtual resource allocation device in the embodiment of the present invention Figure 2 ;

[0053] Figure 12 It is a block diagram of the distributed-based virtual resource allocation device in the embodiment of the present invention Figure 3 ;

[0054] Figure 13 It is a block diagram of the virtual resource request sending module 30 in the embodiment of the present invention;

[0055] Figure 14 It is a block diagram of the virtual resource request sending unit 302 in the embodiment of the present invention;

[0056] Figure 15 It is a block diagram of the distributed-based virtual resource allocation device in the embodiment of the present invention Figure 4 ;

[0057] Figure 16 It is a schematic structural diagram of the electronic device in the embodiment of the present invention. Specific Embodiment

[0058] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0059] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0060] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or devices. Without conflict, the embodiments in this application and the features in the embodiments can be combined with each other. The following will refer to the drawings and combine the embodiments to detail this application.

[0061] Based on the above technical pain points in the prior art, embodiments of the present invention provide a specific implementation manner of a distributed-based virtual resource allocation method. Refer to Figure 2 , and the method specifically includes the following content:

[0062] Step 100: Register the quantity of virtual resources stored in each distributed database into the global distributed cache;

[0063] Distributed database cache refers to an independent cache system added between the database system and the application system in a high-concurrency environment to relieve the database pressure and improve the system response time. In a high-concurrency environment, for example, in the context of the era of big data, hundreds of millions of game players flood into the game server at the same time. At this time, if access is not intercepted and a large number of read and write requests are directed to the database, since the processing speed of the disk and the memory are obviously not in the same order of magnitude, the server will soon crash. Considering both relieving the database pressure and improving the system response speed, a layer of cache will be added before the database. The greater the access pressure, the more requests such as CDN interception of pictures will start before the cache. Specifically, the application scenarios of distributed cache include:

[0064] 1. Page cache. Used to cache content fragments of Web pages, including HTML, CSS, and pictures, etc.;

[0065] 2. Application object cache. The cache system provides services externally as the second-level cache of the ORM framework, aiming to relieve the load pressure on the database and accelerate application access;

[0066] 3. Solve the session synchronization problem in distributed Web deployment and state caching. The cache includes Session session states and state data during the horizontal expansion of applications, etc. Such data is generally difficult to recover and has high requirements for availability, and is mostly applied to highly available clusters.

[0067] 4. Parallel processing. Usually involves a large number of intermediate calculation results that need to be shared;

[0068] In step 100, based on the idea of global distributed caching, the applicant provides a virtual resource request matching method, effectively solving the problem that when there is still remaining overall resources but some sets are unavailable due to uneven resource consumption caused by different set (distributed database) load differences.

[0069] Step 200: Receive the user's virtual resource request;

[0070] With the rapid development of Internet technology, online shopping has become more and more popular. Subsequently, major e-commerce platforms will launch preferential activities during major festivals, such as Double Eleven, Double Twelve, etc. And such preferential activities are often pushed to users in virtual forms, such as coupons of 100 minus 5 yuan, buy 100 get 20 free. On the other hand, as the number of e-commerce platforms gradually increases, merchants will give consumers such coupons on different e-commerce platforms. In such a scenario, it often occurs that after the coupons on e-commerce platform A are all claimed, there are still users who want to participate in the preferential activities, but at this time, e-commerce platform A no longer has such coupons, while other e-commerce platforms still have surplus. Even more, because some e-commerce platforms do not perform concurrent control on shopping data, some users are informed in advance that they can participate in the activity, but later they are informed that the coupons have been claimed and they cannot participate, resulting in a large number of user complaints and customer loss.

[0071] Preferably, the virtual resources include: shopping coupons, website memberships, movie viewing coupons, sports event viewing coupons, and preferential electronic vouchers for physical stores, such as: buy 30 minus 5 yuan in convenience stores (consumers can enjoy corresponding discounts when presenting this voucher at the physical store checkout), etc.

[0072] Step 300: Send the virtual resource request to the corresponding distributed database according to the global distributed cache.

[0073] Specifically, first determine the virtual resource that the user wants to apply for according to the virtual resource request. Then, query this virtual resource in the global distributed cache. If there is, further determine the distributed database corresponding to this virtual resource in the global distributed cache, and finally send this virtual resource request to this distributed database.

[0074] As can be seen from the above description, the embodiment of the present invention provides a distributed-based virtual resource request matching method, including: First, register the quantity of virtual resources stored in each distributed database into the global distributed cache; then, receive the virtual resource request from the user; and finally, send the virtual resource request to the corresponding distributed database according to the global distributed cache. The present invention first performs service abstraction on the deduction of virtual resources (inventory), and then instantaneously updates the global cache of the sub-set database resources during use, thereby providing a method for flexible scheduling and deduction of resources (inventory) that is transparent to users, flexible, efficient, simple and easy to use.

[0075] In one embodiment, referring to Figure 3 , the distributed-based virtual resource request matching method further includes:

[0076] Step 400: Update the global distributed cache in real time according to the quantity of the virtual resources.

[0077] Specifically, store all inventory information of the same activity for a certain virtual resource in the form of a set, which is convenient for one-time query and return in the resource deduction service. When updating, the activity ID (corresponding to the virtual resource ID) and the set number can be specified to update the inventory information of a single resource.

[0078] In one embodiment, referring to Figure 4 , the distributed-based virtual resource request matching method further includes:

[0079] Step 500: Parse the virtual resource request to determine the user ID and the virtual resource ID requested by the user.

[0080] First, find the class file in the virtual resource application request, and then find the header file in the class file. Parse the header file through the Document object to obtain different elements of the virtual resource application request, such as the user ID and the virtual resource ID requested by the user.

[0081] In one embodiment, referring to Figure 5 , step 300 includes:

[0082] Step 301: Traverse the global distributed cache according to the virtual resource ID to find the distributed database storing the virtual resource;

[0083] Specifically, query the inventory information of all sets in the global distributed cache according to the virtual resource ID. If the current set inventory information is registered and is 0, it means that the current set inventory is insufficient. Then, select any set from other registered sets with remaining inventory to complete the resource collection (i.e., deduction). If none are available, return information such as "no inventory for the customer". Further, along a certain search route in the global distributed cache, access each set in the global distributed cache once and only once.

[0084] Step 302: Send the virtual resource request to the distributed database storing the virtual resource.

[0085] All sets of libraries can be numbered, and the virtual resource ID can be searched in the global distributed cache according to the numbering order. Preferably, when a target virtual resource is stored in a certain set, the traversal operation is exited to save resources.

[0086] In one embodiment, refer to Figure 6 , step 302 includes:

[0087] Step 3021: When the number of distributed databases storing the virtual resource is multiple, determine the optimal distributed database according to the user ID, and send the virtual resource request to the optimal distributed database.

[0088] Specifically, first determine the network communication costs between the user and multiple distributed databases respectively, then determine the storage costs of the virtual resources stored in each distributed database, and establish corresponding constraint conditions according to a preset goal, such as the minimum storage cost or the minimum network communication cost, etc. Finally, establish a model for minimizing the allocation cost based on the network communication cost, storage cost, and constraint conditions, and determine the optimal distributed database according to this model.

[0089] In one embodiment, refer to Figure 7 , the distributed virtual resource request matching method further includes:

[0090] Step 600: Modify the version number of the virtual resource ID.

[0091] It is understandable that not all virtual resource requests are successful. For example, network terminals or user repentance, etc. Therefore, in order to avoid data processing errors caused by reasons such as database cache reading and long business processing time, a method is proposed here. Specifically, a data version number version field is added to the data table to represent the number of times the data has been modified. When the data is modified, the version value will be incremented by 1. When thread A wants to update the data, it will also read the version value while reading the data. When submitting the update, if the version value read just now is equal to the current version value in the database, the update will be performed; otherwise, the update operation will be retried until the update is successful.

[0092] In another embodiment, the technical effect of step 700 can also be achieved through the atomic variable CAS in the java.util.concurrent.atomic package in Java. Specifically, if the value at the memory location matches the expected original value, the value at that location will be automatically updated to the new value. Otherwise, no operation will be performed. In either case, the value at that location will be returned before the CAS instruction.

[0093] In a specific implementation manner, the present invention also provides a specific implementation manner of a distributed-based virtual resource allocation method. See Figure 8 and Figure 9 , which specifically includes the following content.

[0094] In the existing distributed application scenarios, the requests of different users can be routed through consistent hashing and transferred to the specified set for processing, so as to achieve flexible expansion of the system's concurrent throughput capacity.

[0095] Specifically, through routing, different categories / characteristics of data can be routed to the specified distributed database set. According to the results calculated by certain algorithms such as user ID and activity ID, they are evenly distributed to N sets, which can ensure that business data is relatively evenly distributed among multiple databases. For process data such as transaction logs and transaction details; protocol data related to users, etc. can all better adapt to this rule. However, for resource data such as product inventory, there may be certain problems.

[0096] Based on the above technical pain points, the distributed-based virtual resource allocation method provided by this specific implementation manner includes the following steps:

[0097] S1: Abstract the virtual resource (inventory) deduction service, including resource deduction access service and resource deduction service.

[0098] S2: The resource deduction access service is responsible for providing a complete resource deduction service to the original resource usage service (such as the coupon receiving service), including resource allocation among multiple sets.

[0099] For the resource deduction access service, input the activity ID, and query the distributed cache according to the activity ID to obtain all set inventory information. If the inventory information of this set is registered and is 0, it means that the inventory of the current set is insufficient. Then, select any one set from other registered sets with remaining inventory to complete the resource collection (i.e., deduction); otherwise, directly complete the resource collection from the current set.

[0100] S3: Register the latest remaining resource quantity into the redis global distributed cache.

[0101] The resource deduction service is only responsible for the deduction processing of resources within this set. Specifically, input the activity ID, subtract 1 from the inventory corresponding to this activity ID in the current database. If the deduction is successful, return success and update the remaining inventory after subtraction to the distributed cache; if the deduction fails, return failure and update the inventory of the current set corresponding to this activity ID to 0.

[0102] Then, perform the resource deduction database operation. First, query and return the inventory in the way of select for update through the activity ID, lock the record, and then update the inventory - 1 into the database.

[0103] Finally, perform the resource update distributed cache operation. Store all inventory information of the same activity in the form of hset, which is convenient for querying and returning all at once in the resource deduction service. When updating, the activity ID and set number can be specified to update the inventory information of a single resource.

[0104] From the above description, the embodiments of the present invention provide a distributed-based virtual resource request matching method, including: First, register the quantity of virtual resources stored in each distributed database into the global distributed cache; then, receive the user's virtual resource request; finally, send the virtual resource request to the corresponding distributed database according to the global distributed cache. Specifically, the present invention has the following beneficial effects:

[0105] 1. Fundamentally solve the problem that under the distributed application architecture, due to the load difference of different sets, the uneven resource consumption leads to the situation that although there are still remaining overall resources, some sets are unavailable.

[0106] 2. Through the application of distributed cache and the design of service layering, realize the automatic allocation of resource services at the access layer, achieve transparency to users, meet the design requirements of high cohesion and low coupling, and have good scalability.

[0107] 3. For the use of resource data other than "process data such as transaction logs and transaction details; protocol data related to users, etc." (such as commodity inventory, etc.) in a distributed application architecture, it has universality.

[0108] Based on the same inventive concept, an embodiment of the present application further provides a distributed virtual resource request matching device, which can be used to implement the method described in the above embodiment, as shown in the following embodiment. Since the principle of the distributed virtual resource request matching device for solving problems is similar to that of the distributed virtual resource request matching method, the implementation of the distributed virtual resource request matching device can refer to the implementation of the distributed virtual resource request matching method, and the repeated parts will not be elaborated. Hereinafter, the term "unit" or "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation in hardware, or a combination of software and hardware, is also possible and contemplated.

[0109] An embodiment of the present invention provides a specific implementation manner of a distributed virtual resource request matching device that can implement the distributed virtual resource request matching method, see Figure 10 , the distributed virtual resource request matching device specifically includes the following:

[0110] The virtual resource registration module 10 is used to register the quantity of virtual resources stored in each distributed database into the global distributed cache;

[0111] The virtual resource request module 20 is used to receive the virtual resource request of the user;

[0112] The virtual resource request sending module 30 is used to send the virtual resource request to the corresponding distributed database according to the global distributed cache.

[0113] In one embodiment, see Figure 11 , the distributed virtual resource request matching device further includes:

[0114] The data update module 40 is used to update the global distributed cache in real time according to the quantity of the virtual resources.

[0115] In one embodiment, see Figure 12 , the distributed virtual resource request matching device further includes:

[0116] The request parsing module 50 is used to parse the virtual resource request to determine the user ID and the virtual resource ID requested by the user.

[0117] In one embodiment, see Figure 13 , the virtual resource request sending module 30 includes:

[0118] A resource search unit 301 is configured to traverse the global distributed cache according to the virtual resource ID to find a distributed database storing the virtual resource.

[0119] A virtual resource request sending unit 302 is configured to send the virtual resource request to the distributed database storing the virtual resource.

[0120] In one embodiment, referring to Figure 14 , the virtual resource request sending unit 302 includes:

[0121] An optimal database determination unit 3021 is configured to, when the number of distributed databases storing the virtual resource is multiple, determine an optimal distributed database according to the user ID, and send the virtual resource request to the optimal distributed database.

[0122] In one embodiment, referring to Figure 15 , the distributed virtual resource request matching device further includes:

[0123] A version number modification module 60 is configured to modify the version number of the virtual resource ID.

[0124] As can be seen from the above description, the embodiments of the present invention provide a distributed virtual resource request matching device, including: First, register the number of virtual resources stored in each distributed database in the global distributed cache; then, receive a user's virtual resource request; and finally send the virtual resource request to the corresponding distributed database according to the global distributed cache. Specifically, the present invention has the following beneficial effects:

[0125] 1. Fundamentally solve the problem that in a distributed application architecture, due to different set load differences, uneven resource consumption occurs, resulting in the situation that although there is still remaining overall resources, some sets are unavailable.

[0126] 2. Through the application of distributed cache and service layering design, automatic allocation of resource services is achieved at the access layer, making it transparent to users, meeting the design requirements of high cohesion and low coupling, and having good scalability.

[0127] 3. It has universality for the use of resource data (such as commodity inventory, etc.) other than "process data such as transaction logs and transaction details; protocol data related to users, etc." in a distributed application architecture.

[0128] The embodiments of the present application also provide a specific implementation manner of an electronic device that can implement all the steps in the above-mentioned distributed virtual resource request matching method. Refer to Figure 16, the electronic device specifically includes the following:

[0129] A processor 1201, a memory 1202, a communications interface 1203, and a bus 1204;

[0130] Among them, the processor 1201, the memory 1202, and the communications interface 1203 communicate with each other through the bus 1204; the communications interface 1203 is used to implement information transmission between related devices such as server-side devices and client-side devices;

[0131] The processor 1201 is used to call a computer program in the memory 1202. When the processor executes the computer program, all steps in the above-mentioned distributed-based virtual resource request matching method in the embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0132] Step 100: Register the quantity of virtual resources stored in each distributed database into the global distributed cache;

[0133] Step 200: Receive a virtual resource request from a user;

[0134] Step 300: Send the virtual resource request to the corresponding distributed database according to the global distributed cache.

[0135] An embodiment of the present application further provides a computer-readable storage medium capable of implementing all steps in the above-mentioned distributed-based virtual resource request matching method. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, all steps in the above-mentioned distributed-based virtual resource request matching method are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0136] Step 100: Register the quantity of virtual resources stored in each distributed database into the global distributed cache;

[0137] Step 200: Receive a virtual resource request from a user;

[0138] Step 300: Send the virtual resource request to the corresponding distributed database according to the global distributed cache.

[0139] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the hardware + program type embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the relevant content.

[0140] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0141] Although this application provides method operation steps such as in the embodiments or flowcharts, based on routine or non-creative labor, there can be more or fewer operation steps. The order of steps listed in the embodiments is only one way among many orderings of step execution and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order shown in the embodiments or the figures or in parallel (e.g., in an environment with parallel processors or multithreaded processing).

[0142] For convenience of description, when describing the above device, it is divided into various modules according to functions for separate description. Of course, when implementing the embodiments of this specification, the functions of each module can be implemented in the same or multiple software and / or hardware, or the modules implementing the same function can be realized by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0143] Those skilled in the art also know that, in addition to implementing the controller in the form of pure computer-readable program code, the method steps can be logically programmed to enable the controller to implement the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Therefore, such a controller can be regarded as a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or structures within the hardware component.

[0144] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0145] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash RAM. The memory is an example of computer-readable media.

[0146] The embodiments of this specification can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The embodiments of this specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0147] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For related parts, reference can be made to the partial description of the method embodiments. In the description of this specification, the description with reference to terms such as "an embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the embodiments of this specification. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0148] The above are only examples of the embodiments of this specification and are not used to limit the embodiments of this specification. For those skilled in the art, various modifications and changes can be made to the embodiments of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of this specification shall be included within the scope of the claims of the embodiments of this specification.

Claims

1. A distributed-based virtual resource request matching method, characterized in that, it includes: Register the quantity of virtual resources stored in each distributed database into the global distributed cache; Receive the virtual resource request of the user; Parse the virtual resource request to determine the user ID and the virtual resource ID requested by the user; Query the inventory information of all sets in the global distributed cache according to the virtual resource ID. If the virtual resource ID is registered in the current set inventory information and the quantity of the virtual resource ID is 0, it means that the current set inventory is insufficient. Then, select any one set from other sets that have the virtual resource ID registered and still have inventory, and complete the inventory deduction of the virtual resource ID; Send the virtual resource request to the distributed database storing the virtual resource; wherein, the global distributed cache is an independent cache system added between the database system and the application system in a high-concurrency environment to reduce the database pressure and improve the response speed of the application system.

2. The virtual resource request matching method according to claim 1, characterized in that, it further includes: Update the global distributed cache in real time according to the quantity of the virtual resources.

3. The virtual resource request matching method according to claim 1, characterized in that, The step of sending the virtual resource request to the distributed database storing the virtual resource includes: When the number of distributed databases storing the virtual resource is multiple, determine the optimal distributed database according to the user ID, and send the virtual resource request to the optimal distributed database.

4. The virtual resource request matching method according to claim 3, characterized in that, After sending the virtual resource request to the corresponding distributed database according to the global distributed cache, it further includes: Modify the version number of the virtual resource ID.

5. The virtual resource request matching method according to claim 1, characterized in that, The step of registering the quantity of virtual resources stored in each distributed database into the global distributed cache includes: Register the quantity of virtual resources of this category into the global distributed cache according to the virtual resource category.

6. A distributed-based virtual resource request matching device, characterized in that, it includes: A virtual resource registration module, used to register the quantity of virtual resources stored in each distributed database into the global distributed cache; wherein, the global distributed cache is an independent cache system added between the database system and the application system in a high-concurrency environment to reduce the database pressure and improve the response speed of the application system; A virtual resource request module, used to receive the virtual resource request of the user; A virtual resource request sending module, used to parse the virtual resource request to determine the user ID and the virtual resource ID requested by the user; Query the inventory information of all sets in the global distributed cache according to the virtual resource ID. If the virtual resource ID is registered in the current set inventory information and the quantity of the virtual resource ID is 0, it means that the current set is out of stock. Then, select any set from other sets that have the virtual resource ID registered and still have inventory, and complete the inventory deduction of the virtual resource ID; send the virtual resource request to the distributed database storing the virtual resource.

7. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, when the processor executes the program, it implements the steps of the distributed-based virtual resource request matching method according to any one of claims 1 to 5.

8. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, it implements the steps of the distributed-based virtual resource request matching method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Inventory data processing method and device

    CN105468690A