Inventory data processing method, system and device, storage medium, and program product

By obtaining the current inventory data at the target moment and determining the inventory change amount within the target period, verifying the current inventory data, the statistical lag problem of virtual resource inventory data is solved, and more accurate inventory management and resource allocation are achieved.

WO2025158224A1PCT designated stage expired Publication Date: 2025-07-31CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/IB2025/050215
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-22
Filing Date
2025-01-09
Publication Date
2025-07-31

AI Technical Summary

Technical Problem

In the prior art, there is a lag in the statistics of virtual resource inventory data, resulting in the "oversold" and "selling less" of virtual resources, which cannot accurately reflect user needs.

Method used

By obtaining the current inventory data at the target moment and determining the inventory change amount within the target period, using this change amount to verify the current inventory data, dynamically adjust the period length to accurately reflect the inventory changes, and provide the verification inventory data.

Benefits of technology

It improves the accuracy of inventory data, reduces the "oversold" and "selling less" phenomena of virtual resources, and ensures the effectiveness and accuracy of resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025050215_31072025_PF_FP_ABST
    Figure IB2025050215_31072025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide an inventory data processing method, system and device, a storage medium, and a program product. The method comprises: when a user generates a creation request for a virtual resource at a target moment, a data consumer can acquire current inventory data of the virtual resource collected before the target moment. In a target time period formed by the target moment and a timestamp corresponding to the current inventory data, the inventory data may also change; therefore, the current inventory data cannot accurately reflect the inventory at the target moment. In this case, an inventory change amount of the virtual resource in the target time period can be further determined, and the inventory change amount is used to verify the current inventory data, so that real inventory data at the target moment is obtained. Hence, in the solution, the inventory change amount in the target time period can be used to compensate for the current inventory data, to obtain the real inventory data at the target moment, thereby reducing the hysteresis of inventory data.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Inventory Data Processing Method, System, Device, Storage Medium, and Program Product This disclosure claims priority to a Chinese patent application filed with the Patent Office of the People's Republic of China on January 22, 2024, with application number 202410089151.2, entitled "Inventory Data Processing Method, System, Device, Storage Medium, and Program Product," the entire contents of which are incorporated herein by reference. Technical Field This disclosure relates to the field of cloud computing technology, and more particularly to an inventory data processing method, system, device, storage medium, and program product. Background With the continuous development of information technology, cloud computing, as an emerging technology model, is gaining increasing attention and recognition. In cloud computing, computing resources can be virtualized into various services, such as storage, computing, and networking. Services used by users are delivered to users in the form of virtual resources. For example, a cloud server (ECS) can be provided as a virtual resource to meet users' computing service needs. When a user needs to use virtual resources, the cloud service provider needs to determine whether to allocate virtual resources to the user based on the virtual resource inventory data. However, in the prior art, virtual resource inventory data statistics often have a lag, which can lead to "overselling" or "underselling" of virtual resources. Improving the lag in inventory data statistics has become an urgent problem. SUMMARY OF THE INVENTION In view of this, embodiments of the present disclosure provide an inventory data processing method, system, device, storage medium, and program product to improve the lag in inventory data statistics. In a first aspect, embodiments of the present disclosure provide an inventory data processing method, comprising: in response to a virtual resource creation request generated at a target time, obtaining current inventory data collected before the target time; determining an inventory change of the virtual resource within a target period, wherein the target period is composed of timestamps corresponding to the target time and the current inventory data; and verifying the current inventory data based on the inventory change within the target period to obtain verified inventory data for the virtual resource at the target time.In a second aspect, embodiments of the present disclosure provide an inventory data processing system, comprising: a data generator and a data consumer; the data generator is configured to collect inventory data of virtual resources within different statistical periods; synchronize the collected inventory data to the data consumer; the data consumer is configured to receive a request to create a virtual resource generated at a target time; obtain current inventory data collected before the target time; determine an inventory change of the virtual resource within a target period, where the target period is composed of timestamps corresponding to the target time and the current inventory data; and verify the current inventory data based on the inventory change within the target period to obtain verified inventory data of the virtual resource at the target time. In a third aspect, embodiments of the present disclosure provide an electronic device, comprising: a memory configured to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the inventory data processing method described in the first aspect. The electronic device may further include a communication interface for communicating with other devices or communication systems. In a fourth aspect, embodiments of the present disclosure provide a non-transitory machine-readable storage medium storing executable code. When the executable code is executed by a processor of an electronic device, the processor is enabled to implement at least the inventory data processing method described in the first aspect. In a fifth aspect, embodiments of the present disclosure provide a computer program product. This computer program product includes a computer program or instructions. When executed by a processor, the processor is enabled to implement the inventory data processing method described in the first aspect. In the inventory data processing method provided by embodiments of the present disclosure, when a user generates a request to create a virtual resource at a target time, indicating a user's demand for the virtual resource, a data consumer can obtain current inventory data for the virtual resource calculated before the target time. In practice, the timestamp corresponding to the current inventory data may not be the same as the target time, and changes in inventory data may occur within the target period formed by the target time and the timestamp corresponding to the current inventory data. Therefore, the current inventory data may not accurately reflect the inventory at the target time. Furthermore, the length of the target period may also reflect the degree of lag in the current inventory data. Based on this, the data consumer can further determine the inventory change of the virtual resource during the target period and use this inventory change during the target period to verify the current inventory data to obtain verified inventory data, which is also the actual inventory data at the target time. Therefore, in the above solution, the inventory change during the target period can be used as a compensation value to compensate the current inventory data to obtain the actual inventory data at the target time.Furthermore, in this solution, since the creation request generation time is not fixed, the statistical timestamp of the current inventory data is also not fixed. Therefore, the length of the target period is dynamic. Compared to using a fixed-length period, this dynamic period can accurately reflect the lag of the current inventory data, thereby obtaining more accurate inventory changes, accurately compensating inventory data, and ultimately obtaining true inventory data. BRIEF DESCRIPTION OF THE DRAWINGS To more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following briefly introduces the drawings required for the embodiments or the prior art description. Obviously, the drawings described below are some embodiments of the present disclosure. Those skilled in the art can also derive other drawings based on these drawings without inventive effort. Figure 1 is a schematic diagram of an inventory data generation and consumption process; Figure 2 is a schematic diagram of the causes of inventory data verification; Figure 3 is a schematic diagram of the structure of an inventory data processing system provided in an embodiment of the present disclosure; Figure 4 is a schematic diagram of an inventory data verification process provided in an embodiment of the present disclosure; Figure 5 is a schematic diagram of an inventory change statistics process provided in an embodiment of the present disclosure; Figure 6 is a flow chart of an inventory data processing method provided in an embodiment of the present disclosure; Figure 7a is a flow chart of another inventory data processing method provided in an embodiment of the present disclosure; Figure 7b is a schematic diagram of the relationship between inventory data and time periods provided in an embodiment of the present disclosure; Figure 8 is a flow chart of a target time period determination method provided in an embodiment of the present disclosure; Figure 9 is a schematic diagram of the virtual resource transaction process provided in an embodiment of the present disclosure; Figure 10 is a schematic diagram of the structure of an inventory data processing device provided in an embodiment of the present disclosure; and Figure 11 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS To further clarify the objectives, technical solutions, and advantages of the embodiments of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments represent only a portion of the embodiments of the present disclosure, but not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure. The terms used in the embodiments of this disclosure are intended solely to describe specific embodiments and are not intended to limit this disclosure. The singular forms "a," "an," "the," and "the" used in the embodiments of this disclosure and the appended claims are intended to include the plural forms. Unless the context clearly indicates otherwise, "a plurality" generally includes at least two, but does not exclude the inclusion of at least one.It should be understood that the term "and / or" as used herein is merely a description of an association between associated objects, indicating that three possible relationships exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Furthermore, the character " / " herein generally indicates that the associated objects are in an "or" relationship. Depending on the context, the phrases "if" and "if" as used herein can be interpreted as "upon..." or "when..." or "in response to determining..." or "in response to identifying." Similarly, depending on the context, the phrases "if it is determined" or "if (a stated condition or event) is identified" can be interpreted as "upon determination," "in response to determination," "upon identifying (a stated condition or event)," or "in response to identifying (a stated condition or event)." It should 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 analysis, storage, and display) referred to in this disclosure are all information and data authorized by the user or fully authorized by all parties. The collection, use, and processing of the relevant data must comply with the relevant laws, regulations, and standards of the relevant region, and corresponding operation portals are provided for users to choose to authorize or refuse. It should also be noted that the terms "include," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a product or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such product or system. Without further limitation, elements defined by the phrase "comprising a..." do not preclude the presence of other identical elements in the product or system comprising the elements. The following detailed description of some embodiments of the present disclosure is provided in conjunction with the accompanying drawings. The following embodiments and features may be combined unless there is a conflict between the embodiments. Furthermore, the sequence of steps in the following method embodiments is provided as an example and is not a strict limitation. Before describing the following embodiments of the present disclosure in detail, the process of generating and consuming inventory data will be explained. The following content can also be understood in conjunction with Figure 1. The process of generating and consuming inventory data involves two roles: data generators and data consumers. The data generated or consumed by these two parties is inventory data for virtual resources. Alternatively, virtual resources can include ECS servers, relational databases, containers, and the like.Furthermore, in the systems and methods described in the various embodiments of this disclosure, the steps performed by each role are actually completed by the device corresponding to each role. However, for clarity, the following embodiments will continue to refer to data generators and data consumers. In practice, users can generate scheduling requests for virtual resources. Alternatively, users can directly trigger scheduling requests on a platform providing virtual resource trading services. This scheduling request includes resource quantities. Furthermore, an inventory data processing system consisting of data service providers and data consumers can be integrated into this platform. Data consumers can use their own processing flow to receive user-generated scheduling requests, while data generators can also use their own processing flow to receive scheduling requests forwarded to data generators. Given the relatively fast execution speed of the processing flow, the time a scheduling request is generated can be roughly considered to be the same as the time the data consumer receives the scheduling request. The data generator can periodically collect inventory data for virtual resources based on the resource quantities in the received scheduling requests, thereby completing the generation of inventory data. Optionally, the platform providing trading services can display or hide the collected inventory data to users. More specifically, this scheduling request may include a request to create a virtual resource or a request to release a virtual resource. The resource quantity in the creation request includes the number of virtual resources that need to be created, and the resource quantity in the release request includes the number of virtual resources that are to be released by the user. For virtual resources represented by ECS cloud servers, the process of the platform responding to the scheduling request is the process of providing the user with Elastic Compute Service (ECS); for virtual resources represented by relational databases, the process of the platform responding to the scheduling request is the process of providing the user with Relational Database Service (RDS); for virtual resources represented by containers, the process of the platform responding to the scheduling request is the process of providing the user with Container Compute Service (CS). During the statistical period, when a user generates a create request and / or a release request, the computing resources in the physical host are correspondingly deducted or returned. Therefore, the inventory data statistical process can be considered as converting the remaining computing resources in the physical host into the number of virtual resources. Therefore, this conversion process takes a certain amount of time. This calculation process can be implemented by a computing engine provided by the data consumer. The statistical inventory data can also be synchronized with the data consumer.This synchronization process also takes a certain amount of time. After receiving the inventory data synchronized by the data generator, the data consumer can also receive new creation requests from users. If the resource quantity included in the creation request is less than the inventory data received by the data consumer, indicating that the current virtual resource inventory is sufficient, the data consumer can consider the creation request valid, thus completing the inventory data consumption. Ultimately, the platform providing virtual resource trading services can create the corresponding number of virtual resources for the user. In the above process, because inventory data statistics and synchronization require time, the inventory data obtained by the data consumer is delayed. The delay in inventory data can be further understood by referring to Figure 2. As shown in Figure 2, time T1 is the start time of inventory data statistics, time T2 is the end time of inventory data statistics, time T3 is the start time of inventory data synchronization, and time T4 is the end time of inventory data synchronization. Time T5 is the time when the scheduling request is generated. During the period from time T1 to time T5, while the data generator is performing inventory statistics and synchronization, users may also generate virtual resource creation requests C1 and C2, as well as virtual resource release requests R1 and R2, during this period. This means that the virtual resource inventory changes during this period, but these changes are not known to the data consumer. Therefore, the inventory data received by the data consumer at time T4 actually reflects the virtual resource inventory at time T1 and does not truly reflect the virtual resource inventory at time T5. From the perspective of the data consumer, inventory data statistics are lagging. This can easily lead to the "overselling" and "underselling" phenomena mentioned in the background technology. To improve the lag in inventory data statistics and further address the "overselling" and "underselling" issues, the methods and systems provided in the following embodiments of this solution can be used. Figure 3 is a schematic diagram of the structure of an inventory data processing system provided in an embodiment of the present disclosure. As shown in Figure 3, the system can be integrated into a platform that provides virtual resource trading services. The system may include: a data generator and a data consumer. The data generator collects inventory data for virtual resources and synchronizes the collected data with the data consumer. Optionally, the inventory data collected by the data generator can be stored in a first database locally on the data generator, and the data consumer can store the synchronized inventory data in a second database locally on the data consumer. When a user needs to create a virtual resource, they can use the platform to generate a virtual resource creation request, which can be generated at the target time. At this point, the data consumer can obtain the current inventory data from the second database.The current inventory data, which is the latest inventory data stored in the second database, is counted and synchronized to the data consumer before the target time. The statistical start time corresponding to the current inventory data is later than the statistical start times corresponding to other inventory data in the second database. Similarly, the statistical end time corresponding to the current inventory data is also later than the statistical end times corresponding to other inventory data. After obtaining the current inventory data, the data consumer can further determine the inventory change of the virtual resource within a target period. The target period consists of the target time and the timestamp corresponding to the current inventory data. Optionally, the timestamp corresponding to the current inventory data can be used to describe a moment in the inventory data statistics process. This timestamp can have different meanings, and statistical timestamps with different meanings are applicable to different situations. When the accuracy of the calibrated inventory data is required to be high, the timestamp corresponding to the current inventory data can be used to describe the statistical start time of the current inventory data. Based on the content shown in Figure 2, if the user generates a virtual resource creation request at time T5 (i.e., the target time), the target period can consist of times T1 and T5. Optionally, the timestamp corresponding to the current inventory data can also be used to describe the end time of statistics collection for the current inventory data. Based on the content shown in Figure 2, the target period can consist of times T2 and T5. When the accuracy requirements for the verified inventory data are lower, the timestamp corresponding to the current inventory data can optionally be used to describe the start time of synchronization for the current inventory data. Based on the content shown in Figure 2, the target period can consist of times T3 and T5. Optionally, the timestamp corresponding to the current inventory data can also be used to describe the end time of synchronization for the current inventory data. Based on the content shown in Figure 2, the target period can consist of times T4 and T5. Optionally, for ease of calculation, the target times and statistical timestamps used in determining the target period can be rounded to the nearest minute. As can be easily understood from the above example, the longer the target period, the greater the lag in the current inventory data. To determine the inventory change, the data consumer can optionally obtain virtual resource creation and release requests generated by different users during a target period and calculate the sum of the resource quantities included in the creation requests and the release requests. This sum is the inventory change during the target period. Virtual quantities in create requests are represented by positive numbers, while resource quantities in release requests are represented by negative numbers. Finally, the data consumer can verify the current inventory data based on the inventory change during the target period to obtain verified inventory data for the virtual resources at the target time.This inventory change is also the compensation value for the current inventory data, used to verify the inventory data. As can be seen from the above description, the data generator periodically collects and synchronizes inventory data, while the data consumer determines the inventory change only after receiving a create request generated by the user. The working process of each party in the above system can also be understood with reference to Figure 4. The working process of each party in this system can also be understood with reference to the example shown in Figure 5: A user can generate a virtual resource creation request at time T5, and the data consumer can obtain the current inventory data that has been collected and synchronized at time T4. Assume that the current inventory data is 100. During the target period from time T1 to time T5, the user also generates a create request C3, a release request R3, and a create request C4 from time T6 to time T8. The number of resources included in create request C3 is 15, the number of resources included in release request R3 is -12, and the number of resources included in create request C4 is 10. Therefore, the inventory change during the target period is 15 - 12 + 10 = 13. Finally, the verified inventory data is 113. Where n is the time period, t is the timestamp corresponding to the current inventory data, d(t,n) is the inventory change within time period n, C is the number of resources included in the create request at time i, and R is the number of resources included in the release request at time i. The current inventory verification process can also be expressed by the following formula: 1+n = I t + d(t,n) o In this embodiment, when a user generates a request to create a virtual resource at a target time, indicating a demand for the virtual resource, the data consumer can obtain the current inventory data for the virtual resource calculated before the target time. However, this current inventory data is often lagged, meaning it does not accurately reflect the inventory at the target time. The length of the target period can reflect the degree of lag in the current inventory data. In this case, the data consumer can further determine the inventory change of the virtual resource during the target period and use this inventory change to verify the current inventory data, thereby obtaining the verified inventory data for the virtual resource at the target time—that is, the actual inventory data at the target time. Therefore, in the above solution, the inventory change during the target period can be used to compensate the current inventory data to obtain the actual inventory data at the target time. Furthermore, in this solution, since the creation request is generated at an unfixed time, the duration required to count and synchronize the current inventory data is also unfixed. Therefore, the target period is dynamic. Compared to a fixed-length period, this dynamic period accurately reflects the lag in current inventory data, thereby obtaining more accurate inventory changes, enabling accurate inventory data compensation and ultimately obtaining true inventory data. Optionally, in practice, the inventory data counted by the data generator can be stored in a database. In the above embodiment, when the data consumer receives the creation request generated at the target time, the data generator has already performed at least one inventory count and synchronization. Therefore, the data consumer can directly obtain the current inventory data from the database. However, in practice, the following situation may occur: when the data consumer receives the creation request generated at the target time, the data generator has not yet completed inventory data counting and synchronization. As a result, the current inventory data does not exist in the database. More precisely, the database is empty, and the data consumer cannot obtain the current inventory data. In this case, the data consumer can also directly determine the inventory change of the virtual resource during the target period. Since there is no timestamp corresponding to the current inventory data in this case, the target period can consist of the target time and a reference time that is a preset time period before the target time. Optionally, this preset time period can be the average time required for the data generator to complete inventory data statistics and synchronization. The data consumer can then directly determine the inventory change during the target period as the verified current inventory data of the virtual resource at the target time. To distinguish this from the preset time periods discussed in subsequent embodiments, the preset time period mentioned in this embodiment can be referred to as the first preset time period. In either case, the data consumer can complete the verification to obtain the verified current inventory data.Optionally, the data consumer can further verify the validity of the creation request based on the verified inventory data. This allows the platform providing virtual resource trading services to respond to the valid creation request and create the corresponding number of training resources for the user. Specifically, if the verified inventory data is greater than the resource quantity in the creation request, the creation request is considered valid. In this embodiment, since the verified inventory data accurately reflects the inventory data at the target time, the validity of the creation request can be accurately determined, thereby reducing the phenomenon of "overselling" and "underselling" of virtual resources. The following will further explain the working process of the data consumer in detail from a process perspective. Figure 6 is a flowchart of an inventory data processing method provided by an embodiment of the present disclosure. This method provided by an embodiment of the present disclosure can be executed by a data consumer in the aforementioned inventory data processing system. As shown in Figure 6, the method may include the following steps:

[0002] 5101. In response to a virtual resource creation request generated at a target time, obtain current inventory data counted before the target time.

[0003] 5102. Determine the inventory change of the virtual resource within a target period. The target period is composed of a target time and a timestamp corresponding to the current inventory data.

[0004] At step 5103, the current inventory data is verified based on the inventory change during the target period to obtain verified inventory data for the virtual resource at the target time. The data consumer can receive a request to create a virtual resource generated by a user at the target time. In response to this request, the data consumer can also obtain the current inventory data collected and stored locally before the target time. As described in the above embodiments, this current inventory data is obtained synchronously from the data producer. Simultaneously, the data consumer can also obtain the inventory change of the virtual resource during the target period. The specific composition of the target period and the specific process for obtaining the inventory change can be found in the description of the embodiment shown in FIG3 and will not be repeated here. Finally, the data consumer can verify the current inventory data based on the inventory change during the target period to obtain verified inventory data that accurately reflects the inventory of the virtual resource at the target time. The specific implementation of each step of this embodiment and the technical effects achieved can be found in the description of the embodiment shown in FIG3 and will not be repeated here. In this embodiment, when a user generates a request to create a virtual resource at a target time, indicating a demand for the virtual resource, the data consumer can obtain the current inventory data for the virtual resource calculated before the target time. However, this current inventory data is often lagged, meaning it does not accurately reflect the inventory at the target time. The length of the target period can reflect the degree of lag in the current inventory data. In this case, the data consumer can further determine the inventory change of the virtual resource during the target period and use this inventory change to verify the current inventory data, thereby obtaining the verified inventory data for the virtual resource at the target time—that is, the actual inventory data at the target time. Therefore, in the above solution, the inventory change during the target period can be used to compensate the current inventory data to obtain the actual inventory data at the target time. Furthermore, in this solution, since the creation request is generated at an unfixed time, the duration required for collecting and synchronizing current inventory data is also unfixed. Therefore, the target period is dynamic. Compared to a fixed-length period, this dynamic period accurately reflects the lag in current inventory data, resulting in more accurate inventory changes, enabling accurate inventory data compensation and ultimately obtaining authentic inventory data. As described in the embodiment shown in FIG3 , the data consumer can store the inventory data synchronized from the data generator in a second database, where the data can be stored in the form of a data body. The data consumer can then determine the current database from the data body by inputting a query statement.Common data bodies may include key-value pairs, documents, row elements (records), or column elements, etc. When the data body is specifically a key-value pair, that is, the inventory data that has been counted before the target time and the timestamp corresponding to the inventory data can be stored in the second database in the form of a key-value pair, wherein the second database can be Red is, and the key-value pair can be expressed as: Pa ir<SK, h i storyNum> In the key-value pair, SK is the primary key, representing the statistical timestamp; hi storyNum is the key value, representing the inventory data. When a data consumer obtains current inventory data, they can optionally query the second database based on the primary key to find a first target key-value pair. The primary key in this first target key-value pair includes the timestamp closest to the target time. The key value in this target key-value pair represents the current inventory data. Over time, the number of key-value pairs in the second database will gradually increase. To improve the query speed of the target key-value pair, at least one key-value pair in the second database can optionally be stored in the data consumer's cache. The interval between the timestamp contained in each of these at least one key-value pairs and the target time is a second preset time duration. This second preset time duration can be set to the average time duration required for multiple inventory data statistics and synchronizations. Assuming that the average time duration required for a single inventory data statistics and update is 7 minutes, for example, the second preset time duration can be an integer multiple of 7. Optionally, the timestamp in the key-value pair can also be at the minute level. This can eliminate the minute-level rounding process performed during the target time period determination process mentioned in the embodiment shown in FIG3 , thereby simplifying the inventory data verification process. In practice, virtual resources of the same type can also have different specifications. Taking the ECS server as an example, the virtual resource specifications specifically represented by the server specifications can include the server's operating region, number of cores, memory size, operating system version, etc. The key-value pairs in the second database are also associated with the resource specifications. In this case, the key-value pairs in the second database can be represented as PK- <Pa i r<SK, h i storyNum»。 oAmong them, PK is the resource specification associated with the key-value pair, SK in the key-value pair is the primary key (key), which is used to represent the statistical timestamp; hi storyNum is the key value (value), which is used to represent the inventory data. Then, when the user generates a creation request, the data consumer can determine the first target key-value pair associated with the target resource specification from the second database based on the target resource specification in the creation request. Among them, the target resource specification in the creation request is used to describe the specification of the virtual resource to be created. As in the above example, when the virtual resource is specifically an ECS server, the target resource specification is the server specification. When the virtual resource is specifically a relational database, the target resource specification is the database specification, such as the database size, the size of the largest column in the database, etc. In this embodiment, since the key value contains two types of data, namely "key" and "value", and the "value" can be directly accessed through the "key", the time complexity required for the search is 0 (1), that is, the target can be found through one search. Therefore, using the key-value pair data format can increase the query speed of the first target key-value pair, that is, increase the speed of obtaining current inventory data. To further increase the speed of obtaining inventory data, the query scope of the key-value pair can be narrowed, that is, the key-value pairs in the data consumer's cache can be queried. Optionally, the generation timestamp of the scheduling request and the resource quantity included in the scheduling request can also be stored in the form of a structure. The data consumer can first obtain the scheduling requests for virtual resources generated during the target period, namely, the creation and release requests of virtual resources, based on the generation timestamps of the different scheduling requests in the structure, and determine the inventory change during the target period based on the resource quantity included in the scheduling requests. Based on the description of the embodiment shown in Figure 3, the data consumer calculates the sum of the resource quantity included in the creation request and the resource quantity included in the release request. This sum is the inventory change during the target period. When the data body is specifically represented by a key-value pair, the request generation timestamp can serve as the primary key in the key-value pair, and the resource quantity can serve as the key value in the key-value pair. The key-value pair can be stored in a third database in the data consumer. And the key-value pair in the third database can be expressed as Pa i rCT, Num» oIn the key-value pair, T is the primary key, representing the request generation timestamp; Num is the key value, representing the number of resources in the request. Based on this, the data consumer can query the second target key-value pair in the third database based on the key value and perform calculations based on the key value in the second target key-value pair. The calculation result is the inventory change. The primary key in the second target key-value pair falls within the target time period. Optionally, to improve the query speed of the second target key-value pair, at least one key-value pair in the third database can also be stored in the data consumer's cache. The generation timestamps of each of these at least one key-value pair are separated from the target time by a third preset time interval. This third preset time interval can be set to the average duration required for a single inventory data collection and synchronization, for example, 7 minutes. Similar to the above example, in this embodiment, using the key-value pair data format can also improve the query speed of the second target key-value pair, that is, improve the calculation speed of the inventory change. To further increase the speed of inventory data acquisition, the key-value pair query scope can be narrowed, specifically, the key-value pairs within the cache can be queried. As described in the embodiment shown in FIG3 , the accuracy of the inventory change, used as a compensation value, can directly impact the accuracy of the current inventory data verification. To improve the accuracy of inventory data verification, the data consumer can also perform the method shown in FIG7a . FIG7a is a flow chart of another inventory data processing method provided in an embodiment of the present disclosure. As shown in FIG7a , the method may include the following steps:

[0005] S201, in response to a virtual resource creation request generated at a target time, obtain current inventory data collected before the target time. The specific implementation process of step S201 above can be found in the detailed description of the relevant steps in the embodiment shown in FIG6 , which will not be repeated here.

[0006] At step 5202, historical inventory data collected before the current inventory data is obtained. The timestamps corresponding to the current inventory data and the historical inventory data are separated by a preset time interval. In addition to storing the current inventory data, the data consumer's second database may also store historical inventory data. The timestamps corresponding to the historical inventory data and the current inventory data may be separated by a preset time interval. This preset time interval can be considered the inventory data statistics period of the data generator. Furthermore, the timestamp corresponding to the historical inventory data is earlier than the timestamp corresponding to the current inventory data.

[0007] At step 5203, the inventory change within the historical period is determined based on the resource quantities included in the scheduling requests generated within the historical period. The historical period is composed of the timestamps corresponding to the historical inventory data and the current inventory data. The data consumer can also obtain scheduling requests generated within the historical period, that is, obtain virtual resource creation and release requests generated by different users within the historical period, and calculate the sum of the resource quantities included in the creation requests and the resource quantities included in the release requests. This sum is the inventory change within the historical period. The historical period is composed of the timestamps corresponding to the historical inventory data and the current inventory data.

