Resource updating method, device, electronic device and storage medium

By adjusting the resource margin and determining the resource type according to the margin, the problem of low resource update efficiency in the existing technology is solved, and more efficient resource management and performance improvement are achieved.

CN114896074BActive Publication Date: 2025-01-24BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210640553.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2025-01-24
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

When the prior art provides both limited and unlimited resources, the resource update efficiency is inefficient, resulting in increased equipment burden.

Method used

By responding to the resource request, the current balance of the target resource is adjusted, and the resource type is determined based on the comparison between the adjusted balance and the preset judgment value. If the resource type is the first resource type, restore the remaining amount to the initial supply value.

Benefits of technology

Reduce the number of queries when resource renewal, reduce the equipment load, and improve the efficiency and performance of resource renewal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896074B_ABST
    Figure CN114896074B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a resource update method, device, electronic device, storage medium and computer program product. The method includes: in response to a resource request for a target resource in a resource platform, adjusting the current balance of the target resource in the resource platform based on the request quantity corresponding to the resource request; determining the resource type of the target resource in the resource platform based on the comparison result of the adjusted current balance and a preset balance threshold; if the resource type is a first resource type, restoring the current balance of the target resource in the resource platform to the initial supply value corresponding to the first resource type. In the scheme of the present disclosure, the resource type of the target resource can be determined based on the adjusted current balance, and the adjusted current balance does not need to be obtained through a query operation, so it can avoid querying in each resource call process, effectively reducing the number of queries and reducing the device load, thereby improving the resource update efficiency and performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of computer technology, in order to facilitate the provision of resources to the outside or statistical resource changes, the resource margin of resources can be recorded to perform corresponding operations according to the resource margin of resources.

[0003] In the related art, when resources are successfully called or deducted, the resource margin can be updated and the information of successful resource call can be returned to the device to prompt that the corresponding resource call operation has been executed. When limited resources with limited resource quantity and infinite resources with unlimited resource quantity are provided at the same time, in order to be compatible with resource updates of both resources at the same time, the resource margin of the infinite resource can be set to a negative number. If a resource call request is received, the resource margin is first queried. Since the resource margin of a limited resource is often a number greater than or equal to zero, if the resource margin is detected to be a negative number, it can be determined that the currently requested resource is an infinite resource, so the resource margin can be not updated, but the information of successful call can be directly returned.

[0004] However, when the above method provides both limited resources and unlimited resources, no matter it is limited resources or unlimited resources, it is necessary to check whether the resource margin is negative before each update of the resource margin, which significantly increases the number of queries, increases the burden on the equipment, and has the problem of low resource update efficiency. Summary of the invention

[0005] The present disclosure provides a resource update method, device, electronic device, storage medium and computer program product to at least solve the problem of low resource update efficiency in related technologies. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a resource updating method is provided, including:

[0007] In response to a resource request for a target resource in a resource platform, adjusting a current surplus of the target resource in the resource platform based on a request quantity corresponding to the resource request;

[0008] Based on the comparison result of the adjusted current surplus and the preset judgment value, the resource type of the target resource in the resource platform is determined; the resource type includes a first resource type and a second resource type, and the first resource type and the second resource type are two classifications obtained based on the initial value of the supply amount of the resource in the resource platform; the judgment value is less than the initial value of the supply amount of the resource of the first resource type in the resource platform, and is greater than the initial value of the supply amount of the resource of the second resource type in the resource platform;

[0009] If the resource type is the first resource type, the current remaining quantity of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource type.

[0010] In an exemplary embodiment, determining the resource type of the target resource in the resource platform based on a comparison result between the adjusted current margin and a preset determination value includes:

[0011] If the adjusted current margin is greater than the determination value, determining that the resource type of the target resource in the resource platform is the first resource type;

[0012] If the adjusted current margin is less than the determination value, it is determined that the resource type of the target resource in the resource platform is the second resource type.

[0013] In an exemplary embodiment, before responding to a resource request for a target resource in a resource platform and adjusting a current margin of the target resource in the resource platform based on a request quantity corresponding to the resource request, the method further includes:

[0014] Obtaining an initial value of the supply of the second type of resources in the resource platform, and obtaining a peak value of the number of requests per unit time of the resource platform, wherein the peak value of the number of requests is a total number of requests for various resources in the resource platform;

[0015] Obtaining a sum of the resource quantity corresponding to the peak value of the request quantity and the initial value of the supply quantity of the second resource type;

[0016] Based on the sum of the resource quantities, an initial supply quantity value of the resource corresponding to the first resource type in the resource platform is determined, and the initial supply quantity value is greater than the sum of the resource quantities.

[0017] In an exemplary embodiment, before responding to a resource request for a target resource in a resource platform and adjusting a current margin of the target resource in the resource platform based on a request quantity corresponding to the resource request, the method further includes:

[0018] Obtaining a preset positive integer, and determining the positive integer as an initial value of the supply quantity of the first resource type in the resource platform;

[0019] The positive integer is greater than an initial supply value of the resource of the second resource type in the resource platform.

[0020] In an exemplary embodiment, before responding to a resource request for a target resource in a resource platform and adjusting a current margin of the target resource in the resource platform based on a request quantity corresponding to the resource request, the method further includes:

[0021] Obtaining the peak number of requests per unit time of the resource platform;

