State storage updating method, device, equipment and storage medium
By monitoring indicators such as data status, query frequency, and data peaks, and dynamically updating status storage, we solve the problems of memory waste and CPU consumption when the data volume is large, and improve data query efficiency and system response speed.
Patent Information
- Application Number
- CN202111301758.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-04
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-11-04
Smart Images

Figure CN114048228B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and more particularly to a method, apparatus, device, and storage medium for updating state storage. Background Art
[0002] In existing technologies, intermediate state data is stored in state storage. State data is typically timed to a certain extent. When the data reaches that time, a purge policy is used to clear it. When the data volume is large, parallelism is typically increased to increase memory space, or the state data validity period in memory is set to a very short time, and external storage is then used to store the data state.
[0003] However, storing data in the state regardless of whether it's used or completed, wastes memory and reduces data query efficiency. Furthermore, when data throughput is high, increasing parallelism increases CPU usage while storing large amounts of infrequently used data in memory, resulting in wasted resources. Furthermore, using external storage increases system response latency. Summary of the Invention
[0004] The embodiments of the present application provide a state storage update method, apparatus, device, and storage medium, which can comprehensively determine the storage status of data in the current State from multiple angles. When the State meets the update requirements, the State is updated in a manner corresponding to the judgment index in combination with the judgment index of the data and the data storage status of the State, so as to ensure the data processing efficiency of the State.
[0005] In a first aspect, an embodiment of the present application further provides a method for updating a state storage, the method comprising:
[0006] Obtaining a judgment indicator of data in the state storage State, the judgment indicator including at least one of data state, data query frequency, and data peak, wherein the data query frequency includes a query frequency of at least one data attribute of the data to be checked;
[0007] Determine whether the State meets the update requirements according to the judgment condition corresponding to the judgment indicator;
[0008] When the State meets the update requirement, the State is updated according to the update method corresponding to the judgment indicator.
[0009] In a second aspect, an embodiment of the present application further provides a state storage update device, the device comprising:
[0010] An acquisition module is configured to acquire a judgment indicator of data in the state storage State, wherein the judgment indicator includes at least one of data state, data query frequency, and data peak, wherein the data query frequency includes a query frequency of at least one data attribute of the data to be checked;
[0011] A judgment module, configured to judge the judgment index of the data according to the judgment condition corresponding to the judgment index, and determine whether the State meets the update requirement;
[0012] An updating module is used to update the State according to an updating method corresponding to the judgment indicator when the State meets the updating requirements.
[0013] In a third aspect, an embodiment of the present application further provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, a state storage update method as provided in any embodiment of the present application is implemented.
[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the state storage update method provided in any embodiment of the present application.
[0015] The embodiment of the present application provides a method, apparatus, device and storage medium for updating state storage, the method comprising: obtaining a judgment index of data in the state storage State, the judgment index including at least one of data state, data query frequency and data peak, the data query frequency including the query frequency of at least one data attribute of the data to be checked; determining whether the State meets the update requirements according to the judgment condition corresponding to the judgment index; and updating the State according to the update method corresponding to the judgment index when the State meets the update requirements. This solution determines the storage status of the data in the current State comprehensively from multiple angles by monitoring the three indicators of data state, data query frequency and data peak. When the State meets the update requirements, the State is updated in a manner corresponding to the judgment index in combination with the judgment index of the data and the data storage status of the State, so as to ensure the data processing efficiency of the State. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flowchart of a method for updating state storage in an embodiment of the present application;
[0017] Figure 2 Schematic diagram of a method for updating state storage implemented by the Flink execution engine in an embodiment of the present application;
[0018] Figure 3 Schematic diagram of the Flink execution engine in an embodiment of the present application performing state storage updates according to data status;
[0019] Figure 4 Schematic diagram of the Flink execution engine in an embodiment of the present application performing state storage updates according to data query frequency;
[0020] Figure 5 is a schematic diagram of a data peak in an embodiment of the present application;
[0021] Figure 6 1 is a schematic diagram of the structure of a state storage updating device in an embodiment of the present application;
[0022] Figure 7 It is a structural diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present application and are not intended to limit the present application. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions of the present application, not all of the structures.
[0024] Additionally, in the embodiments of this application, words such as "optionally" or "exemplarily" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "optionally" or "exemplarily" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "optionally" or "exemplarily" is intended to present the relevant concepts in a concrete manner.
[0025] To facilitate a clearer understanding of the solutions provided by the embodiments of the present application, the concepts that may be involved in the present application are explained here as follows:
[0026] Flink is an open-source stream processing framework developed by the Apache Software Foundation. Its core is a distributed streaming data flow engine written in Java and Scala. Flink executes arbitrary streaming data programs in a data-parallel and pipelined manner. Flink's pipeline runtime system can execute both batch and stream processing programs.
[0027] ETL: The full name in English is (Extract, Cleaning, Transform), which is the process of extracting, cleaning, transforming and loading the data of the business system into the data warehouse. The purpose is to integrate the scattered, disorganized and non-uniform data in the enterprise and provide an analytical basis for the decision-making of the enterprise. ETL is an important part of BI (Business Intelligence) projects.
[0028] Kafka is an open source stream processing platform developed by the Apache Software Foundation and written in Scala and Java. Kafka is a high-throughput distributed publish-subscribe messaging system that processes streams of data from all consumer actions on a website. This action (web browsing, searching, and other user behavior) is a key factor in many social functions on the modern web. This data is typically processed through log processing and log aggregation due to throughput requirements. For log data and offline analysis systems like Hadoop that require real-time processing, this is a viable solution. Kafka aims to unify online and offline message processing through Hadoop's parallel loading mechanism and to provide real-time messaging across clusters.
[0029] Figure 1 This is a flow chart of a state storage update method provided in an embodiment of the present application. This method can be applied to scenarios where various types of data to be queried are stored in the State, and can realize adaptive updating of the State according to the real-time storage status of the data, thereby ensuring data storage and query efficiency and improving resource utilization. Figure 1 As shown, the method may include but is not limited to the following steps:
[0030] S101. Obtain judgment indicators of data in State.
[0031] In the embodiment of the present application, the above-mentioned State is state storage, which is used to store data, for example, waybill data in the waybill scenario of an e-commerce platform. Exemplarily, the judgment index of the data may include at least one of the data state, data query frequency, and data peak. Further, in the embodiment of the present application, the data query frequency can be understood as the query frequency of at least one data attribute of the data to be checked. For example, in the e-commerce platform scenario, the data to be checked may include waybill data, and at least one attribute of the waybill data may include the delivery address, contact number, buyer's name, etc. Then, accordingly, the query frequency of the data attribute may include the address query frequency of the waybill data, the telephone query frequency of the waybill data, the name query frequency of the waybill data, etc. In the literature retrieval website scenario, the data to be checked may include literature data, and at least one attribute of the data may include the author's name, the subject to which it belongs, keywords, etc. Accordingly, the query frequency of the data attribute may include the author's name query frequency, the keyword query frequency, etc. of the literature data.
[0032] S102: Determine whether the State meets the update requirements based on the judgment condition corresponding to the judgment indicator.
[0033] Since the judgment indicators designed in the embodiments of the present application belong to different factors, the judgment conditions corresponding to different judgment indicators are also different. Therefore, when judging whether the State is updated, it is necessary to use the judgment conditions corresponding to each judgment indicator in the State to judge the corresponding judgment indicators respectively. For example, the judgment conditions of data status, the judgment conditions of data query frequency, and the judgment conditions of data peak are selected to judge the indicators such as data status, data query frequency, and data peak in the State respectively, and determine whether the State meets the update requirements based on the judgment results of different indicators. For example, if at least one judgment indicator in the State meets the judgment condition corresponding to the judgment indicator, then it can be determined that the State meets the update requirements, otherwise the State does not meet the update requirements.
[0034] S103: When the State meets the update requirements, update the State according to the update method corresponding to the judgment indicator.
[0035] When the State meets the update requirements, the State can be updated according to the update method corresponding to the judgment indicator. For example, the data stored in the State can be deleted, backed up, or updated, or the data storage capacity of the State can be updated.
[0036] An embodiment of the present application provides a method for updating state storage, the method comprising: obtaining a judgment index of data in the state storage State, the judgment index including at least one of data state, data query frequency, and data peak, the data query frequency including the query frequency of at least one data attribute of the data to be checked; determining whether State meets the update requirements based on the judgment condition corresponding to the judgment index; and updating State based on the update method corresponding to the judgment index when State meets the update requirements. This solution comprehensively determines the storage status of the data in the current State from multiple angles by monitoring the three indicators of data state, data query frequency, and data peak. When State meets the update requirements, the method corresponding to the judgment index is used to update State in combination with the judgment index of the data and the data storage status of State to ensure the data processing efficiency of State.
[0037] Optionally, the above state storage update process can be implemented in the Flink execution engine, such as Figure 2As shown in the figure, after the data stream reaches the Flink execution engine, it undergoes data processing through the ETL process and is stored in the State. A monitoring program monitors the data status and data query frequency in real time, and a listening program monitors data peaks. Furthermore, the data in the State can be synchronized to disk or a data warehouse. Alternatively, in specific cases, data can be queried from disk and returned to the State.
[0038] In an example, the implementation process of step S102 may include the following implementation methods:
[0039] If the judgment indicator includes data status, and the data status includes the initialization state and the update state, it is determined that the update requirements of the State are not met, and the data corresponding to the data status is updated to the State. If the data status includes the completion state, it is determined that the update requirements of the State are met.
[0040] For example, Figure 3 As shown, Flink acquires real-time consumption data from the Kafka message middleware. The order of data messages in Kafka is A (INIT), B (UPDATE1), (UPDATE2), and D (FINISH). The data is initialized in the INIT state, passes through two intermediate states (UPDATE1 and UPDATE2), and finally completes the data event (FINISH). The state attribute of each data item carries the data state of that data item. When data item A first arrives, since its state is in the initialization state, it is determined that the state update requirements have not been met. Data A is directly stored in the state and sent to the downstream message queue, allowing downstream users to see data changes in real time. When data items B and C arrive, since their state attributes are in the update state, the state update requirements have not been met. Data item A can be updated based on data items B and C. For example, the data storage time, the values of certain attributes, and newly added attributes can be updated, and the data items B and C are updated to the state. When data item D arrives, since its state is in the completion state, it is determined that the state update requirements have been met.
[0041] Accordingly, the method of updating State in step S103 according to the update method corresponding to the above-mentioned data status judgment indicator may include: merging the data corresponding to the data status with the data before the data to obtain integrated data, synchronizing the integrated data to other nodes for storage, for example, sending it to downstream nodes, and deleting the integrated data from State, or synchronizing it to a remote node for storage, which can reduce the storage space of State.
[0042] The above process is described in detail below with a specific example.
[0043] Data A includes {'id':'1','state':'INIT','name':'goods1','updatetime':'2020-08-01 00:00:00','addr':'beijing'};
[0044] Data B includes {'id':'1','state':'UPDATE1','name':'goods1','updatetime':'2020-08-01 00:20:00','phone':'1232932'};
[0045] C data includes {'id':'1','state':'UPDATE2','name':'goods1','updatetime':'2020-08-01 00:30:00','color':'red','period':'1year'};
[0046] Data D includes {'id':'1','state':'FINSH','name':'goods1','updatetime':'2020-08-01 00:40:00'}.
[0047] These data are sent sequentially. Data B updates the same values as in data A and adds new attributes, such as the phone attribute. After data B is processed, the saved data result is {'id':'1','state':'UPDATE2','name':'goods1','updatetime':'2020-08-01 00:20:00','phone':'1232932','addr':'beijing'}.
[0048] The C data is processed in the same way until the D data is processed. The final data obtained is {'id':'1','state':'FINSHI','name':'goods1','updatetime':'2020-08-01 00:20:00','phone':'1232932','addr':'beijing','period':'1year','color':'red'}.
[0049] Once data processing is complete and the data message has been sent (i.e., synchronized and stored to other nodes), the data contained in the message can be deleted from the State or synchronized to a remote node for storage. This not only reduces the pressure on data storage in the State, but also reduces the pressure on centralized processing of expired data.
[0050] In an example, the implementation process of step S102 may include the following implementation methods:
[0051] If the judgment index includes data query frequency, then the query frequency of at least one data attribute of the data to be checked can be obtained. For example, when the data to be checked is waybill data, the query frequency of the phone attribute and the query frequency of the addr attribute associated with the waybill data. Within the preset time, if the query times of all data attributes in at least one data attribute associated with the waybill data is greater than or equal to the disk write threshold, it means that the data corresponding to the data attribute is frequently written, and it is determined that the update requirements of the State have not been met at present, that is, the data continues to be stored in the State, and the State is not updated. On the contrary, within the preset time, if the query times of any data attribute in at least one data attribute is less than the disk write threshold, it means that the data write frequency corresponding to the data attribute is low, indicating that the update requirements of the State have been met.
[0052] like Figure 4 As shown, taking the data to be queried as waybill data as an example, assuming that data data1 is address attribute data, the address code is addr1, and the corresponding specific location is "Room 111, Unit 1, Building 6, No. 38, Jinghai Road, Tongzhou District, Beijing", data2 and data3 are waybill data {'package_id':'1','addr_code':'addr1','username':'zhangsan'}, then when querying data2 and data3, it is necessary to associate the address attribute data. After associating with the address code addr1, the waybill data obtained by the query is {'package_id':'1','addr_code':'addr1','username':'zhangsan','address':'Room 111, Unit 1, Building 6, No. 38, Jinghai Road, Tongzhou District, Beijing'}.
[0053] Accordingly, under this condition, the implementation process of updating State in step S103 according to the update method corresponding to the above-mentioned data query frequency judgment indicator may include: flushing the data to be queried to the disk, and deleting the data to be queried from the State, that is, determining whether the data is refreshed to the disk based on the query frequency of the attributes associated with the data to be queried. If the query frequency corresponding to all data attributes of the data to be queried stored in the State is very high and the flushing is frequent, the data to be queried can continue to be stored in the State. If the data attribute query frequency is low, the data to be queried can be refreshed to the disk, which can avoid delays caused by frequent reading and writing of the disk.
[0054] In an example, the implementation process of step S102 may include the following implementation methods:
[0055] If the judgment indicator includes a data peak, then the change trend of the data flow within the preset time length can be obtained; within the preset time length, if the change trend does not include a data peak, it is determined that the State update requirement has not been met; within the preset time length, if the change trend includes a data peak, and the data peak time is consistent with the historical data peak time, then it is determined that the State update requirement has been met. Figure 5 As shown, the data peak includes the data flow with an upward trend and a time length greater than the first ratio within a preset time length exceeding the maximum value of the data flow fluctuation range, and / or the data flow with a downward trend and a time length greater than the second ratio within a preset time length exceeding the maximum value of the data flow fluctuation range. The first ratio and the second ratio are respectively used to limit the time length of the data flow showing the above trend and the time length of the data flow showing a downward trend within the preset time length. Optionally, the first ratio and the second ratio can be the same or different. That is, if the data flow is within the preset data fluctuation range (such as Figure 5 If the data traffic fluctuates within the normal range (maximum and minimum values shown in the figure), then the current data traffic can be considered to be fluctuating within the normal fluctuation range, not a data peak, and no State update is required. Alternatively, if only a small portion of the data traffic fluctuation trend exceeds the maximum data traffic, but the duration of the excess does not meet the data peak requirement, then it can be considered that the current data traffic does not belong to a data peak and no State update is required. Conversely, if the data traffic fluctuation range is large and the fluctuation trend shows a data peak trend, then the current data traffic fluctuation is considered to have a data peak and a State update is required.
[0056] Alternatively, a monitoring program can be used to monitor the data processing process of the Flink execution engine to determine data peaks. For example, during normal program execution, if the monitoring program detects back pressure in Flink, it queries historical peak data flow or historical peak data time. If the current data flow during back pressure matches the historical peak data flow, or the current back pressure occurrence time matches the historical peak data time, it is determined that a data peak has occurred in the current data flow change trend.
[0057] Optionally, the setting time of the data peak may be queried. If the time when the current back pressure situation occurs matches the setting time of the data peak, it is determined that a data peak occurs in the current data volume change trend.
[0058] Backpressure can be understood as the slow processing speed of downstream nodes, which leads to congestion at upstream nodes. This means that data processing reaches a bottleneck, with the data generation rate exceeding the data processing rate. In existing technologies, when Flink backpressure occurs, downstream nodes feed back the data processing pressure to upstream nodes, causing them to slow down data production.
[0059] Optionally, the data peak time can also be determined by automatic notification, that is, the data peak arrival time is set in advance. If the scheduled time arrives, it is determined that a data peak will appear in the change trend of the data volume, and then it is determined that the State update requirement is met.
[0060] Accordingly, the implementation process of updating the State in step S103 based on the update method corresponding to the above-mentioned data peak judgment indicator may include: if the data peak includes an upward trend, obtaining the expansion capacity corresponding to the historical peak data flow and the growth ratio corresponding to the historical peak data flow, determining the predicted expansion capacity corresponding to the predicted peak data flow based on the expansion capacity and the growth ratio, and expanding the capacity of the current State based on the predicted expansion capacity. Optionally, since the expansion capacity and growth ratio corresponding to the historical peak data flow can also be determined simultaneously when obtaining the expansion capacity and growth ratio corresponding to the historical peak data flow, the predicted expansion capacity corresponding to the predicted peak data flow can also be determined based on the historical peak data flow and the corresponding growth ratio. For example, if data flow is on an upward trend and capacity expansion is required, if last year's historical peak data flow was 1000, the corresponding expansion capacity was 10 nodes, and the growth ratio of the historical peak data flow was 100%, then this year's predicted peak data flow is 2000, and the predicted expansion capacity corresponding to the predicted peak data flow is 20 nodes, then the capacity of the current State can be expanded by 20 nodes based on the determined predicted expansion capacity.
[0061] If the data flow in the data peak drops to within the data flow fluctuation range, that is, the data peak disappears, then the capacity of the expanded State is reduced to the capacity of the State before the expansion.
[0062] Optionally, if Flink backpressure is detected during a certain period, the state can be expanded proportionally. For example, if Flink backpressure occurs and data processing is slow, the state can be expanded by half until the backpressure disappears, at which point the expanded state capacity can be reduced to the original state capacity.
[0063] Figure 6 A schematic diagram of a state storage updating device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the device may include: an acquisition module 601, a judgment module 602, and an update module 603;
[0064] The acquisition module is used to obtain the judgment index of the data in State, the judgment index includes at least one of the data state, data query frequency, and data peak, and the data query frequency includes the query frequency of at least one data attribute of the data to be checked;
[0065] The judgment module is used to determine whether the State meets the update requirements based on the judgment conditions corresponding to the judgment indicators;
[0066] The update module is used to update the State according to the update method corresponding to the judgment indicator when the State meets the update requirements.
[0067] In one example, when the data state includes an initialization state and an update state, the judgment module is used to determine that the update requirement of the State is not met;
[0068] The update module is used to update the data corresponding to the data state into the State;
[0069] In the case that the data state includes a completion state, the judgment module is used to determine whether the update requirement of the State is met.
[0070] Optionally, an update module is used to merge data corresponding to the data state with data before the data to obtain integrated data;
[0071] Synchronize the integrated data to other nodes and delete the integrated data from the State.
[0072] In one example, the judgment module may further include an acquisition unit and a determination unit;
[0073] an acquiring unit, configured to acquire a query frequency of at least one data attribute of the data to be checked;
[0074] a determining unit, configured to determine that a State update requirement is not met when the number of queries for all data attributes in at least one data attribute is greater than or equal to a disk flush threshold within a preset time;
[0075] Furthermore, if the query times of any one of the at least one data attribute is less than the disk flush threshold within the preset time, it is determined that the State update requirement is met.
[0076] Optionally, the update module is used to write the data to be checked to the disk and delete the data to be checked from the State.
[0077] In one example, the judgment module includes an acquisition unit and a determination unit;
[0078] An acquisition unit, configured to acquire a change trend of data flow within a preset time period;
[0079] A determination unit, configured to determine that the State update requirement has not been met if the change trend does not include a data peak within a preset time period;
[0080] Furthermore, within a preset time period, if the change trend includes a data peak, and the data peak time is consistent with the historical data peak time, it is determined that the State update requirement is met;
[0081] Among them, the data peak includes the data flow with an upward trend and a time length greater than a first proportion within a preset time length exceeding the maximum value of the data flow fluctuation range, and / or the data flow with a downward trend and a time length greater than a second proportion within a preset time length exceeding the maximum value of the data flow fluctuation range.
[0082] Optionally, the update module may include an acquisition unit, a determination unit, and an update unit;
[0083] an acquisition unit, configured to acquire, when the data peak includes an upward trend, an expansion capacity and a growth ratio corresponding to the historical peak data flow;
[0084] A determination unit, configured to determine a predicted expansion capacity corresponding to the predicted peak data flow according to the expansion capacity and the growth ratio;
[0085] Update unit, used to expand the capacity of the current State according to the predicted expansion capacity;
[0086] Furthermore, when the data flow in the data peak drops to within the data flow fluctuation range, the capacity of the expanded State is reduced to the capacity of the State before the expansion.
[0087] The above-mentioned state storage updating means can execute Figure 1-Figure 5 The provided state storage updating method has corresponding devices and beneficial effects in the method.
[0088] Figure 7 A schematic diagram of the structure of a computer device provided in Example 7 of the present invention is shown as follows: Figure 7 As shown, the computer device includes a controller 701, a memory 702, an input device 703, and an output device 704; the number of controllers 701 in the computer device can be one or more. Figure 7 In the figure, a controller 701 is taken as an example; the controller 701, memory 702, input device 703 and output device 704 in the computer device can be connected by a bus or other means. Figure 7 The bus connection is taken as an example.
[0089] The memory 702 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and modules, such as Figure 1-Figure 5 The program instructions / modules corresponding to the state storage updating method in the embodiment (e.g., the acquisition module 601, the determination module 602, and the update module 603 in the state storage updating apparatus) are implemented by the controller 701 running the software programs, instructions, and modules stored in the memory 702 to perform various functions of the computer device and data processing, thereby implementing the above-mentioned state storage updating method.
[0090] The memory 702 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function; the data storage area may store data generated based on the use of the computer. Furthermore, the memory 702 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some instances, the memory 702 may further include memory remotely located relative to the controller 701, and these remote memories may be connected to a terminal / server via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0091] The input device 703 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the computer device. The output device 704 may include a display device such as a display screen.
[0092] The embodiment of the present application further provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a state storage updating method when executed by a computer controller, the method comprising: Figure 1 Steps shown.
[0093] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present application can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a computer's floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0094] It is worth noting that the modules included in the above-mentioned package sorting device are only divided according to functional logic, but are not limited to the above-mentioned division method. As long as the corresponding functions can be achieved, it is not used to limit the scope of protection of this application.
[0095] Note that the above are only preferred embodiments of the present application and the technical principles employed. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present application. The scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for updating state storage, characterized in that: include: Obtaining judgment indicators of data in the state storage State, wherein the judgment indicators include data state, data query frequency, and data peak, wherein the data query frequency includes the query frequency of at least one data attribute of the data to be checked; Determining whether the State meets the update requirement according to the judgment condition corresponding to the judgment indicator, wherein different judgment indicators correspond to different judgment conditions. If at least one judgment indicator in the State meets the judgment condition corresponding to the judgment indicator, then determining that the State meets the update requirement; When the State meets the update requirement, the State is updated according to the update method corresponding to the judgment indicator, wherein different judgment indicators correspond to different update methods.
2. The method according to claim 1, characterized in that In the case where the judgment indicator includes data state, determining whether the state meets the update requirement according to the judgment condition corresponding to the judgment indicator includes: In a case where the data state includes an initialization state and an update state, determining that an update requirement of the State is not met, and updating data corresponding to the data state into the State; In a case where the data state includes a completed state, it is determined that an update requirement of the State is met.
3. The method according to claim 1, characterized in that In the case where the judgment indicator includes a data query frequency, determining whether the State meets the update requirement according to the judgment condition corresponding to the judgment indicator includes: Obtaining a query frequency of at least one data attribute of the data to be queried; If the query times of all data attributes in the at least one data attribute are greater than or equal to the disk flush threshold within a preset time, determining that the update requirement of the State is not met; If the query times of any one of the at least one data attribute is less than the disk flush threshold within the preset time, it is determined that the update requirement of the State is met.
4. The method according to claim 1, wherein In the case where the judgment indicator includes a data peak, determining whether the State meets the update requirement according to the judgment condition corresponding to the judgment indicator includes: Obtain the changing trend of data traffic within a preset time period; If the change trend does not include a data peak within a preset time period, it is determined that the State update requirement has not been met; Within a preset time period, if the change trend includes a data peak, and the data peak time is consistent with the historical data peak time, it is determined that the State update requirement is met; Among them, the data peak includes the data flow whose changing trend is an upward trend and whose time length within the preset time length is greater than the first proportion exceeds the maximum value of the data flow fluctuation range, and / or the data flow whose changing trend is a downward trend and whose time length within the preset time length is greater than the second proportion exceeds the maximum value of the data flow fluctuation range.
5. The method according to claim 1 or 2, characterized in that Updating the State according to the update method corresponding to the judgment indicator includes: Merging the data corresponding to the data state with the data before the data to obtain integrated data; The integrated data is synchronized to other nodes for storage, and the integrated data is deleted from the State.
6. The method according to claim 1 or 3, characterized in that Updating the State according to the update method corresponding to the judgment indicator includes: The data to be checked is written to the disk, and the data to be checked is deleted from the State.
7. The method according to claim 1 or 4, characterized in that Updating the State according to the update method corresponding to the judgment indicator includes: When the data peak includes an upward trend, obtaining the expansion capacity and growth ratio corresponding to the historical peak data flow; Determining a predicted expansion capacity corresponding to the predicted peak data flow according to the expansion capacity and the growth ratio; Expand the capacity of the current State according to the predicted expansion capacity; When the data flow in the data peak drops to within the data flow fluctuation range, the capacity of the expanded State is reduced to the capacity of the State before the expansion.
8. A state storage updating device, characterized in that: include: An acquisition module is used to acquire judgment indicators of data in the state storage State, wherein the judgment indicators include data state, data query frequency and data peak, wherein the data query frequency includes the query frequency of at least one data attribute of the data to be checked; a judgment module, configured to determine whether the State meets the update requirement based on a judgment condition corresponding to the judgment indicator, wherein different judgment indicators correspond to different judgment conditions, and if at least one judgment indicator in the State satisfies the judgment condition corresponding to the judgment indicator, then it is determined that the State meets the update requirement; An updating module is used to update the State according to an updating method corresponding to the judgment indicator when the State meets the updating requirements, wherein different judgment indicators correspond to different updating methods.
9. A computer device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for updating the state storage according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for updating state storage according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Index statistics method, system and device and storage medium
CN110471944A