Status data management methods, systems, devices, computer equipment, and storage media

CN117667923BActive Publication Date: 2026-08-14JINAN INSPUR DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-17
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0005]有鉴于此,本发明提供了一种状态数据管理方法、系统、装置、计算机设备及存储介质,以解决存储状态数据会导致大量无效数据占用存储空间,对数据进行抽稀,会造成系统复杂度的升高,不易维护,查询状态数据时会造成资源抢占,导致系统计算响应时间长的问题

Benefits of technology

[0049] The status data management system provided in this embodiment collects device status data through a status receiver and delegates the collected status data to a multi-level storage manager for processing. The multi-level storage manager completes the overall work of status data processing, storage, and querying according to various strategies configured in the configuration center. It creates status rings based on the storage strategy configuration, cleans up the corresponding status ring data according to the deletion of the storage strategy, and deletes the status ring. It routes query requests according to the query strategy, distributing requests to the ring that stores the corresponding data and has the smallest data volume in the ring to complete the query task. It implements the specific strategy of the data ring according to the persistence strategy. This solves the problems of large amounts of invalid data occupying storage space when storing status data, increased system complexity and difficulty in maintenance due to data thinning, and long system computation response time caused by resource contention when querying status data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117667923B_ABST
    Figure CN117667923B_ABST
Patent Text Reader

Abstract

This invention relates to the field of data storage technology, and discloses a state data management method, system, device, computer equipment, and storage medium. The method includes: acquiring the state data of the device, a first number of storage strategies, a second number of query strategies, and a persistence strategy; generating a first number of state rings based on the first number of storage strategies and the persistence strategy; storing the state data in each state ring; acquiring a state data query request; and obtaining a query result based on the state data query request, the second number of query strategies, and the state rings. This invention solves the problems that storing state data leads to a large amount of invalid data occupying storage space, data thinning increases system complexity and makes it difficult to maintain, and querying state data causes resource contention, resulting in long system computation response times.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data storage technology, specifically to a state data management method, system, device, computer equipment, and storage medium. Background Technology

[0002] Currently, with the increasing use of big data products and the Internet of Things (IoT), the number of devices requiring monitoring is growing. To more accurately compare and analyze the current status of devices and identify any potential anomalies, it is necessary to manage the status data of each device, including its storage and retrieval.

[0003] Traditional state data management solutions store state data directly in a table format in the database. For state data that only focuses on the most recent period (30 days, 6 months, 1 year, 3 years, etc.), a strategy of periodic cleanup and thinning is used. This results in a large amount of invalid data occupying storage space. Thinning data according to different time dimensions increases system complexity and makes it difficult to maintain. When querying state data over a period of time, a direct search is performed by time range. For state data that requires statistical data such as state curves, a strategy of real-time or periodic segmented calculation is used. This consumes system resources, causes resource contention, and leads to particularly long system calculation response times, affecting user experience.

[0004] Therefore, the related technologies have problems such as storing state data leading to a large amount of invalid data occupying storage space, data thinning increasing system complexity and making it difficult to maintain, and resource contention during state data queries causing long system computation response times. Summary of the Invention

[0005] In view of this, the present invention provides a state data management method, system, device, computer equipment and storage medium to solve the problems that storing state data will lead to a large amount of invalid data occupying storage space, data thinning will increase system complexity and make it difficult to maintain, and querying state data will cause resource contention and result in long system calculation response time.

[0006] In a first aspect, the present invention provides a state data management method, the method comprising:

[0007] Obtain device status data, a first number of storage strategies, a second number of query strategies, and a persistence strategy;

[0008] Based on a first number of storage strategies, determine the ring length of the state ring, the hash key, and the data type stored in each node on the state ring for each storage strategy, wherein the hash key is used to distinguish each node on the state ring.

[0009] Based on the persistence strategy, determine the storage method for each state ring;

[0010] Generate the first number of state rings based on the ring length, hash key, data type, and storage method;

[0011] Store state data in each state ring;

[0012] Request to retrieve status data;

[0013] Based on the state data query request, the second number of query strategies, and the state ring, the query results are obtained, where the query strategy is used to determine the state ring in which the query results are located.

[0014] The state data management method provided in this embodiment generates multiple state rings based on multiple storage and persistence strategies, and stores state data in each state ring. By configuring storage strategies, the size and number of state rings can be dynamically adjusted, allowing for flexible adjustments based on business needs. Storing state data in a ring-shaped data structure allows for dynamic updates of real-time state without changing the storage space, avoiding data cleaning and thinning operations, reducing system resource consumption during state data processing, and making overall storage operation more stable and resource consumption more balanced. State rings can store state data of different dimensions separately. Based on state data query requests and multiple query strategies, query results are obtained in the state rings, reducing the overall amount of stored data, simplifying the business complexity of state data storage and querying, improving query efficiency, and enhancing user experience. This method solves the problems of large amounts of invalid data occupying storage space when storing state data, increased system complexity and difficulty in maintenance due to data thinning, and resource contention and long system response times when querying state data.

[0015] In one alternative implementation, storing state data in each state ring includes:

[0016] Get the timestamp corresponding to the status data;

[0017] Based on the timestamp, calculate the current hash key corresponding to the state data on each state ring;

[0018] Determine the target node corresponding to the state data on each state ring based on the current hash key;

[0019] Based on the data type corresponding to the target node, the state data is stored in the target node on each state ring.

[0020] In this implementation, the current hash key corresponding to the state data on each state ring is calculated based on the timestamp. The target node corresponding to the state data on each state ring is determined based on the hash key, ensuring that the state data is stored in an orderly manner, the total length of the state ring is fixed, and the amount of data is fixed. Based on the data type corresponding to the target node, the state data is stored on the target node of each state ring. This enables the storage of data of different dimensions without modifying the code, thereby improving the system flexibility.

[0021] In one optional implementation, the state data is stored in the target node on each state ring according to the data type corresponding to the target node, including:

[0022] When the data type is state data, retrieve the node data of the target node;