[0008] At step 5204, if the difference between the historical inventory data and the current inventory data is less than the inventory change within the historical period, the historical inventory data is verified based on the inventory change within the target period. In one case, if the difference between the historical inventory data and the current inventory data is less than the inventory change within the historical period, indicating that the current inventory data is inaccurate, the data consumer can verify the historical inventory data using the inventory change within the target period. The target period consists of the target time and the timestamp corresponding to the current inventory data. Optionally, if the user generates a new creation request after the target time, the inventory data needs to be verified again. To prevent inaccurate current inventory data from causing adverse effects during the inventory data re-verification process, the data consumer can also delete the current inventory data.

[0009] At step 5205, if the difference between the historical inventory data and the current inventory data is greater than or equal to the inventory change within the historical period, the current inventory data is verified based on the inventory change within the target period. Alternatively, if the difference between the historical inventory data and the current inventory data is greater than or equal to the inventory change within the historical period, indicating that the current inventory data is accurate but lagging, the data consumer can verify the current inventory data using the inventory change within the target period. In this embodiment, the relationship between the timestamps corresponding to the historical inventory data and the current inventory data, the historical period, and the target period can be further understood with reference to FIG. 7b. In this embodiment, the accuracy of the current inventory data can be determined by comparing the difference between the historical inventory data and the current inventory data with the inventory change within the historical period. This allows the data consumer to verify the accurate but lagging current inventory data or historical inventory data using the inventory change within the target period as a compensation value to ensure that the verified inventory data truly reflects the inventory of virtual resources at the target time. As described in the above embodiments, when the difference between historical inventory data and current inventory data is greater than or equal to the inventory change within the historical time period, the current inventory data can be considered accurate but lagging. Only then does the condition for verifying the current inventory data be met, that is, the current inventory data can be verified against the inventory change within the target time period. In practice, however, the difference may always be less than the inventory change within the historical time period. In this case, as described in step S204, the data consumer will continue to verify the historical inventory data. Because the earlier the statistical timestamp of the historical inventory data, the longer the time interval between the statistical timestamp and the target time, the lower the confidence level of the historical inventory data. Therefore, the verified inventory data obtained by continuously verifying the historical inventory data may not accurately reflect the inventory at the target time. This may lead to "underselling" of virtual resources. Among them, the lag in inventory data may be due to the time required for inventory data calculation and synchronization, but this time consumption can be calculated; it may also be due to the time consumption generated by other calculations that cannot be accurately calculated. This time consumption will continue to accumulate over time, resulting in the earlier the statistical timestamp of historical inventory data, the lower the confidence level of historical inventory data.To address the above issues, it's necessary to determine a historical period of reasonable length. Based on this reasonable historical period scenario, the rationality of inventory changes within the historical period can be ensured, ensuring that the difference between historical inventory data and current inventory data is not consistently less than the inventory change within the historical period. This allows data consumers to calibrate current inventory data, and the confidence level of historical inventory data does not affect the accuracy of the verified inventory data. In this case, the embodiment shown in FIG8 can be used to determine an appropriate historical period. FIG8 is a flowchart of a method for determining a historical period provided in an embodiment of the present disclosure. As shown in FIG8 , the method may include the following steps:

[0010] At step S301, historical inventory data collected before the current inventory data is obtained, with the timestamps of the current inventory data and the historical inventory data separated by a preset time interval. The specific implementation of step S301 can be found in the detailed description of the relevant steps in the embodiment shown in FIG. 7a, and will not be repeated here.

[0011] S302: If the timestamp corresponding to the historical inventory data is earlier than the reference time, the period consisting of the timestamp corresponding to the current inventory data and the reference time is determined as the historical period, and the reference time is earlier than the target time by a preset time period.

[0012] At step 5303, if the timestamp corresponding to the historical inventory data is later than the reference time, the period consisting of the timestamps corresponding to the historical inventory data and the current inventory data is determined as the historical period. The data consumer can then first determine the order of the timestamps corresponding to the historical inventory data and the reference time. The reference time is earlier than the target time, and there is a first preset time interval between the reference time and the target time. This first preset time interval is the average time required for the data generator to perform inventory data statistics and synchronization. In one case, if the timestamp corresponding to the historical inventory data is later than the reference time, indicating that the timestamps of the historical inventory data and the current inventory data are close together, and the interval between the two timestamps is less than the first preset time interval, the data consumer can determine the period consisting of the timestamps corresponding to the historical inventory data and the current inventory data as the historical period. In another case, if the timestamp corresponding to the historical inventory data is earlier than the reference time, indicating that the timestamp corresponding to the historical inventory data is significantly different from the timestamp corresponding to the current inventory data, and the interval between the two timestamps is greater than the first preset duration, the data consumer will determine the period formed by the timestamp corresponding to the current inventory data and the reference time as the historical period. Based on these two cases, it can be seen that the reference time can be considered a retrospective time point, which is used to ensure that the length of the target period does not exceed the first preset duration, thereby ensuring that the historical period is not too long.