[0022] Based on the difference between the initial supply value of the resources of the first resource type in the resource platform and the peak value of the request quantity, a determination value is determined, and the determination value is smaller than the difference.

[0023] In an exemplary embodiment, obtaining the peak number of requests per unit time of the resource platform includes:

[0024] Obtaining the concurrent request volume per unit time of the resource platform, where the concurrent request volume is the concurrent volume corresponding to the number of various resource requests in the resource platform per unit time;

[0025] Based on the maximum value of the concurrent requests, a peak value of the number of requests per unit time of the resource platform is determined.

[0026] In an exemplary embodiment, if the resource type is the first resource type, restoring the current surplus of the target resource in the resource platform to the initial supply value corresponding to the first resource type includes:

[0027] If the resource type is the first resource type, creating a supply recovery task for the target resource;

[0028] The supply recovery task is sent to an asynchronous processing node, and the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource class through the asynchronous processing node.

[0029] According to a second aspect of an embodiment of the present disclosure, there is provided a resource updating device, including:

[0030] A margin adjustment unit, configured to execute, in response to a resource request for a target resource in the resource platform, adjusting a current margin of the target resource in the resource platform based on a request quantity corresponding to the resource request;

[0031] A resource type determination unit is configured to determine the resource type of the target resource in the resource platform based on a comparison result between the adjusted current surplus and a preset judgment value; the resource type includes a first resource type and a second resource type, the first resource type and the second resource type are two classifications obtained based on an initial value of the supply amount of the resource in the resource platform; the judgment value is less than the initial value of the supply amount of the resource of the first resource type in the resource platform, and is greater than the initial value of the supply amount of the resource of the second resource type in the resource platform;

[0032] The balance recovery unit is configured to, if the resource type is the first resource type, restore the current balance of the target resource in the resource platform to an initial supply value corresponding to the first resource type.

[0033] In an exemplary embodiment, the resource type determination unit is specifically configured to execute:

[0034] If the adjusted current margin is greater than the determination value, determining that the resource type of the target resource in the resource platform is the first resource type;

[0035] If the adjusted current margin is less than the resource determination value, it is determined that the resource type of the target resource in the resource platform is the second resource type.

[0036] In an exemplary embodiment, the apparatus further comprises:

[0037] a supply quantity initial value acquisition unit, configured to execute acquisition of an initial supply quantity value of a second type of resource in a resource platform, and a request quantity peak value acquisition unit, configured to execute acquisition of a request quantity peak value per unit time of the resource platform, wherein the request quantity peak value is a total request quantity for various resources in the resource platform;

[0038] A resource quantity sum determination unit is configured to execute acquisition of the sum of resource quantities corresponding to the peak value of the request quantity and the initial value of the supply quantity of the second resource type;

[0039] An initial value of supply quantity is provided in the resource platform, and the initial value of supply quantity is greater than the sum of the resource quantities.

[0040] In an exemplary embodiment, the apparatus further comprises:

[0041] A positive integer acquisition unit, configured to acquire a preset positive integer and determine the positive integer as an initial value of the supply quantity of the first resource type in the resource platform;

[0042] The positive integer is greater than an initial supply value of the resource of the second resource type in the resource platform.

[0043] In an exemplary embodiment, the apparatus further comprises:

[0044] A request quantity peak value acquisition unit, configured to execute acquisition of a request quantity peak value per unit time of the resource platform;

[0045] The determination value determining unit is configured to determine a determination value based on a difference between an initial supply value of resources of the first resource type in the resource platform and a peak value of the request quantity, wherein the determination value is smaller than the difference.

[0046] In an exemplary embodiment, the request quantity peak value obtaining unit is specifically configured to execute:

[0047] Obtaining the concurrent request volume per unit time of the resource platform, where the concurrent request volume is the concurrent volume corresponding to the number of various resource requests in the resource platform per unit time;

[0048] Based on the maximum value of the concurrent requests, a peak value of the number of requests per unit time of the resource platform is determined.

[0049] In an exemplary embodiment, the margin recovery unit is specifically configured to execute:

[0050] If the resource type is the first resource type, creating a supply recovery task for the target resource;

[0051] The supply recovery task is sent to an asynchronous processing node, and the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource class through the asynchronous processing node.

[0052] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0053] processor;

[0054] a memory for storing instructions executable by the processor;

[0055] The processor is configured to execute the instructions to implement any of the resource updating methods described above.

[0056] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the resource updating methods described above.

[0057] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, wherein the computer program product includes instructions, and when the instructions are executed by a processor of an electronic device, the electronic device is enabled to execute any of the resource update methods described above.

[0058] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0059] The resource update method, device, electronic device, storage medium and computer program product described above, in response to a resource request for a target resource in a resource platform, the server can adjust the current balance of the target resource in the resource platform based on the request quantity corresponding to the resource request, and determine the resource type of the target resource in the resource platform based on the comparison result of the adjusted current balance and the preset judgment value, wherein the resource type includes a first resource type and a second resource type, and the first resource type and the second resource type are two classifications obtained based on the initial value of the supply of the resource in the resource platform; the judgment value is less than the initial value of the supply of the resource of the first resource type in the resource platform, and is greater than the initial value of the supply of the resource of the second resource type in the resource platform; further, if the resource type is the first resource type, the server can restore the current balance of the target resource in the resource platform to the initial value of the supply corresponding to the first resource type. In the scheme disclosed in the present invention, the resource type of the target resource can be determined based on the adjusted current balance, and the adjusted current balance can avoid querying in each resource call process because it does not need to be obtained through a query operation, effectively reducing the number of queries and reducing the device load, thereby improving the resource update efficiency and performance.