[0023] If the node data is empty, the state data will be stored in the target node;

[0024] If the node data is not empty, clear the target node and store the state data in the target node.

[0025] In this embodiment, when the data type is state data, if the node data of the target node is empty, the state data is stored in the target node; if the node data is not empty, the target node is cleared, and the state data is stored in the target node. This invention provides a dynamic data cleanup mechanism through the above method, eliminating the need for users to manually process or design programs to clean up invalid data, ensuring the timeliness of data at all times, reducing the storage space occupied by invalid data, and reducing system complexity.

[0026] In one optional implementation, the state data is stored in the target node on each state ring according to the data type corresponding to the target node, including:

[0027] When the data type is statistical data, obtain the node data of the target node, where the statistical data is obtained based on the state data;

[0028] If the node data is empty, the target node data is obtained based on the statistical data and status data, and the target node data is stored in the target node.

[0029] If the node data is not empty, obtain the collection frequency of each state ring, and determine whether the state data is the first data collected within the preset statistical period based on the collection frequency and timestamp.

[0030] If the status data is the first data collected within the preset statistical period, then the target node is reset, the target node data is obtained based on the statistical data and status data, and the target node data is stored in the target node.

[0031] If the status data is not the first data collected within the preset statistical period, then update the node data based on the status data.

[0032] In this embodiment, when the data type is statistical data, the status data is processed or aggregated based on whether the node data is empty and whether the status data is the first data collected within a preset statistical period. This allows for the storage of statistical data from different dimensions, thereby reducing the overall amount of stored data and improving subsequent query efficiency.

[0033] In one optional implementation, the query result is obtained based on the state data query request, the second number of query strategies, and the state ring, including:

[0034] Based on the status data query request, determine the query time period and query data type;

[0035] Based on the status data query request and the second number of query strategies, determine the target query strategy;

[0036] Based on the target query strategy and the state ring, determine the target state ring corresponding to the state data query request;

[0037] Based on the query time period and the target state ring, query the node data within the query time period;

[0038] Adjust the node data according to the data type of the query to obtain the query results.

[0039] In this embodiment, the present invention configures different query strategies, which correspond to the state rings generated by the storage strategies, for querying state data result sets under different time intervals and query conditions. The query strategies can also be quickly adjusted according to business needs, achieving rapid adjustments to query methods, query scope, and query results without modifying system functionality. Furthermore, the present invention queries within the smallest possible data range each time, improving query efficiency, reducing the time spent on state data query requests, and enhancing user experience.

[0040] In one alternative implementation, the method further includes:

[0041] Determine if a deleted storage policy exists;

[0042] If it exists, delete the state ring corresponding to the deleted storage policy.

[0043] In this embodiment, the corresponding state ring data is cleaned up according to the deletion of storage strategy, the state ring is deleted, redundant data is deleted, storage space is saved, and the system flexibility is improved.

[0044] In a second aspect, the present invention provides a status data management system, which includes: a multi-level storage manager, a status receiver, a configuration center, and a storage module;

[0045] The status receiver is connected to the multilevel storage manager to acquire the device's status data and transmit the status data to the multilevel storage manager;

[0046] The configuration center is connected to the multi-level storage manager to determine a first number of storage policies, a second number of query policies, and a persistence policy, and to transmit the first number of storage policies, the second number of query policies, and the persistence policy to the multi-level storage manager.

[0047] The multi-level storage manager is connected to the storage module and is used to generate a first number of state rings according to a first number of storage policies and persistence policies, and store all state rings in the storage module.

[0048] The multi-level storage manager is used to store state data in each state ring, obtain state data query requests, and obtain query results based on the state data query requests, a second number of query strategies, and the state ring. The query strategy is used to determine the state ring in which the query result is located.

[0049] The status data management system provided in this embodiment collects device status data through a status receiver and delegates the collected status data to a multi-level storage manager for processing. The multi-level storage manager completes the overall work of status data processing, storage, and querying according to various strategies configured in the configuration center. It creates status rings based on the storage strategy configuration, cleans up the corresponding status ring data according to the deletion of the storage strategy, and deletes the status ring. It routes query requests according to the query strategy, distributing requests to the ring that stores the corresponding data and has the smallest data volume in the ring to complete the query task. It implements the specific strategy of the data ring according to the persistence strategy. This solves the problems of large amounts of invalid data occupying storage space when storing status data, increased system complexity and difficulty in maintenance due to data thinning, and long system computation response time caused by resource contention when querying status data.

[0050] Thirdly, the present invention provides a status data management device, the device comprising:

[0051] The first acquisition module is used to acquire device status data, a first number of storage strategies, a second number of query strategies, and a persistence strategy.

[0052] The first determining module is used to determine the ring length, hash key, and data type of each node on the state ring corresponding to each storage strategy according to a first number of storage strategies, wherein the hash key is used to distinguish each node on the state ring.

[0053] The second determination module is used to determine the storage method for each state ring based on the persistence strategy;

[0054] The generation module is used to generate a first number of state rings based on the ring length, hash key, data type, and storage method.

[0055] The storage module is used to store state data to each state ring;

[0056] The second acquisition module is used to acquire status data query requests;

[0057] The module is used to obtain query results based on the state data query request, the second number of query strategies, and the state ring. The query strategy is used to determine the state ring in which the query result is located.

[0058] Fourthly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the state data management method described in the first aspect or any corresponding embodiment thereof.

[0059] Fifthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the state data management method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0060] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0061] Figure 1 This is a flowchart illustrating a state data management method according to an embodiment of the present invention;

[0062] Figure 2 This is a storage strategy state data storage logic diagram according to an embodiment of the present invention;

[0063] Figure 3 This is a structural diagram of a status data management system according to an embodiment of the present invention;

[0064] Figure 4 This is a structural block diagram of a state data management device according to an embodiment of the present invention;