[0013] 5304, determine the inventory change in the historical period based on the resource quantity included in the scheduling request generated in the historical period.

[0014] 5305, if the difference between the historical inventory data and the current inventory data is less than the inventory change in the historical period, verify the historical inventory data according to the inventory change in the target period.

[0015] At step 5306, if the difference between the historical inventory data and the current inventory data is greater than or equal to the inventory change within the historical period, the current inventory data is verified based on the inventory change within the target period. The specific implementation of steps S304-S306 can be found in the detailed description of the relevant steps in the embodiment shown in FIG7a and will not be repeated here. In this embodiment, by setting the reference time, a historical period of appropriate length can be obtained, ultimately improving the phenomenon of "underselling" virtual resources. Furthermore, regarding the methods and systems provided in the above embodiments, the data consumer's inventory data verification process and the platform providing virtual resource trading services' response to the creation request can also be understood in conjunction with the following content and FIG9 . Assuming that the virtual resource being traded on the platform is an ECS server, continuing with the example in the embodiment shown in FIG3 , a user can generate an ECS server creation request at time T. This creation request can include a resource quantity of 10 and the target resource specifications of the desired ECS server: 2 cores, 4GB, running in region A. For this create request, the data consumer can read from the cache the current inventory data of the ECS server with the aforementioned specifications, which is 100, and the historical inventory data is 200. Furthermore, the data consumer can calculate the difference between the historical inventory data and the current inventory data as 100. The data consumer can also calculate the inventory change within the historical period as 100 based on the call requests generated within the historical period. And based on the create request C6 and release request R6 generated within the target period, the data consumer can calculate the inventory change within the target period as 10. The historical period can also be determined based on the order of the timestamps corresponding to the historical inventory data and the reference time. The specific process is described below. The target period can be composed of the statistical timestamp of the current inventory data and time T. Since the inventory change within the historical period is the same as the difference between the two inventory data, indicating that the current inventory data is accurate but has a lag, the data consumer can use the inventory change within the target period, 10, to calibrate the current inventory data of 100. After verification, the inventory data is 110. At this point, if the verified inventory data 110 is greater than the resource quantity 10 included in the create request generated at time T, the platform providing virtual resource trading services can allocate 10 ECS servers with the target resource specifications to the user. Regarding the determination of the historical period, as shown in Figure 9, if the timestamp corresponding to the historical inventory data is earlier than the reference time, indicating that the historical inventory statistics were collected earlier, the historical period consists of the timestamp corresponding to the reference time and the current inventory data. The inventory change within the historical period can be determined based on the create requests C5 and release requests R5 generated within the historical period.If the timestamp corresponding to the historical inventory data is later than the reference time, the historical period consists of the timestamps corresponding to the historical inventory data and the current inventory data. The inventory change within the historical period can be determined based on the release request R5 generated within the historical period. As described in the above-mentioned method and system embodiments, the timestamp corresponding to the inventory data can be any of the following: the start time, end time, or start or end time of inventory data statistics. Furthermore, any details not described in detail in this embodiment and the resulting technical effects can be found in the relevant descriptions of the above-mentioned embodiments and will not be elaborated upon here. The following describes in detail the inventory data processing devices of one or more embodiments of the present disclosure. Those skilled in the art will appreciate that these inventory data processing devices can be constructed using commercially available hardware components and configured according to the steps taught in this solution. Figure 10 is a schematic diagram of the structure of an inventory data processing device provided in an embodiment of the present disclosure. As shown in Figure 10, the device may include: an acquisition module 11 for obtaining current inventory data counted before a target time in response to a virtual resource creation request generated at the target time. The change determination module 12 is configured to determine the inventory change of virtual resources within a target period, where the target period is composed of the target time and the timestamp corresponding to the current inventory data. The verification module 13 is configured to verify the current inventory data based on the inventory change within the target period to obtain verified inventory data for the virtual resources at the target time. Optionally, the acquisition module 11 is configured to obtain inventory data and the corresponding timestamps before the target time, where the inventory data and timestamps are stored in the form of a structure. The current inventory data is determined in the structure. Optionally, the structure includes key-value pairs, each associated with a resource specification. The acquisition module 11 is configured to determine, based on the target resource specification included in the create request, a first target key-value pair associated with the target resource specification, wherein the primary key in the first target key-value pair includes the timestamp closest to the target time; and determine the key value in the first target key-value pair as the current inventory data. Optionally, the generation timestamp of the scheduling request and the resource quantity included in the scheduling request are stored in the form of a structure.The change determination module 12 is configured to obtain scheduling requests for virtual resources generated within the target period based on the generation timestamps of the different scheduling requests in the structure, the scheduling requests including virtual resource creation requests and / or virtual resource release requests; determine the number of resources included in the scheduling requests generated within the target period from the structure; and determine the inventory change within the target period based on the number of resources included in the scheduling requests. Optionally, the structure includes a key-value pair. The change determination module 12 is configured to determine a second target key-value pair, wherein the primary key in the second target key-value pair includes the generation timestamp of the scheduling request, the generation timestamp being within the target period, and the key value in the second target key-value pair including the number of resources in the scheduling request; determining the inventory change within the target period based on the number of resources includes: determining the inventory change within the target period based on the key value in the second target key-value pair. Optionally, the acquisition module 11 is configured to obtain historical inventory data collected prior to the current inventory data, wherein the timestamps corresponding to the current inventory data and the historical inventory data are separated by a preset time interval. The change determination module 12 is configured to determine the inventory change within a historical period based on the resource quantity included in a scheduling request generated within the historical period. The historical period is a period consisting of the timestamps corresponding to the historical inventory data and the current inventory data, and the scheduling request includes a virtual resource creation request and / or a virtual resource release request. The verification module 13 is configured to verify the current inventory data against the inventory change within the target period if the difference between the historical inventory data and the current inventory data is greater than or equal to the inventory change within the historical period. Optionally, the apparatus further includes a period determination module 14 configured to, if the timestamp corresponding to the historical inventory data is later than a reference time, determine the period consisting of the timestamps corresponding to the historical inventory data and the current inventory data as the historical period, where the reference time is earlier than the target time by a preset time period; and if the timestamp corresponding to the historical inventory data is earlier than the reference time, determine the period consisting of the statistical timestamp of the current inventory data and the reference time as the historical period. Optionally, the verification module 13 is configured to, in response to a virtual resource creation request generated at a target time, determine, if a database storing inventory data is empty, an inventory change of the virtual resource within a target period, where the target period consists of the target time and a reference time, the reference time being a preset time period before the target time; and determine the inventory change within the target period as the verified inventory data of the virtual resource at the target time.Optionally, the apparatus further includes a validity determination module 15 configured to determine that the creation request is valid, if the verified inventory data is greater than the resource quantity included in the creation request, to create the virtual resource. The apparatus shown in FIG10 can execute the method of the embodiments shown in FIG6 through FIG8 . For portions not described in detail in this embodiment, reference can be made to the relevant descriptions of the embodiments shown in FIG6 through FIG8 . The execution process and technical effects of this technical solution are described in the embodiments shown in FIG6 through FIG8 , and will not be repeated here. In one possible design, the inventory data processing methods provided in the above embodiments can be applied to an electronic device. As shown in FIG11 , the electronic device may include a processor 31 and a memory 32. The memory 32 is configured to store a program that supports the electronic device in executing the inventory data processing method provided in the embodiments shown in FIG6 through FIG8 , and the processor 31 is configured to execute the program stored in the memory 32. The program includes one or more computer instructions, wherein when executed by the first processor 31, the one or more computer instructions can implement the following steps: in response to a virtual resource creation request generated at a target time, obtaining current inventory data collected before the target time; determining the inventory change of the virtual resource within a target period, wherein the target period is composed of the target time and the timestamp corresponding to the current inventory data; and verifying the current inventory data based on the inventory change within the target period to obtain verified inventory data of the virtual resource at the target time. Optionally, the processor 31 is further configured to perform all or part of the steps in the embodiments shown in Figures 6 to 8 above. The electronic device may further include a communication interface 33 for communicating with other devices or communication systems. Furthermore, embodiments of the present disclosure provide a computer storage medium for storing computer software instructions used by the electronic device, including a program for executing the inventory data processing method shown in Figures 6 to 8 above. Furthermore, embodiments of the present disclosure provide a computer program product. This computer program product includes a computer program or instructions. When the computer program or instruction is executed by the processor, the processor is enabled to implement the steps or functions of the inventory data processing method shown in FIG. 6 to FIG. 8 .Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present disclosure and are not intended to limit the present disclosure. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. However, such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.