[0060] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0062] Figure 1 The diagram is an application environment diagram of a resource updating method according to an exemplary embodiment.

[0063] Figure 2 The figure is a flow chart of a resource updating method according to an exemplary embodiment.

[0064] Figure 3 The present invention is a flowchart showing a step of determining an initial value of a first resource type according to an exemplary embodiment.

[0065] Figure 4 The figure is a flowchart showing a step of determining a determination value according to an exemplary embodiment.

[0066] Figure 5 The present invention is a flowchart showing a step of determining a peak number of requests according to an exemplary embodiment.

[0067] Figure 6 The figure is a flowchart of another resource updating method according to an exemplary embodiment.

[0068] Figure 7 The invention is a block diagram of a resource updating device according to an exemplary embodiment.

[0069] Figure 8 It is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION

[0070] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0071] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0072] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0073] The resource updating method provided in the present disclosure can be applied to Figure 1 In the application environment shown. In this application environment, the terminal communicates with the server through the network, and the data storage system can store the data that the server needs to process, such as the resource balance and initial supply value corresponding to various resources in the resource platform; the data storage system can be integrated on the server, or it can be placed on the cloud or other network servers. In a specific implementation, the terminal can send a resource request for a target resource in the resource platform to the server; the server can adjust the current balance of the target resource in the resource platform based on the request quantity corresponding to the resource request in response to the resource request, and determine the resource type of the target resource in the resource platform based on the comparison result of the adjusted current balance and the preset judgment value. If it is determined that the resource type of the target resource in the resource platform is the first resource type, the server can restore the current balance of the target resource in the resource platform to the initial supply value corresponding to the first resource type.

[0074] The terminal may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server may be implemented as an independent server or a server cluster consisting of multiple servers.

[0075] Figure 2 is a flow chart of a resource updating method according to an exemplary embodiment. Figure 2 As shown, the method is applied to a server and includes the following steps.

[0076] In step 210, in response to a resource request for a target resource in the resource platform, a current margin of the target resource in the resource platform is adjusted based on a request quantity corresponding to the resource request.

[0077] As an example, the resources in the resource platform may include virtual resources, such as virtual props, points, recharge media, virtual item exchange media, etc., and of course, physical resources with corresponding entities. Among them, the resource platform can be a platform for providing and displaying resources. Different resource platforms can be developed for different applications or clients. For example, the game client and the live broadcast client can have their own resource platforms. Of course, a unified resource platform can also be set up. For example, the resources to be called by the game client and the live broadcast client can be displayed on different pages or different columns under the same resource platform.

[0078] The request quantity corresponding to the resource request may be the number of resources requested to be called by the resource request. For example, if the request quantity corresponding to the resource request is M, it indicates that a resource quantity M is requested to be called.

[0079] In a specific implementation, the resource platform may include one or more resources, and the terminal may display various resources in the resource platform. In response to a resource call trigger event for a target resource in the resource platform, such as detecting a selection operation for a target resource or the balance of a target resource in a preset account in the terminal is less than a preset threshold, the terminal may generate a resource request for the target resource and send the resource request to the server.

[0080] In response to a received resource request for a target resource in a resource platform, the server can determine the request quantity corresponding to the resource request. For example, the resource request can carry the request quantity. After receiving the resource request, the server can read the request quantity in the resource request, and then the server can adjust the current balance of the target resource in the resource platform based on the request quantity. Since the adjusted current balance is obtained by adjusting the original current balance based on the request quantity, the adjusted current balance can be automatically calculated and returned without performing a query operation on the information stored in the database. In actual applications, the adjustment of the target resource can include lowering the current balance of the target resource, for example, when a resource request to call the target resource is received, a lowering process can be performed.

[0081] In step 220, based on the comparison result between the adjusted current margin and the preset determination value, the resource type of the target resource in the resource platform is determined.

[0082] Among them, the resource type includes a first resource type and a second resource type. The first resource type and the second resource type are two classifications obtained based on the initial value of the supply of the resource in the resource platform. The supply of the resource can be understood as the number of resources that the resource platform can currently provide. The first resource type can also be called an infinite resource type, which can indicate that the target resource is a resource with an infinite supply; the second resource type can also be called a limited resource type, which indicates that the supply quantity of the target resource in the resource platform is limited. In one example, a resource can have different resource types in different resource platforms. For example, resource A can be a resource of the first resource type in the current resource platform, and can be a resource of the second resource type in another resource platform.

[0083] Although the resource supply of the first type of resources can be unlimited, there can be an initial supply value in the resource platform. For various resources of the first resource type, there can be the same initial supply value in the resource platform to facilitate unified recording and management.

[0084] For the second resource type, the initial supply value of each resource of the second resource type in the resource platform can be set according to the actual supply quantity. The initial supply value can be the maximum value of the resource of the second resource type in the resource platform. In actual applications, the initial supply value corresponding to the resource of the second resource type can be set within the range of 0 to the maximum supply quantity of the resource of the second resource type. The initial supply value of the first resource type can be much larger than the initial supply value of the second resource type. For example, the difference in the quantity of the initial supply values ​​of the two can reach a preset order of magnitude.