[0065] Figure 5This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0066] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0067] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0068] In the field of data storage technology, the current main approach is still the traditional state data storage solution, which involves periodically or in real-time processing of device state data. This storage solution has the following problems: 1. To avoid affecting the normal operation of the data storage system during working hours, scheduled calculation tasks are usually processed at night when access is low. However, due to the large number of device types and the complexity of statistical analysis dimensions, a large number of scheduled tasks accumulate, causing resource contention. 2. The large volume of state data leads to prolonged processing time for scheduled calculation tasks, preventing timely release of computing resources. 3. For some detailed data and periodic statistical data with high real-time requirements, such as querying the average state data of similar devices at 10:05 AM for the past 30 days, scheduled tasks cannot meet the real-time requirements, necessitating real-time calculation. However, when the data volume is too large, the system's calculation response time becomes extremely long, impacting user experience. 4. Traditional storage methods have two approaches for scenarios where there is a need to query the status data of similar devices for the most recent 7 days, 30 days, 90 days, 6 months, and 1 year. One approach is to clean up the data after the longest query period (e.g., 1 year), which results in a large amount of invalid data occupying storage space. The other approach is to thin out the data according to different time dimensions, which increases the complexity of the system and makes it difficult to maintain.

[0069] Based on the above, this invention provides a state data management method that employs a multi-level state data storage scheme. It uses hash calculation to store state data in a state ring with a circular data structure, thereby achieving the goal of storing state data within its validity period using minimal storage space without requiring additional data thinning or cleaning operations. Different storage strategies can be configured according to different business needs, with each storage strategy corresponding to a state ring for convenient storage of processed state data. Different query strategies can be configured according to business needs, operating on the data storage ring generated by the storage strategy configuration to query state result sets at different time intervals and under different query conditions. A persistence strategy can be configured to implement data persistence and landing on the data storage ring, ensuring data security. This achieves the effects of simplifying the business complexity of state data storage and querying, reducing system resource consumption during state data processing, and making the overall storage operation more stable and resource consumption more balanced.

[0070] According to an embodiment of the present invention, a state data management method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a set of computer devices with data processing capabilities. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0071] This embodiment provides a state data management method, which can be used in the aforementioned computer equipment. Figure 1 This is a flowchart of a state data management method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:

[0072] Step S101: Obtain device status data, a first number of storage strategies, a second number of query strategies, and a persistence strategy.

[0073] Specifically, this invention differs from the traditional historical state data storage and maintenance method in the storage industry: state information is first stored in the database, and then data-related processing (cleaning, thinning, calculation, etc.) is performed as needed. This invention proposes a technical solution of processing state data first and then storing it in the database (for multi-level storage).

[0074] The main approach of this invention is to collect status data from various devices through a status receiver, and then entrust the collected status data to a multi-level storage manager for processing. Status data includes, for example, CPU utilization. A configuration center configures and manages a first number of storage policies, a second number of query policies, and persistence policies within the multi-level storage manager. The first and second numbers represent multiple policies, and query policies and storage policies are used in conjunction, with a many-to-one relationship; multiple query policies correspond to one storage policy.

[0075] The multi-level storage manager performs tasks such as processing, storing, and querying state data based on the storage policies, query policies, and persistence policies configured in the configuration center. This includes: creating state rings according to the storage policy configuration; cleaning up the corresponding state ring data according to the storage policy deletion; and deleting the state ring; routing query requests according to the query policy, distributing the requests to the ring that stores the corresponding data and has the smallest data volume in the ring to complete the query task; and implementing the specific implementation strategy of the data ring according to the persistence policy.

[0076] Step S102: Based on the first number of storage strategies, determine the ring length of the state ring, the hash key, and the data type stored in each node on the state ring for each storage strategy, wherein the hash key is used to distinguish each node on the state ring.

[0077] Step S103: Determine the storage method for each state ring according to the persistence strategy.

[0078] Step S104: Generate the first number of state rings based on the ring length, hash key, data type, and storage method.

[0079] Specifically, the multi-level state data storage scheme adopted in this invention has a default storage strategy. The default strategy is as follows: the state ring uses a hash ring to store state data in the form of a state ring. The hash key on the state ring is calculated based on the timestamp of the state data, so the hash key has an increasing trend, and the hash ring length is infinite. When the user does not configure a storage strategy, the state data will be stored according to the default storage strategy without special processing. When the user configures a storage strategy, the multi-level storage manager generates the corresponding state ring according to the storage strategy configuration, and deletes the default state ring created by the default storage strategy to reduce resource consumption. The persistence strategy is used to determine how this logical structure of the state ring is implemented and how it is actually persistently stored on disk, etc. Each persistence strategy corresponds to a specific implementation scheme, similar to database connections in Java. A unified interface is exposed to the multi-level storage manager, which can achieve the effect of seamlessly switching the specific implementation scheme of the state ring through the configuration center.

[0080] Each storage strategy corresponds to a state ring, facilitating the storage of processed state data. The size, hash key, and data type of the state ring can be determined based on the storage strategy, and a first number of state rings can be generated based on a first number of storage strategies. The specific implementation and storage scheme for each state ring can be determined based on the persistence strategy.

[0081] Based on a first set of storage strategies, determine the ring length, hash key, and data type stored by each node on the state ring for each strategy. For example, storage strategy 1: retains state data from the most recent year, with a data frequency of once per day. Therefore, the ring length of the state ring corresponding to storage strategy 1 is 365, the hash key is the number of days in the year, and the data type stored by each node on the state ring is state data; that is, a single node on the state ring stores the state data for that day. Storage strategy 2: stores statistical data from the most recent year, with a statistical period of one month. Therefore, the ring length of the state ring corresponding to storage strategy 2 is 12, the hash key is the month, and the data type stored by each node on the state ring is statistical data; that is, each node on the state ring stores statistical data for one month, including: state peak values, state trough values, state average values, and total state values.