Claims

Claims 1. A method for processing inventory data, wherein, Including: In response to a creation request for a virtual resource generated at a target moment, obtain the current inventory data statistically obtained before the target moment; Determine the inventory change amount of the virtual resource within a target time period, where the target time period is composed of the target moment and the time stamp corresponding to the current inventory data; Verify the current inventory data according to the inventory change amount within the target time period to obtain the verified inventory data of the virtual resource at the target moment.

2. The method according to claim 1, wherein The obtaining the current inventory data statistically obtained before the target moment includes: Obtain the inventory data statistically obtained before the target moment and the time stamp corresponding to the inventory data, where the inventory data and the time stamp are stored in the form of a structure; Determine the current inventory data in the structure.

3. The method according to claim 2, wherein, The structure includes key-value pairs, and the key-value pairs have an associated relationship with the resource specifications; The determining the current inventory data in the structure includes: According to the target resource specification included in the creation request, determine the first target key-value pair having an associated relationship with the target resource specification, where the primary key in the first target key-value pair includes the time stamp closest to the target moment; Determine the key value in the first target key-value pair as the current inventory data.

4. The method according to any one of claims 1 to 3, wherein The generation time stamp of the scheduling request and the resource quantity included in the scheduling request are stored in the form of a structure; The determining the inventory change amount of the virtual resource within the target time period includes: According to the generation time stamps of different scheduling requests in the structure, obtain the scheduling requests generated within the target time period, where the scheduling requests include creation requests and / or release requests for virtual resources; Determine the resource quantity included in the scheduling requests generated within the target time period from the structure; Determine the inventory change amount within the target time period according to the resource quantity included in the scheduling requests.