[0085] The predetermined determination value is smaller than an initial value of a supply amount of resources of the first resource type in the resource platform, and is larger than an initial value of a supply amount of resources of the second resource type in the resource platform.

[0086] In a specific implementation, after adjusting the current balance of the target resource in the resource platform based on the request quantity, the server can obtain a preset judgment value, and compare the adjusted current balance with the judgment value to determine whether the lowered current balance is greater than the judgment value or less than the judgment value. Since the judgment value is greater than the initial supply value of the resource of the second resource type in the resource platform, by comparing the adjusted current balance with the judgment value, the resource type of the target resource in the resource platform can be determined based on the comparison result of the two.

[0087] In step 230, if the resource type is the first resource type, the current surplus of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource type.

[0088] After determining the resource balance of the target resource in the resource platform, if the resource type of the target resource is the first resource type, the server can restore the current balance of the target resource in the resource platform to the initial supply value of a resource class in the resource platform, so that the next time a resource request is received, the server can continue to provide resources corresponding to the requested quantity, thereby realizing a continuous supply of resources.

[0089] If the resource type of the target resource is the second resource type, the server may return corresponding prompt information to the terminal to indicate that the resource request has been processed and the corresponding target resource has been called. For example, the updated resource balance of the target resource in the preset account may be displayed on the terminal.

[0090] In the above resource update method, in response to a resource request for a target resource in a resource platform, the server can adjust the current balance of the target resource in the resource platform based on the request quantity corresponding to the resource request, and determine the resource type of the target resource in the resource platform based on the comparison result of the adjusted current balance and the preset judgment value, wherein the resource type includes a first resource type and a second resource type, and the first resource type and the second resource type are two classifications obtained based on the initial value of the supply of the resource in the resource platform; the judgment value is less than the initial value of the supply of the resource of the first resource type in the resource platform, and is greater than the initial value of the supply of the resource of the second resource type in the resource platform; further, if the resource type is the first resource type, the server can restore the current balance of the target resource in the resource platform to the initial value of the supply corresponding to the first resource type. In the scheme disclosed in the present invention, the resource type of the target resource can be determined based on the adjusted current balance, and the adjusted current balance can avoid querying in each resource call process because it does not need to be obtained through a query operation, effectively reducing the number of queries and reducing the device load, thereby improving the efficiency and performance of resource updates.

[0091] In an exemplary embodiment, if Figure 3 As shown, before step 210, the method may further include:

[0092] In step 310, an initial value of the supply of the second type of resources in the resource platform is obtained, and a peak value of the number of requests per unit time of the resource platform is obtained.

[0093] Among them, the peak number of requests per unit time is the total number of requests for various resources in the resource platform within a unit time. For example, in each second, the total number of requests for all resources in the resource platform. Taking the resource platform including N resources as an example, the peak number of requests per unit time can be the total number of requests for the N resources within a unit time.

[0094] In actual applications, the initial supply value of the second type of resource in the resource platform can be obtained, and the initial supply value can be a preset value, such as determining the initial supply value within the range of 0 to the maximum supplyable quantity. In addition, the peak value of the number of requests per unit time of the resource platform can also be obtained.

[0095] In step 320, the sum of the peak value of the request quantity and the resource quantity corresponding to the initial value of the supply quantity of the second resource type is obtained.

[0096] In step 330, based on the sum of the resource quantities, an initial value of the supply quantity of the resource corresponding to the first resource type in the resource platform is determined, and the initial value is greater than the sum of the resource quantities.

[0097] Specifically, after determining the peak value of the request quantity and the initial supply value of the second resource type, the two can be summed to obtain the sum of the resource quantities, and then the initial supply value of the resources of the first resource type in the resource platform can be determined within a range greater than the sum of the resource quantities.

[0098] By determining the initial supply value of the resource of the first resource type in this way, it can be ensured that when multiple resource requests for this type of resource are received per unit time, the corresponding resource has sufficient resource margin to be called, and further ensured that after deducting or lowering the current margin of the resource, the current margin corresponding to the resource of the first resource type is still greater than the initial supply value of the second resource type, so that the corresponding resource type can be determined by comparing the current margin corresponding to the resource with the preset judgment value.

[0099] In the present disclosure, the server obtains the initial value of the supply of the second type of resources in the resource platform, and obtains the peak number of requests per unit time of the resource platform, and then obtains the sum of the resource quantities corresponding to the peak number of requests and the initial value of the supply of the second resource type. Based on the sum of the resource quantities, the server determines the initial value of the supply of the resources corresponding to the first resource type in the resource platform, and makes the initial value of the supply greater than the sum of the resource quantities, which can provide a basis for subsequently distinguishing the corresponding resource types of resources through the current remaining resources.

[0100] In another exemplary embodiment, before step 210, the method may further include:

[0101] A preset positive integer is obtained, and the positive integer is determined as an initial supply value of the first resource type in the resource platform.

[0102] The positive integer is greater than the initial supply value of the resource of the second resource type in the resource platform.