[0082] Based on the persistence strategy, the storage method for each state ring is determined. For example, persistence strategy 1 uses MySQL (a relational database management system), and persistence strategy 2 uses Redis (Remote Dictionary Server). Additionally, custom persistence strategies can be implemented according to the unified interface of the persistence strategy as needed. Persistence Strategy 1: MySQL is a relational database that stores state data using tables. Persistence strategy 1 directly uses tables to store state data in the database, but the table name is the name of the corresponding state ring. The table primary key is the hash key of the state ring node, and state data is stored in the table as the value in key-value format. The total number of rows in the table is the total number of nodes in the state ring. Because the table primary key is the hash value of the state ring, the total amount of data in the table remains constant, only continuously overwritten, and will not increase indefinitely. The persistence strategy of the MySQL database itself is reused to complete the data persistence operation, ensuring that state data is not lost. Persistence Strategy 2: Redis is a non-relational database where state data is mainly stored in memory, resulting in higher query efficiency. The state ring is implemented using Redis's sorted set (zset) data structure. The zset's score serves as the hash key for each node in the state ring, and each element stores the node's hash key and its corresponding state data. Because the state ring's hash key is the zset's score, and the zset data structure guarantees that scores are ordered, the total length of the zset is fixed and will not increase indefinitely. Redis's built-in persistence mechanism ensures reliability.

[0083] Based on the ring length, hash key, data type, and storage method, generate the first number of state rings, with each storage strategy corresponding to one state ring.

[0084] In addition, through the configuration center, storage policies and persistence policies can be dynamically added or deleted according to business needs, different state rings can be created, and data of different dimensions can be stored without modifying the code, thus improving system flexibility.

[0085] Step S105: Store the state data in each state ring.

[0086] Specifically, state data is stored in each state ring, using a ring structure to ensure the total amount of state data remains within a specified range, eliminating the need for periodic cleanup. Furthermore, data requiring querying and display across multiple time dimensions is processed and stored in other ring structures, employing data redundancy to reduce resource and time consumption during querying and display.

[0087] Step S106: Obtain the status data query request.

[0088] Step S107: Based on the state data query request, the second number of query strategies, and the state ring, obtain the query result, wherein the query strategy is used to determine the state ring in which the query result is located.

[0089] Specifically, it retrieves user status data query requests, such as querying the status data curve for the most recent year, querying the average monthly status data curve for the most recent year, and querying the status data curve for status data between March 5th and June 8th.

[0090] Query strategies and storage strategies are used in conjunction, with a many-to-one relationship; multiple query strategies correspond to one storage strategy. Therefore, based on the query strategy, the state ring corresponding to the state data query request can be determined. Finally, based on the state data stored on that state ring, the query result that satisfies the state data query request is obtained.

[0091] The state data management method provided in this embodiment generates multiple state rings based on multiple storage and persistence strategies, and stores state data in each state ring. By dynamically configuring the storage strategy, the size of the storage rings can be dynamically adjusted, and the number of storage rings can be dynamically increased or decreased, facilitating flexible adjustments according to business needs. The storage method is determined based on the persistence strategy, and each state ring is stored to ensure that state data is not lost and to avoid an excessively large total amount of stored state data. Storing state data through a ring-shaped data structure allows for dynamic updates of real-time state without changing the storage space, avoiding data cleaning and thinning operations, reducing system resource consumption during state data processing, and making the overall storage operation more stable and resource consumption more balanced. State rings can store state data of different dimensions separately. Based on state data query requests and multiple query strategies, query results are obtained in the state rings, reducing the overall amount of stored data, simplifying the business complexity of state data storage and querying, improving query efficiency, and enhancing user experience. This method solves the problems of large amounts of invalid data occupying storage space when storing state data, increased system complexity and difficulty in maintenance due to data thinning, and resource contention and long system response times when querying state data.

[0092] In some alternative implementations, state data is stored in each state ring, including:

[0093] Get the timestamp corresponding to the status data;

[0094] Based on the timestamp, calculate the current hash key corresponding to the state data on each state ring;

[0095] Determine the target node corresponding to the state data on each state ring based on the current hash key;

[0096] Based on the data type corresponding to the target node, the state data is stored in the target node on each state ring.

[0097] Specifically, because the state data to be stored is strongly correlated with timeliness, the timestamps corresponding to the state data are hashed to determine the correct location for the state data within the state ring, and then the state data is written to that location. For example, if the CPU utilization rate of the device for the most recent hour needs to be stored, with a storage frequency of once per minute, then the total length of the state ring is 60, with each node representing a minute. The position of each collected state data within the state ring should be determined by: obtaining the timestamp (minute value) corresponding to the state data, calculating the minute number of that time within the hour, and then writing it to the corresponding position in the state ring. Other storage frequencies and storage periods follow the same calculation method, although modulo operations may be required.

[0098] Obtain the timestamp corresponding to the state data; based on the timestamp, calculate the current hash key of the state data on each state ring, and determine the target node corresponding to the state data on each state ring based on the current hash key. Combined with... Figure 2 Detailed explanation: Figure 2 The state ring in the diagram is a hash ring storing state values ​​from the most recent year. This state ring has 364 nodes, numbered 1-364. The hash key is the position within the year corresponding to the timestamp of the collected state data. For example, if the state data's time (timestamp) is 2023-02-12 8:10:10, hashing this timestamp yields the current hash key on the state ring, as shown in the diagram: February 12th is the 43rd day of the year, and the corresponding hash key (hash value) is 31 + 12 = 43, with the target node being node 43. If the state data is stored on a daily basis, the hash calculation method involves using functions from different language libraries to calculate the day of the year for a given date, such as the `LocalDate.getDayOfYear()` function in Java. The hash key determines the target node for each state data node on the state ring. Furthermore, the hash key value is calculated from the timestamp representing the state data collection time. Since the state data is collected periodically, the hash key also exhibits an increasing trend.

[0099] Based on the data type of the target node, the state data is stored in the target node on each state ring. For example, if the target node stores state data, after receiving the state data, the corresponding number of days is calculated according to the state date, and the state data is stored in the target node of the state ring. As time passes, the total amount of data in the state ring does not change, but the state data is always within its validity period. If the target node stores statistical data, after receiving the state data, it needs to be processed to obtain the data of the corresponding data type for the target node, and then saved to the target node.