5. The method according to claim 4, wherein The structure includes key-value pairs; The obtaining the resource scheduling requests for virtual resources generated within the target time period according to the generation time stamps of different scheduling requests in the structure includes: Determine the second target key-value pair, where the primary key in the second target key-value pair includes the generation time stamp of the scheduling request, and the generation time stamp is within the target time period, and the key value in the second target key-value pair includes the resource quantity in the scheduling request; The determining the inventory change amount within the target time period according to the resource quantity includes: Determine the inventory change amount within the target time period according to the key value in the second target key-value pair.

6. The method according to any one of claims 1 to 5, wherein The method further includes: Obtain historical inventory data counted before the current inventory data, with a preset time interval between the timestamps corresponding to the current inventory data and the historical inventory data; determine the inventory change amount within the historical period according to the number of resources included in the scheduling requests generated within the historical period, where the historical period is the period composed of the timestamps corresponding to the historical inventory data and the current inventory data, and the scheduling requests include creation requests and / or release requests for virtual resources; the verification of the current inventory data according to the inventory change amount within the target period includes: if the difference between the historical inventory data and the current inventory data is greater than or equal to the inventory change amount within the historical period, then verify the current inventory data according to the inventory change amount within the target period.

7. The method according to claim 6, wherein, The method further includes: if the timestamp corresponding to the historical inventory data is later than the reference moment, then determine the period composed of the timestamps corresponding to the historical inventory data and the current inventory data as the historical period, where the reference moment is earlier than the target moment by a preset time interval; if the timestamp corresponding to the historical inventory data is earlier than the reference moment, then determine the period composed of the statistical timestamp of the current inventory data and the reference moment as the historical period.

8. The method according to any one of claims 1 to 7, wherein The method further includes: in response to a creation request for a virtual resource generated at the target moment, if the database storing the inventory data is empty, then determine the inventory change amount of the virtual resource within the target period, where the target period is composed of the target moment and the reference moment, and the reference moment is earlier than the target moment by a preset time interval; determine the inventory change amount within the target period as the verified inventory data of the virtual resource at the target moment.

9. The method according to any one of claims 1 to 8, wherein The method further includes: if the verified inventory data is greater than the number of resources included in the creation request, then determine that the creation request is valid to create a virtual resource.

10. An inventory data processing system, wherein, Including: A data generation party and a data consumption party; The data generation party is used to count the inventory data of virtual resources within different statistical periods; Synchronize the counted inventory to the data consumption party; the data consumption party is used to receive a creation request for a virtual resource generated at the target moment; obtain the current inventory data counted before the target moment; Determine the inventory change amount of the virtual resource within the target period, where the target period is composed of the target moment and the timestamp corresponding to the current inventory data; Verify the current inventory data according to the inventory change amount within the target period to obtain the verified inventory data of the virtual resource at the target moment.

11. The system according to claim 10, wherein, The timestamp includes any one of the statistical start moment of the inventory data, the statistical end moment, the synchronization start moment of the inventory data, or the synchronization end moment.

12. An electronic device, wherein, Including: A memory and a processor; wherein, executable code is stored on the memory, and when the executable code is executed by the processor, the processor is caused to execute the inventory data processing method according to any one of claims 1 to 9.

13. A non-transitory machine-readable storage medium, wherein, Stored on the non-transitory machine-readable storage medium There is executable code, and when the executable code is executed by the processor of the electronic device, the processor is caused to execute the inventory data processing method according to any one of claims 1 to 9.

14. A computer program product, wherein, Comprising a computer program or instruction, and when the computer program or instruction is executed by a processor, the processor is caused to be able to implement the steps in the inventory data processing method according to any one of claims 1 to 9. 18

Citation Information

Patent Citations

  • Commodity stock information determination method, device and system

    CN107248052A

  • Data synchronization method, device and system

    CN112765277A

  • Cloud server inventory calculation method and device, equipment and storage medium

    CN117278636A

  • Resource allocation for computer processing

    US20200225991A1