[0103] In practical applications, the initial supply value of the resource of the second resource type in the resource platform can be determined, and a positive integer can be obtained in advance in a range greater than the initial supply value of the second resource type. The positive integer can be a positive integer approaching positive infinity, or a positive integer whose order of magnitude is different from the order of magnitude corresponding to the initial supply value of the second resource type by a preset threshold. For example, the initial supply value of the first resource type can be 999999999, and the maximum initial supply value of the second resource type can be 100000. Furthermore, the preset positive integer can be used as the initial supply value of the resource of the first resource type in the resource platform.

[0104] In the present disclosure, the server may obtain a preset positive integer, and determine the positive integer as the initial value of the supply of the first resource type in the resource platform, thereby realizing rapid determination of the initial value of the first resource type.

[0105] In an exemplary embodiment, if Figure 4 As shown, before step 210, it also includes:

[0106] In step 410, the peak value of the number of requests per unit time of the resource platform is obtained.

[0107] As an example, the peak number of requests per unit time is the total number of requests for various resources in the resource platform within the unit time.

[0108] In actual applications, the peak number of requests per unit time of the resource platform can be obtained.

[0109] In step 420, a determination value is determined based on a difference between an initial supply value and a peak request value of resources of the first resource type in the resource platform, and the determination value is smaller than the difference.

[0110] After determining the peak number of requests on the resource platform, the difference between the initial supply value of the first resource type in the resource platform and the peak number of requests can be obtained. The difference can also be called the lower limit value of the resource of the first resource type. Then, the judgment value can be determined within the range that is less than the difference and greater than the initial supply value of the second resource type.

[0111] Specifically, the peak number of requests per unit time in the resource platform is M units of resources. When the initial supply value corresponding to the first resource type resource is determined based on the sum of the resource quantity corresponding to the peak number of requests and the initial value of the supply of the second resource type, such as the initial value of the supply corresponding to the second resource type is P, the initial supply value of the first resource type can be a value greater than M+P, for example, it can be M+P+2, and the judgment value can be based on the difference between M+P+2 and M, and the value range of the judgment value is determined to be (P, P+2), for example, it can be P+1. When receiving a resource request, even if all resource requests per unit time are for the same first resource type resource, that is, the peak number of requests M is for this resource, since its initial value is M+P+2, the current margin of the target resource after the reduction is P+2, and the corresponding resource margin is still greater than the judgment value, and the current margin of the first resource type after the reduction is always greater than the initial value of the supply of the second resource type. Therefore, the resource type of the target resource can be distinguished by the current margin in the future.

[0112] Based on this, the judgment value can be determined between the difference and the upper limit value of the surplus of the second resource type. In other words, the judgment value can be determined between the lower limit value of the surplus of the first resource type and the upper limit value of the surplus of the second resource type (such as the initial supply value of the resource of the second resource type on the resource platform).

[0113] In the present disclosure, the server can determine the judgment value based on the difference between the initial supply value of the first resource type in the resource platform and the peak request quantity, and at the same time make the judgment value smaller than the difference, so that the resources of the first resource type are still greater than the judgment value after being greatly deducted, providing a basis for subsequently determining the resource type through the current surplus of the resource.

[0114] In an exemplary embodiment, if Figure 5 As shown, obtaining the peak number of requests per unit time of the resource platform may include the following steps:

[0115] In step 510, the concurrent request volume per unit time of the resource platform is obtained, where the concurrent request volume is the concurrent volume corresponding to the number of resource requests of various resources in the resource platform per unit time.

[0116] In a specific implementation, the server can pre-count the concurrency corresponding to the number of resource requests for various resources in the resource platform within a unit time to obtain the request concurrency, which can be understood as the sum of the number of resource requests for various resources received by the resource platform at the same time within a unit time. For example, within 1 second, for resources A, B, and C in the resource platform, the corresponding number of resource requests is M1 units of resource A, M2 units of resource B, and M3 units of resource C, respectively. Then the request concurrency per unit time can be the sum of M1, M2, and M3.

[0117] In one example, the concurrent request volume per unit time may be determined based on the query per second (QPS) of the resource platform. For example, the value corresponding to the query per second may be used as the concurrent request volume per unit time.

[0118] In step 520, based on the maximum value of the concurrent requests, the peak value of the number of requests per unit time of the resource platform is determined.

[0119] Specifically, since the number of visits to the resource platform will change over time, the number of concurrent requests per unit time corresponding to different times can be obtained. After obtaining multiple concurrent requests per unit time, the multiple concurrent requests can be compared, and based on the maximum value of the concurrent requests, the peak number of requests per unit time of the resource platform can be determined.

[0120] In the present disclosure, the server can obtain the concurrent request volume of the resource platform per unit time, and determine the peak number of requests per unit time of the resource platform based on the maximum value of the concurrent request volume, and then determine the initial value of the supply of the first resource type in the resource platform or determine a preset judgment value based on the peak number of requests. When the resources of the first resource type are reduced to the maximum, the current remaining amount after reduction is still greater than the judgment value, thereby effectively improving the accuracy of the resource type identification results.

[0121] In an exemplary embodiment, in step 220, determining the resource type of the target resource in the resource platform based on the comparison result of the adjusted current margin and the preset determination value may include the following steps:

[0122] If the adjusted current margin is greater than the judgment value, the resource type of the target resource in the resource platform is determined to be the first resource type; if the adjusted current margin is less than the judgment value, the resource type of the target resource in the resource platform is determined to be the second resource type.

[0123] In practical applications, the current margin of the target resource may be adjusted, and the adjustment may include lowering and / or raising, for example, successively raising and lowering within a preset time. After obtaining the adjusted current margin, it may be determined whether the adjusted current margin is greater than a preset determination value.

[0124] If the adjusted current margin is greater than the judgment value, since the judgment value is greater than the initial supply value of the resource of the second resource type in the resource platform, in other words, the adjusted current margin of the target resource is also greater than the initial supply value of the resource of the second resource type in the resource platform, and the adjusted current margin is not the resource margin that the resource of the second resource type can have, so when the current margin is greater than the judgment value, the resource type of the target resource in the resource platform can be determined to be the first resource type. And, since the judgment value is a resource margin value used to divide resource types, therefore, if the adjusted current margin is less than the judgment value, the resource type of the target resource in the resource platform can be determined to be the second resource type.

[0125] In another example, when resources of a first resource type and resources of a second resource type are provided at the same time, the initial supply value corresponding to the resources of the first resource type can be set to a preset margin that is much larger than the initial supply value of the resources of the second resource type, and a corresponding resource type tag can be set for each resource, such as setting a tag of the first resource type or setting a tag of the second resource type. When a resource request is received, the current margin of the corresponding resource can be updated according to the request quantity corresponding to the resource request. At the same time, the resource type tag of each resource is scanned at a preset time interval, and the resources of the first resource type are determined from the resource platform according to the resource type tag, and the corresponding current margin is restored to the preset margin. However, this method requires the introduction of an additional scheduled task to scan the resource type tag, which increases the complexity of resource updates, and because the resource type is determined by the resource type tag, it is also necessary to maintain the resource type tag of each resource to ensure the consistency of the resource and the resource type tag.

[0126] In the present disclosure, by comparing the adjusted current balance with the judgment value each time the current balance is obtained, the resource type of the target resource in the resource platform can be quickly determined without setting resource type labels or introducing additional scheduled tasks, thereby avoiding additional maintenance of resource type labels corresponding to various resources in the resource platform, simplifying the resource update method, and reducing the complexity of resource updates and code maintenance costs.

[0127] Of course, in another example, for the first resource type, its corresponding resource type tag can also be set in the context for use in subsequent operations, but in the process of updating the resource margin, the resource type can be determined directly based on the resource margin without querying the resource type tag.

[0128] In an exemplary embodiment, in step 230, if the resource type is the first resource type, restoring the current balance of the target resource in the resource platform to the initial supply value corresponding to the first resource type may include the following steps:

[0129] If the resource type is the first resource type, a supply recovery task is created for the target resource; the supply recovery task is sent to the asynchronous processing node, and the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource type through the asynchronous processing node.

[0130] In a specific implementation, if the resource type is the first resource type, the server may create a supply recovery task for the target resource, and the supply recovery task is used to recover the adjusted current balance. After creating the supply recovery task, the server may not process it immediately, but send the supply recovery task to the asynchronous processing node, triggering the asynchronous processing node to recover the current balance of the target resource in the resource platform to the initial supply value corresponding to the first resource type. Exemplarily, the asynchronous processing node may include at least one of an asynchronous thread pool or a message queue.

[0131] In the present disclosure, the server sends a supply recovery task to the asynchronous processing node, triggering the asynchronous processing node to restore the current balance of the target resource in the resource platform to the initial supply value corresponding to the first resource type, and can perform a resource balance recovery operation to ensure that the supply of the target resource of the first resource type in the resource platform is not less than the judgment value, thereby providing a basis for subsequent adjustment of the current balance and accurate identification of the resource type based on the current balance; and the present disclosure can only perform a supply recovery operation when it identifies that the resource type of the target resource is the first resource type, thereby avoiding too much pressure on the storage system; at the same time, by restoring the balance through the asynchronous processing node, it can effectively reduce the data processing pressure of the server, maintain high-performance operation of the server, and provide a basis for efficient resource updates.

[0132] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present disclosure is illustrated below by using an example, but it should be understood that the embodiment of the present disclosure is not limited thereto.

[0133] like Figure 6 As shown, in step 610, a preset positive integer is obtained, and the positive integer is determined as the initial supply value of the first resource type in the resource platform. For example, the maximum initial supply value of the second resource type is 999999, and the initial supply value of the first resource type in the resource platform can be determined as 9999999999.

[0134] In step 620, the peak number of requests per unit time of the resource platform is obtained, and the judgment value is determined based on the difference between the initial supply value of the resource of the first resource type in the resource platform and the peak number of requests. For example, when the peak number of requests is 500,000 / s, the judgment value can be set to 999499990.

[0135] In step 630 , in response to a resource request for a target resource in the resource platform, a current margin of the target resource in the resource platform is reduced based on a request quantity corresponding to the resource request.

[0136] In step 640 , based on the comparison result between the lowered current margin and the preset determination value, the resource type of the target resource in the resource platform is determined.

[0137] In step 650, if the resource type is the first resource type, the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource type. For example, a set operation can be performed to restore the current balance of the target resource to the initial supply value 9999999999.

[0138] In step 660, if the resource type is the second resource type, a request processing result is returned for the resource request.