[0100] In this implementation, the current hash key corresponding to the state data on each state ring is calculated based on the timestamp. The target node corresponding to the state data on each state ring is determined based on the hash key, ensuring that the state data is stored in an orderly manner, the total length of the state ring is fixed, and the amount of data is fixed. Based on the data type corresponding to the target node, the state data is stored on the target node of each state ring. This enables the storage of data of different dimensions without modifying the code, thereby improving the system flexibility.

[0101] In some optional implementations, state data is stored in the target node on each state ring according to the data type corresponding to the target node, including:

[0102] When the data type is state data, retrieve the node data of the target node;

[0103] If the node data is empty, the state data will be stored in the target node;

[0104] If the node data is not empty, clear the target node and store the state data in the target node.

[0105] Specifically, upon receiving status data, the corresponding number of days is calculated based on the status date, and the status data is placed in the corresponding position on the status ring. If all nodes in the status ring store status data, receiving new status data will overwrite the previously stored data, ensuring that the total amount of data in the status ring remains unchanged and that the status data is always within its validity period. For example, a status ring stores status data for 30 days at a storage frequency of 1 day, and this status ring has 30 nodes. When status data for day 31 is received, this status data will overwrite the status data stored by the node on day 1 and become the current data for day 30.

[0106] When the data type corresponding to the target node in the state ring is state data, the node data of the target node is first retrieved. If the node data is empty, it means that the target node has not stored state data, and the state data is directly stored in the target node. If the node data is not empty, it means that the target node has already stored state data, and all nodes in the entire state ring have stored state data, reaching the storage cycle of the state ring. It is necessary to overwrite the previous state data. Therefore, if the node data is not empty, the target node is cleared, and then the state data is stored in the target node.

[0107] In this embodiment, when the data type is state data, if the node data of the target node is empty, the state data is stored in the target node; if the node data is not empty, the target node is cleared, and the state data is stored in the target node. This invention provides a dynamic data cleanup mechanism through the above method, eliminating the need for users to manually process or design programs to clean up invalid data, ensuring the timeliness of data at all times, reducing the storage space occupied by invalid data, and reducing system complexity.

[0108] In some optional implementations, state data is stored in the target node on each state ring according to the data type corresponding to the target node, including:

[0109] When the data type is statistical data, obtain the node data of the target node, where the statistical data is obtained based on the state data;

[0110] If the node data is empty, the target node data is obtained based on the statistical data and status data, and the target node data is stored in the target node.

[0111] If the node data is not empty, obtain the collection frequency of each state ring, and determine whether the state data is the first data collected within the preset statistical period based on the collection frequency and timestamp.

[0112] If the status data is the first data collected within the preset statistical period, then the target node is reset, the target node data is obtained based on the statistical data and status data, and the target node data is stored in the target node.

[0113] If the status data is not the first data collected within the preset statistical period, then update the node data based on the status data.

[0114] Specifically, when the data type is statistical data, the statistical data includes mean, peak, valley, total, and number of times the statistics are counted. Each time the state data is received, the node data of the corresponding target node is queried, compared and aggregated, and then the node data of the target node is updated. This ensures that the statistical data stored in the nodes of the state ring is always the latest statistical result.

[0115] If the node data is empty, the state data is processed according to the type of statistical data that the target node should store, such as mean, peak, valley, total, and number of statistics, to obtain the target node data, and the target node data is stored in the target node. For example, if the node data is empty, the current state value is directly written into the statistical data attribute of the target node, where peak = current state data, valley = current state data, number of statistics = 1, state mean = current state data, and average = current state data.

[0116] If the node data is not empty, the collection frequency of each state ring is obtained, and the state data is determined to be the first data collected within the preset statistical period based on the collection frequency and timestamp. For example, if the preset statistical period is 1 month, the collection frequency of the state ring is once per minute, and the timestamp of the state data is the first minute of the month, then the state data is the first collection of the node in this month, that is, the state data is the first data collected within the preset statistical period.

[0117] If the status data is the first data collected within a preset statistical period, then resetting the target node means clearing the node data of the target node. Based on the type of statistical data that the target node should store, the status data is processed to obtain the target node data, and the target node data is stored in the target node. For example, the target node data might have the following characteristics: peak value = current status data, valley value = current status data, number of statistics = 1, status average = current status data, and mean = current status data.

[0118] If the status data is not the first data collected within the preset statistical period, the node data is updated based on the status data. For example, if the node data is not empty, and the current collection is not the first collection for the month corresponding to the node, the status data and node data are aggregated, including: Peak value = Original peak value >= Current value? Original peak value: Current value. The above content is a ternary operator indicating that the peak value after aggregation is the larger of the current value and the original peak value, and the current value is determined based on the status data; Valley value = Original valley value >= Current value? Current value: Original valley value. This means that the peak value after aggregation is the smaller of the current value and the original valley value, and the current value is determined based on the status data; Total value = Original total value + Current value; Number of statistics = Original number of statistics + 1; Mean value = Total value / Number of statistics.

[0119] In this embodiment, when the data type is statistical data, the status data is processed or aggregated based on whether the node data is empty and whether the status data is the first data collected within a preset statistical period. This allows for the storage of statistical data from different dimensions, thereby reducing the overall amount of stored data and improving subsequent query efficiency.

[0120] In some optional implementations, the query results are obtained based on the state data query request, the second number of query strategies, and the state ring, including:

[0121] Based on the status data query request, determine the query time period and query data type;

[0122] Based on the status data query request and the second number of query strategies, determine the target query strategy;

[0123] Based on the target query strategy and the state ring, determine the target state ring corresponding to the state data query request;

[0124] Based on the query time period and the target state ring, query the node data within the query time period;

[0125] Adjust the node data according to the data type of the query to obtain the query results.

[0126] Specifically, based on the status data query request, the query time period and query data type are determined. For example, status data query request 1 is to query the monthly status average curve for the past year, accurate to the month. Based on status data query request 1, the query time period is determined to be the past year, and the query data type is the status average from statistical data. Status data query request 2 is to query the status data curve between March 5th and June 8th. Based on status data query request 1, the query time period is determined to be March 5th to June 8th, the query data type is status data, and the status data curve can be obtained from the status data.

[0127] Based on the status data query request and the second number of query strategies, the target query strategy that matches the status data query request is determined. Since query strategies and storage strategies are used in conjunction, with a many-to-one relationship, multiple query strategies correspond to one storage strategy. This determines the target status ring corresponding to the status data query request. In addition, if multiple query strategies match the status data query request, that is, if multiple status rings can retrieve data, the status data query request will be preferentially sent to the status ring with the shortest length when distributing the status data query request. This is to reduce the retrieval volume and improve retrieval efficiency. For example, if the user queries status data within one month, the query strategy will preferentially distribute the request to the ring with a length of 30 and a hash key of "day", rather than to the longer status ring.

[0128] Based on the query time period and target state ring, query the node data within the query time period, adjust the node data according to the query data type, and obtain the query results. For example, for state data query request 1, the node data within the query time period in the state ring can be aggregated and calculated by month: Monthly state average = Sum of state ring intervals (number of days in the year corresponding to the 1st of the month (position of the corresponding node in the ring, hash value), number of days in the year corresponding to the last day of the month) / Sum of the number of nodes in the state ring interval (number of days in the year corresponding to the 1st of the month, number of days in the year corresponding to the last day of the month). Using the above formula, the monthly state average can be calculated in just a few simple steps. Then, the state average for the remaining 11 months can be calculated sequentially to obtain the monthly state average curve for the most recent year. For state data query request 2, calculate the positions of March 5th and June 8th in the state ring, read all node data between the two nodes in the state ring, and obtain the state data curve between March 5th and June 8th without any additional operations.

[0129] In this embodiment, the present invention configures different query strategies, which correspond to the state rings generated by the storage strategies, for querying state data result sets under different time intervals and query conditions. The query strategies can also be quickly adjusted according to business needs, achieving rapid adjustments to query methods, query scope, and query results without modifying system functionality. Furthermore, the present invention queries within the smallest possible data range each time, improving query efficiency, reducing the time spent on state data query requests, and enhancing user experience.

[0130] In some alternative implementations, the method further includes:

[0131] Determine if a deleted storage policy exists;

[0132] If it exists, delete the state ring corresponding to the deleted storage policy.

[0133] Specifically, the present invention can create state rings by configuring storage policies, and can also clean up the corresponding state ring data and delete the corresponding state ring by deleting storage policies. Specifically, it includes: users deleting storage policies according to business needs, the storage system determining whether there are any deleted storage policies, and if so, deleting the state ring corresponding to the deleted storage policy.

[0134] In this embodiment, the corresponding state ring data is cleaned up according to the deletion of storage strategy, the state ring is deleted, redundant data is deleted, storage space is saved, and the system flexibility is improved.

[0135] This embodiment provides a status data management system that can be deployed in the aforementioned computer device. The system includes: a multi-level storage manager, a status receiver, a configuration center, and a storage module.

[0136] The status receiver is connected to the multilevel storage manager to acquire the device's status data and transmit the status data to the multilevel storage manager;

[0137] The configuration center is connected to the multi-level storage manager to determine a first number of storage policies, a second number of query policies, and a persistence policy, and to transmit the first number of storage policies, the second number of query policies, and the persistence policy to the multi-level storage manager.

[0138] The multi-level storage manager is connected to the storage module and is used to generate a first number of state rings according to a first number of storage policies and persistence policies, and store all state rings in the storage module.

[0139] The multi-level storage manager is used to store state data in each state ring, obtain state data query requests, and obtain query results based on the state data query requests, a second number of query strategies, and the state ring. The query strategy is used to determine the state ring in which the query result is located.

[0140] Specifically, in combination Figure 3 This embodiment will be described. The state data management system includes: a multi-level storage manager, a state receiver, a configuration center, and a storage module. The storage module is a storage device used to store the state ring and the state data on the state ring, and is not located in... Figure 3 Presented in the middle.

[0141] The status receiver is the sole entry point for status data collection, uniformly receiving status data from various devices. This data can be status data proactively reported by devices, or status data actively collected by the status receiver from various devices. The status receiver connects to a multi-level storage manager, transmitting status data to the multi-level storage manager.

[0142] The configuration center is the sole entry point for configuring storage policies, query policies, and persistence policies in this invention. Users configure these policies, including adding or deleting them, within the configuration center. The configuration center is connected to a multi-level storage manager and is used to determine a first number of storage policies (including storage policy 1, storage policy 2, and the default storage policy), a second number of query policies (including query policy 1, query policy 2, query policy 3, etc.), and persistence policies. It then transmits these policies to the multi-level storage manager for storage. Furthermore, the configuration center is also used to configure and manage the storage policies, query policies, and persistence policies stored in the multi-level storage manager.

[0143] The multi-level storage manager implements a multi-level state data storage scheme, implementing and executing various strategies configured by the user configuration center. Based on a first set of storage and persistence strategies, it generates a first set of state rings and manages each state ring. For example, it generates a real-time state ring based on the default storage and persistence strategies, generates state ring 1 based on storage strategy 2 and persistence strategies, and generates state ring 2 based on storage strategy 1 and persistence strategies. Furthermore, query strategies and storage strategies are used in conjunction, with a many-to-one relationship; multiple query strategies correspond to one storage strategy. For example, query strategy 1 corresponds to the real-time state ring, query strategies 2 and 3 correspond to state ring 1, and other query strategies correspond to state ring 2, etc. The multi-level storage manager is connected to the storage module, storing all state rings within the storage module. The state ring is the specific storage carrier for state data, storing state data in the form of a hash ring.

[0144] The multi-level storage manager is also used to store state data in each state ring, obtain state data query requests, and obtain query results based on the state data query requests, a second number of query strategies, and the state rings.

[0145] In addition, through the configuration center, storage strategies, query strategies, and persistence strategies can be dynamically added (deleted) according to business needs, creating different state rings to store data of different dimensions without modifying the code, thus improving system flexibility.