[0139] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0140] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.

[0141] Based on the same inventive concept, the embodiment of the present disclosure also provides a resource updating device for implementing the resource updating method involved above.

[0142] Figure 7 FIG. 7 is a block diagram of a resource updating device 700 according to an exemplary embodiment. Figure 7 The device includes a margin adjustment unit 701, a resource type determination unit 702 and a margin recovery unit 703.

[0143] The margin adjustment unit 701 is configured to execute, in response to a resource request for a target resource in the resource platform, adjusting a current margin of the target resource in the resource platform based on a request quantity corresponding to the resource request;

[0144] The resource type determination unit 702 is configured to determine the resource type of the target resource in the resource platform based on the comparison result of the adjusted current surplus and the preset judgment value; the resource type includes a first resource type and a second resource type, the first resource type and the second resource type are two classifications obtained based on the initial value of the supply amount of the resource in the resource platform; the judgment value is less than the initial value of the supply amount of the resource of the first resource type in the resource platform, and is greater than the initial value of the supply amount of the resource of the second resource type in the resource platform;

[0145] The balance recovery unit 703 is configured to, if the resource type is the first resource type, restore the current balance of the target resource in the resource platform to an initial supply value corresponding to the first resource type.

[0146] In an exemplary embodiment, the resource type determination unit 702 is specifically configured to execute:

[0147] If the adjusted current margin is greater than the determination value, determining that the resource type of the target resource in the resource platform is the first resource type;

[0148] If the adjusted current margin is less than the resource determination value, it is determined that the resource type of the target resource in the resource platform is the second resource type.

[0149] In an exemplary embodiment, the apparatus further comprises:

[0150] a supply quantity initial value acquisition unit, configured to execute acquisition of an initial supply quantity value of a second type of resource in a resource platform, and a request quantity peak value acquisition unit, configured to execute acquisition of a request quantity peak value per unit time of the resource platform, wherein the request quantity peak value is a total request quantity for various resources in the resource platform;

[0151] A resource quantity sum determination unit is configured to execute acquisition of the sum of resource quantities corresponding to the peak value of the request quantity and the initial value of the supply quantity of the second resource type;

[0152] An initial value of supply quantity is provided in the resource platform, and the initial value of supply quantity is greater than the sum of the resource quantities.

[0153] In an exemplary embodiment, the apparatus further comprises:

[0154] A positive integer acquisition unit, configured to acquire a preset positive integer and determine the positive integer as an initial value of the supply quantity of the first resource type in the resource platform;

[0155] The positive integer is greater than an initial supply value of the resource of the second resource type in the resource platform.

[0156] In an exemplary embodiment, the apparatus further comprises:

[0157] A request quantity peak value acquisition unit, configured to execute acquisition of a request quantity peak value per unit time of the resource platform;

[0158] The determination value determining unit is configured to determine a determination value based on a difference between an initial supply value of resources of the first resource type in the resource platform and a peak value of the request quantity, wherein the determination value is smaller than the difference.

[0159] In an exemplary embodiment, the request quantity peak value obtaining unit is specifically configured to execute:

[0160] Obtaining the concurrent request volume per unit time of the resource platform, where the concurrent request volume is the concurrent volume corresponding to the number of various resource requests in the resource platform per unit time;

[0161] Based on the maximum value of the concurrent requests, a peak value of the number of requests per unit time of the resource platform is determined.

[0162] In an exemplary embodiment, the margin recovery unit 703 is specifically configured to execute:

[0163] If the resource type is the first resource type, creating a supply recovery task for the target resource;

[0164] The supply recovery task is sent to an asynchronous processing node, and the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource class through the asynchronous processing node.

[0165] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0166] Each module in the resource updating device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0167] Figure 8 8 is a block diagram of an electronic device 800 for implementing a resource update method according to an exemplary embodiment. For example, the electronic device 800 may be a server. Figure 8 , the electronic device 800 includes a processing component 820, which further includes one or more processors, and a memory resource represented by a memory 822 for storing instructions executable by the processing component 820, such as an application. The application stored in the memory 822 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 820 is configured to execute the instructions to perform the above method.

[0168] The electronic device 800 may further include a power supply component 824 configured to perform power management of the electronic device 800, a wired or wireless network interface 826 configured to connect the electronic device 800 to a network, and an input / output (I / O) interface 828. The electronic device 800 may operate based on an operating system stored in the memory 822, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like.

[0169] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 822 including instructions, and the above instructions can be executed by a processor of the electronic device 800 to perform the above method. The storage medium can be a computer-readable storage medium, for example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0170] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by a processor of the electronic device 800 to complete the above method.

[0171] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.

[0172] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0173] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A resource updating method, characterized in that: include: Get the peak number of requests per unit time on the resource platform; Determine a determination value based on a difference between an initial supply value of resources of the first resource type in the resource platform and the peak value of the request quantity, the determination value being smaller than the difference; In response to a resource request for a target resource in a resource platform, adjusting a current surplus of the target resource in the resource platform based on a request quantity corresponding to the resource request; If the adjusted current balance is greater than the judgment value, the resource type of the target resource in the resource platform is determined to be the first resource type; if the adjusted current balance is less than the judgment value, the resource type of the target resource in the resource platform is determined to be the second resource type; the first resource type and the second resource type are two classifications obtained based on the initial value of the supply of resources in the resource platform; the judgment value is less than the initial value of the supply of resources of the first resource type in the resource platform, and greater than the initial value of the supply of resources of the second resource type in the resource platform; If the resource type is the first resource type, the current remaining quantity of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource type.