[0146] The status data management system provided in this embodiment collects device status data through a status receiver and delegates the collected status data to a multi-level storage manager for processing. The multi-level storage manager completes the overall work of status data processing, storage, and querying according to various strategies configured in the configuration center. It creates status rings based on the storage strategy configuration, cleans up the corresponding status ring data according to the deletion of the storage strategy, and deletes the status ring. It routes query requests according to the query strategy, distributing requests to the ring that stores the corresponding data and has the smallest data volume in the ring to complete the query task. It implements the specific strategy of the data ring according to the persistence strategy. This solves the problems of large amounts of invalid data occupying storage space when storing status data, increased system complexity and difficulty in maintenance due to data thinning, and long system computation response time caused by resource contention when querying status data.

[0147] This embodiment also provides a state data management device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0148] This embodiment provides a status data management device, such as... Figure 4 As shown, it includes:

[0149] The first acquisition module 401 is used to acquire device status data, a first number of storage strategies, a second number of query strategies, and a persistence strategy.

[0150] The first determining module 402 is used to determine the ring length, hash key, and data type of each node on the state ring corresponding to each storage strategy according to a first number of storage strategies, wherein the hash key is used to distinguish each node on the state ring.

[0151] The second determining module 403 is used to determine the storage method of each state ring according to the persistence strategy;

[0152] The generation module 404 is used to generate a first number of state rings based on the ring length, hash key, data type, and storage method.

[0153] Storage module 405 is used to store state data to each state ring;

[0154] The second acquisition module 406 is used to acquire status data query requests;

[0155] The module 407 is used to obtain the query result based on the state data query request, the second number of query strategies, and the state ring, wherein the query strategy is used to determine the state ring in which the query result is located.

[0156] In some alternative implementations, the storage module 405 includes:

[0157] The acquisition unit is used to acquire the timestamp corresponding to the status data.

[0158] The calculation unit is used to calculate the current hash key of the state data on each state ring based on the timestamp;

[0159] The third determining unit is used to determine the target node corresponding to the state data on each state ring based on the current hash key;

[0160] The storage unit is used to store state data to the target node on each state ring according to the data type corresponding to the target node.

[0161] In some alternative implementations, the storage unit includes:

[0162] The first acquisition submodule is used to acquire the node data of the target node when the data type is state data;

[0163] The first storage submodule is used to store state data to the target node if the node data is empty;

[0164] The second storage submodule is used to clear the target node and store the state data in the target node if the node data is not empty.

[0165] In some alternative implementations, the storage unit includes:

[0166] The second acquisition submodule is used to acquire node data of the target node when the data type is statistical data, wherein the statistical data is obtained based on the status data;

[0167] The submodule is used to obtain the target node data based on statistical data and status data if the node data is empty, and then store the target node data in the target node.

[0168] The judgment submodule is used to obtain the sampling frequency of each state ring if the node data is not empty, and to determine whether the state data is the first data collected within the preset statistical period based on the sampling frequency and timestamp.

[0169] The third storage submodule is used to reset the target node if the status data is the first data collected within the preset statistical period, obtain the target node data based on the statistical data and status data, and store the target node data in the target node.

[0170] The update submodule is used to update node data based on the status data if the status data is not the first data collected within the preset statistical period.

[0171] In some alternative implementations, module 407 includes:

[0172] The fourth determining unit is used to determine the query time period and query data type based on the status data query request;

[0173] The fifth determining unit is used to determine the target query strategy based on the status data query request and the second number of query strategies;

[0174] The sixth determining unit is used to determine the target state ring corresponding to the state data query request based on the target query strategy and the state ring.

[0175] The query unit is used to query node data within the query time period based on the query time period and the target state ring;

[0176] The obtained unit is used to adjust the node data according to the query data type to obtain the query result.

[0177] In some alternative embodiments, the device further includes:

[0178] The judgment module is used to determine whether a deleted storage policy exists;

[0179] The deletion module is used to delete the state ring corresponding to the deleted storage policy if it exists.

[0180] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0181] In this embodiment, the state data management device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0182] This invention also provides a computer device having the above-described features. Figure 4 The status data management device shown.

[0183] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 5As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 5 Take a processor 10 as an example.

[0184] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0185] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0186] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0187] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0188] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0189] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0190] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A state data management method, characterized in that, The method includes: Obtain device status data, a first number of storage strategies, a second number of query strategies, and a persistence strategy; Based on a first number of storage strategies, determine the ring length, hash key, and data type stored in each node on the state ring corresponding to each storage strategy, wherein the hash key is used to distinguish each node on the state ring; Based on the persistence strategy, determine the storage method for each state ring; A first number of state rings are generated based on the ring length, the hash key, the data type, and the storage method. The state data is stored in each of the state rings; The step of storing the state data in each of the state rings includes: obtaining a timestamp corresponding to the state data; calculating the current hash key corresponding to the state data in each of the state rings based on the timestamp; determining the target node corresponding to the state data in each of the state rings based on the current hash key; and storing the state data in the target node in each of the state rings based on the data type corresponding to the target node. The step of storing the state data to the target node on each state ring according to the data type corresponding to the target node includes: when the data type is statistical data, obtaining the node data of the target node, wherein the statistical data is obtained based on the state data; if the node data is empty, obtaining the target node data based on the statistical data and the state data, and storing the target node data in the target node; if the node data is not empty, obtaining the collection frequency of each state ring, and determining whether the state data is the first data collected within a preset statistical period based on the collection frequency and the timestamp; if the state data is the first data collected within the preset statistical period, resetting the target node, obtaining the target node data based on the statistical data and the state data, and storing the target node data in the target node; if the state data is not the first data collected within the preset statistical period, updating the node data based on the state data. Request to retrieve status data; Based on the state data query request, the second number of query strategies, and the state ring, a query result is obtained, wherein the query strategy is used to determine the state ring in which the query result is located; The step of obtaining a query result based on the state data query request, the second number of query strategies, and the state ring includes: determining a query time period and query data type based on the state data query request; determining a target query strategy based on the state data query request and the second number of query strategies, wherein determining the target query strategy based on the state data query request and the second number of query strategies includes: if multiple query strategies simultaneously meet the state data query request, selecting the query strategy with the smallest corresponding state ring length as the target query strategy; determining the target state ring corresponding to the state data query request based on the target query strategy and the state ring; querying node data within the query time period based on the query time period and the target state ring; and adjusting the node data according to the query data type to obtain the query result.