2. The method according to claim 1, characterized in that Before the step of responding to the resource request for the target resource in the resource platform and adjusting the current margin of the target resource in the resource platform based on the request quantity corresponding to the resource request, the method further includes: Obtaining an initial value of the supply of the second type of resources in the resource platform, and obtaining a peak value of the number of requests per unit time of the resource platform, wherein the peak value of the number of requests is a total number of requests for various resources in the resource platform; Obtaining a sum of the resource quantity corresponding to the peak value of the request quantity and the initial value of the supply quantity of the second resource type; Based on the sum of the resource quantities, an initial supply quantity value of the resource corresponding to the first resource type in the resource platform is determined, and the initial supply quantity value is greater than the sum of the resource quantities.

3. The method according to claim 1, characterized in that Before the step of responding to the resource request for the target resource in the resource platform and adjusting the current margin of the target resource in the resource platform based on the request quantity corresponding to the resource request, the method further includes: Obtaining a preset positive integer, and determining the positive integer as an initial value of the supply quantity of the first resource type in the resource platform; The positive integer is greater than an initial supply value of the resource of the second resource type in the resource platform.

4. The method according to claim 2, characterized in that: The obtaining of the peak number of requests per unit time of the resource platform includes: Obtaining the concurrent request volume per unit time of the resource platform, where the concurrent request volume is the concurrent volume corresponding to the number of various resource requests in the resource platform per unit time; Based on the maximum value of the concurrent requests, a peak value of the number of requests per unit time of the resource platform is determined.

5. The method according to claim 1, characterized in that If the resource type is the first resource type, restoring the current surplus of the target resource in the resource platform to the initial supply value corresponding to the first resource type includes: If the resource type is the first resource type, creating a supply recovery task for the target resource; The supply recovery task is sent to an asynchronous processing node, and the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource class through the asynchronous processing node.

6. A resource updating device, characterized in that: include: A request quantity peak value obtaining unit is configured to obtain a request quantity peak value per unit time of a resource platform; A determination value determination unit is configured to determine a determination value based on a difference between an initial supply value of resources of the first resource type in the resource platform and a peak value of the request quantity, wherein the determination value is less than the difference; A margin adjustment unit, configured to execute, in response to a resource request for a target resource in the resource platform, adjusting a current margin of the target resource in the resource platform based on a request quantity corresponding to the resource request; A resource type determination unit is configured to determine that the resource type of the target resource in the resource platform is a first resource type if the adjusted current balance is greater than the judgment value; and determine that the resource type of the target resource in the resource platform is a second resource type if the adjusted current balance is less than the judgment value. The first resource type and the second resource type are two classifications obtained based on the initial value of the supply of resources in the resource platform; the judgment value is less than the initial value of the supply of resources of the first resource type in the resource platform, and is greater than the initial value of the supply of resources of the second resource type in the resource platform; The balance recovery unit is configured to, if the resource type is the first resource type, restore the current balance of the target resource in the resource platform to an initial supply value corresponding to the first resource type.

7. The device according to claim 6, characterized in that The device also includes: a supply quantity initial value acquisition unit, configured to execute acquisition of an initial supply quantity value of a second type of resource in a resource platform, and a request quantity peak value acquisition unit, configured to execute acquisition of a request quantity peak value per unit time of the resource platform, wherein the request quantity peak value is a total request quantity for various resources in the resource platform; A resource quantity sum determination unit is configured to execute acquisition of the sum of resource quantities corresponding to the peak value of the request quantity and the initial value of the supply quantity of the second resource type; An initial value of supply quantity is provided in the resource platform, and the initial value of supply quantity is greater than the sum of the resource quantities.

8. The device according to claim 6, characterized in that The device also includes: A positive integer acquisition unit, configured to acquire a preset positive integer and determine the positive integer as an initial value of the supply quantity of the first resource type in the resource platform; The positive integer is greater than an initial supply value of the resource of the second resource type in the resource platform.

9. The device according to claim 7, characterized in that The request quantity peak value obtaining unit is specifically configured to execute: Obtaining the concurrent request volume per unit time of the resource platform, where the concurrent request volume is the concurrent volume corresponding to the number of various resource requests in the resource platform per unit time; Based on the maximum value of the concurrent requests, a peak value of the number of requests per unit time of the resource platform is determined.

10. The device according to claim 6, characterized in that The margin recovery unit is specifically configured to execute: If the resource type is the first resource type, creating a supply recovery task for the target resource; The supply recovery task is sent to an asynchronous processing node, and the current balance of the target resource in the resource platform is restored to the initial supply value corresponding to the first resource class through the asynchronous processing node.

11. A server, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the resource updating method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute the resource updating method according to any one of claims 1 to 5.

13. A computer program product, comprising instructions, characterized in that: When the instruction is executed by a processor of the server, the server is enabled to execute the resource updating method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Resource distribution method and device, electronic equipment and storage medium

    CN113610558A

  • Resource distribution method and device, electronic equipment and storage medium

    CN113691586A