2. The method according to claim 1, characterized in that, The step of storing the state data to the target node on each state ring according to the data type corresponding to the target node includes: When the data type is the state data, obtain the node data of the target node; If the node data is empty, then the state data is stored in the target node; If the node data is not empty, then clear the target node and store the state data in the target node.

3. The method according to claim 1, characterized in that, The method further includes: Determine if a deleted storage policy exists; If it exists, then delete the state ring corresponding to the deleted storage policy.

4. A status data management system, characterized in that, The system includes: a multi-level storage manager, a status receiver, a configuration center, and a storage module; The status receiver is connected to the multi-level storage manager and is used to acquire the status data of the device and transmit the status data to the multi-level storage manager. The configuration center is connected to the multi-level storage manager and is used to determine a first number of storage policies, a second number of query policies, and a persistence policy, and to transmit the first number of storage policies, the second number of query policies, and the persistence policy to the multi-level storage manager. The multi-level storage manager is connected to the storage module and is used to generate a first number of state rings according to a first number of storage policies and the persistence policy, and store all the state rings in the storage module. The multi-level storage manager is used to store the state data in each of the state rings, obtain a state data query request, and obtain a query result based on the state data query request, a second number of query strategies, and the state rings, wherein the query strategy is used to determine the state ring in which the query result is located; The multi-level storage manager stores the state data in each state ring, including: obtaining a timestamp corresponding to the state data; calculating the current hash key corresponding to the state data in each state ring based on the timestamp; determining the target node corresponding to the state data in each state ring based on the current hash key; and storing the state data in the target node in each state ring based on the data type corresponding to the target node. The multi-level storage manager stores the state data to the target node on each state ring according to the data type corresponding to the target node, including: when the data type is statistical data, obtaining the node data of the target node, wherein the statistical data is obtained based on the state data; if the node data is empty, obtaining the target node data based on the statistical data and the state data, and storing the target node data in the target node; if the node data is not empty, obtaining the collection frequency of each state ring, and determining whether the state data is the first data collected within a preset statistical period based on the collection frequency and the timestamp; if the state data is the first data collected within the preset statistical period, resetting the target node, obtaining the target node data based on the statistical data and the state data, and storing the target node data in the target node; if the state data is not the first data collected within the preset statistical period, updating the node data based on the state data. The multi-level storage manager obtains a query result based on the state data query request, the second number of query strategies, and the state ring, including: determining the query time period and query data type based on the state data query request; determining a target query strategy based on the state data query request and the second number of query strategies, wherein determining the target query strategy based on the state data query request and the second number of query strategies includes: if multiple query strategies simultaneously meet the state data query request, selecting the query strategy with the smallest corresponding state ring length as the target query strategy; determining the target state ring corresponding to the state data query request based on the target query strategy and the state ring; querying node data within the query time period based on the query time period and the target state ring; and adjusting the node data according to the query data type to obtain the query result.

5. A status data management device, characterized in that, The device includes: The first acquisition module is used to acquire device status data, a first number of storage strategies, a second number of query strategies, and a persistence strategy. The first determining module is configured to determine, based on a first number of storage strategies, the ring length of the state ring corresponding to each storage strategy, the hash key, and the data type stored in each node on the state ring, wherein the hash key is used to distinguish each node on the state ring; The second determining module is used to determine the storage method of each state ring according to the persistence strategy; A generation module is used to generate a first number of state rings based on the ring length, the hash key, the data type, and the storage method; A storage module is used to store the state data in each of the state rings; The storage module includes: an acquisition unit for acquiring the timestamp corresponding to the state data; a calculation unit for calculating the current hash key corresponding to the state data on each state ring based on the timestamp; a third determination unit for determining the target node corresponding to the state data on each state ring based on the current hash key; and a storage unit for storing the state data to the target node on each state ring based on the data type corresponding to the target node. The storage unit includes: a second acquisition submodule, used to acquire node data of a target node when the data type is statistical data, wherein the statistical data is obtained based on state data; an acquisition submodule, used to acquire target node data based on statistical data and state data if the node data is empty, and store the target node data in the target node; a judgment submodule, used to acquire the collection frequency of each state ring if the node data is not empty, and determine whether the state data is the first data collected within a preset statistical period based on the collection frequency and timestamp; a third storage submodule, used to reset the target node if the state data is the first data collected within a preset statistical period, acquire the target node data based on statistical data and state data, and store the target node data in the target node; and an update submodule, used to update the node data based on the state data if the state data is not the first data collected within a preset statistical period. The second acquisition module is used to acquire status data query requests; The module is used to obtain a query result based on the state data query request, the second number of query strategies, and the state ring, wherein the query strategy is used to determine the state ring in which the query result is located; The obtaining module includes: a fourth determining unit, used to determine the query time period and query data type based on the state data query request; a fifth determining unit, used to determine the target query strategy based on the state data query request and a second number of query strategies, wherein determining the target query strategy based on the state data query request and the second number of query strategies includes: if multiple query strategies simultaneously meet the state data query request, the query strategy with the smallest corresponding state ring length is taken as the target query strategy; a sixth determining unit, used to determine the target state ring corresponding to the state data query request based on the target query strategy and the state ring; a query unit, used to query node data within the query time period based on the query time period and the target state ring; and an obtaining unit, used to adjust the node data according to the query data type to obtain the query result.

6. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the state data management method according to any one of claims 1 to 3 by executing the computer instructions.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the state data management method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Consistent hash-based hierarchical mixed storage system and method

    CN107844269A