Adaptive data caching method and server

By adopting the adaptive aptive data caching method in the satellite communication system, dynamically adjusting the cache write priority and the number of dequeuing, the problem of linear growth in cache write time and number in the prior art is solved, and the efficiency and reliability of data cache is achieved.

CN119512474BActive Publication Date: 2025-04-04CHENGDU CORESAT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510100940.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-04-04
Estimated Expiration
2045-01-22

AI Technical Summary

Technical Problem

In satellite communication systems, when the number of user stations increases, the write time and number of cached data will increase linearly, resulting in increased network IO burden, which may degrade system performance or even crash, and it is difficult to dynamically and adaptively control the efficiency of cache writes.

Method used

Adaptive data caching method is adopted to obtain the write priority of the data to be cached, push the data into the priority queue, and predict future data writing trends based on historical write frequency records, dynamically adjust the maximum number of dequeuing and timeout time range until the amount of dequeuing data is greater than or equal to the average number of writes per batch, achieving the optimal efficiency of data writing.

Benefits of technology

Effectively control the write time and number of writes within a reasonable and efficient interval range, reduce the write time due to frequent network IO, and ensure the efficiency and reliability of data cache.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512474B_ABST
    Figure CN119512474B_ABST
Patent Text Reader

Abstract

The adaptive data caching method and server provided by the present invention include: obtaining the write priority of the data to be cached, and pushing the data to be cached into the priority queue based on the write priority; when taking out the data to be cached from the priority queue, predicting the future data writing trend according to the historical write frequency record, and dynamically adjusting the maximum dequeue number and timeout time range based on the future data writing trend, until the amount of dequeued data is greater than or equal to the average number of writes per batch; and executing data writing according to the dequeued data to be cached. The present invention predicts the future data writing trend by analyzing the historical write frequency record to dynamically adjust the maximum dequeue number and timeout time range, which can avoid the write waiting time being too long or too short, and at the same time can control the write time and the number of writes within a reasonable and efficient range, reducing the write time caused by frequent network IO.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of satellite communication technology, and in particular to an adaptive data caching method and a server. Background Art

[0002] At the gateway station side of the satellite communication system, in order to ensure automatic failover and seamless switching in the event of a failure, the system needs to be able to quickly load the latest data at the time of the failure after the failover to achieve a smooth transition of data and business processes. To this end, an efficient cache middleware is usually used to achieve shared storage of data, such as Redis. In addition, data cache middleware is also used to cache hot data in the database to reduce the pressure on the database and improve the response speed and throughput of the system. This data caching technology has been widely used in the Internet industry, and it is also indispensable in the field of satellite communications.

[0003] In satellite communication systems that support the MF-TDMA system, time slot resource scheduling is frequent (scheduling cycle is at the millisecond level, generally 50ms). When user time slot resources are allocated according to user and resource grouping within the scheduling cycle, a user will generate at least one user data update operation. In order to ensure the high availability of resource scheduling, the updated user data needs to be written into the cache middleware. The more users there are, the more cache writes there are within the scheduling cycle. In addition to the above time slot resource scheduling scenarios, there are many network element services on the gateway station side that use the cache middleware to implement shared data storage and hot spot data caching. There are many service network elements, the frequency of data updates varies, and timeliness requirements are high. If unified measures are not taken, performance bottlenecks will inevitably occur, which will have a significant impact on the cache middleware and network element services.

[0004] At present, with the existing data caching method, when the number of user stations increases, the write time and frequency of cached data will increase linearly, resulting in an increase in the network IO burden, which may cause system performance to decline or even crash. At the same time, the strong correlation between this growth and the number of user stations makes it difficult for the system to dynamically and adaptively control the efficiency of cache writes, and it is impossible to reasonably allocate CPU, network and memory resources. In addition, there is currently a lack of the ability to dynamically adjust the cache write priority based on data characteristics and write requirements. This is particularly obvious when facing high-frequency data writes, which may cause key data to fail to be written to the cache in time, affecting overall performance and stability. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide an adaptive data caching method and server, which can achieve optimal writing efficiency, avoid too long or too short writing waiting time, dynamically and adaptively control the writing time and the number of writing times within a reasonable and efficient range, reduce the writing time caused by frequent network IO, and ensure the efficiency and reliability of data caching. In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0006] In a first aspect, the present invention provides an adaptive data caching method, the method comprising: obtaining a write priority of data to be cached, and pushing the data to be cached into a priority queue based on the write priority; wherein the write priority represents the dequeue order of the data to be cached in the priority queue; when taking out the data to be cached from the priority queue, predicting future data writing trends based on historical write frequency records, and dynamically adjusting the maximum dequeue quantity and timeout range based on the future data writing trends until the amount of dequeued data is greater than or equal to the average write quantity per batch; wherein the historical write frequency records are used to maintain the write data volume corresponding to each data type in each batch of data and the total dequeue time of this batch of data; and executing data writing according to the dequeued data to be cached.

[0007] In a second aspect, the present invention provides a server having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the adaptive data caching method as described in any one of the aforementioned embodiments.

[0008] The adaptive data caching data and server provided by the embodiment of the present invention include: the server obtains the write priority of the data to be cached, and pushes the data to be cached into the priority queue based on the write priority, thereby ensuring that the data can be processed in order according to its importance; when the server takes out the data to be cached from the priority queue, it predicts the future data writing trend by analyzing the historical writing frequency records. This prediction capability enables the system to dynamically adjust the maximum dequeue number and timeout time range more intelligently. This dynamic adjustment mechanism can achieve optimal writing efficiency and avoid too long or too short writing waiting time. Finally, when the amount of dequeued data exceeds the average number of writes per batch, the data writing process is executed, thereby dynamically and adaptively controlling the writing time and the number of writes within a reasonable and efficient range, reducing the writing time caused by frequent network IO, and ensuring the efficiency and reliability of data caching.

[0009] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0011] Figure 1 A schematic flow chart of an adaptive data caching method provided by an embodiment of the present invention;

[0012] Figure 2 A schematic diagram of the overall process of calculating write priority and enqueuing provided by an embodiment of the present invention;

[0013] Figure 3 A schematic diagram of the overall process of fetching data from a priority queue provided by an embodiment of the present invention;

[0014] Figure 4 A schematic diagram of a data writing process provided by an embodiment of the present invention;

[0015] Figure 5 A functional module diagram of an adaptive data caching device provided by an embodiment of the present invention;

[0016] Figure 6 A structural block diagram of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0017] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0018] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0019] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0020] Currently, in a resource scheduling cycle, if all resource groups are evenly allocated to user stations, the time required for scheduling a resource group to write to the cache is approximately: number of user stations / number of resource groups Average time to write a piece of data. Due to the limited number of resource groups (limited satellite resources), the number of cache writes will increase with the number of user stations. If the number of user stations is 1000 and the number of resource groups is 5, the time required for one resource group to schedule a cache write is about 47.2ms; when the number of user stations is 10,000 and the number of resource groups is 10, the time required for one resource group to schedule a cache write is about 236ms. Similarly, in a resource scheduling cycle, the number of cache writes per second is at least: the number of user stations 1000 / scheduling period. When the scheduling period is fixed at 50ms and the number of user stations is 1000, the number of cache writes per second is at least 20,000 times; when the number of user stations is 10,000, the number of cache writes per second is at least 200,000 times.

[0021] The inventors have found through research that if the above processing method is used in a resource scheduling cycle, the cache write time and the number of cache writes in the scheduling cycle will increase linearly with the increase in the number of user stations, which will bring the following technical challenges to the system:

[0022] First, when the number of user stations increases to a certain extent, the cache write time is longer than the scheduling cycle, resulting in the inability to complete the scheduling within the scheduling cycle, causing system abnormalities, user disconnection, and inability to access. When the number of user stations is 1000 and the number of resource groups is 5, the cache write time reaches 47.2ms, which is close to the 50ms scheduling cycle. When the number of user stations is 1200 and the number of resource groups is 5, the cache write time reaches 56.64ms, which exceeds the 50ms scheduling cycle.

[0023] Secondly, the number of cache writes within the scheduling cycle will increase with the number of user stations. Too frequent writes will bring great concurrency impact to the cache middleware and even cause it to crash. When the scheduling cycle is 50ms and the number of user stations is 1,000, the number of cache writes per second is at least 20,000; when the number of user stations is 10,000, the number of cache writes per second is at least 200,000.

[0024] Furthermore, the cache write time and the number of cache writes in the scheduling period are strongly correlated with the number of user stations, and the time and the number of writes cannot be dynamically and adaptively controlled within a reasonable and efficient range.

[0025] Finally, when the number of user stations reaches a certain level and triggers large-scale, high-frequency data writing, it may cause some problems such as increased memory, large network IO usage, high CPU utilization, and frequent GC.

[0026] In addition, at the same time, not only the user cache data within the scheduling cycle is being written, but other types of data may also be written, such as resource group data, carrier resource data, scheduling window data, etc., and there are also data read and write operations being performed by other network element services. High-frequency and large-scale writing of resource scheduling cache data will occupy queues and CPU resources, causing other data to be unable to be written in time, reducing the timeliness of data writing.

[0027] In order to solve the technical problems brought about by the above-mentioned cache processing method, an adaptive data caching method provided in an embodiment of the present invention can self-learn and adaptively dynamically adjust the number of writes and waiting time for each cache according to the historical write frequency and the predicted number of writes that may occur at present, and finally write the data to the cache middleware in batches, thereby reducing the write time caused by frequent network IO, and realizing the writing of cached data with low latency, low network IO and high efficiency, and dynamically and adaptively controlling the time consumption and the number of writes within a reasonable and efficient range.

[0028] Before introducing the adaptive data caching method provided by the embodiment of the present invention, the properties of the cached data in the embodiment of the present invention and the “historical write frequency record” proposed in the embodiment of the present invention are first introduced.

[0029] In one embodiment of the present invention, a priority queue is also set to manage all cache data to be written into the cache middleware. These cached data include not only the key and the corresponding content, but also the following attributes:

[0030] 1.dataType: specifies the type of data.

[0031] 2. hashCode: The hash value of the key. This value can be used to ensure that cached data with the same key is processed by the same write thread, thereby achieving sequential writing. This helps maintain the eventual consistency of the data and prevent inconsistencies caused by data disorder.

[0032] 3.timestamp: The current timestamp in microseconds, indicating the timestamp when the cached data is updated.

[0033] 4.timelinessLevel: indicates the timeliness level of cached data. The larger the value, the higher the level. The specific level can be preset.

[0034] 5.frequencyLevel: indicates the write frequency level of cache data. The larger the value, the higher the level. The specific calculation method will be explained in detail in the following section.

[0035] 6.priority: indicates the write priority, which determines the order of cache data dequeue. This priority can be calculated based on the current timestamp, timeliness level and write frequency level. The specific calculation method and logic will be introduced in detail in the following content.

[0036] In one embodiment of the present invention, a record of historical write frequency is also established for different data types in each batch. For example, if a batch of cache data written contains three different data types, three historical write frequency records will be generated. The specific data structure of the historical write frequency record is as follows:

[0037] 1.dataType: identifies the type of data;

[0038] 2.timestamp: timestamp in microseconds, recording creation time and batch ID;

[0039] 3.dequeueDuration: indicates the total time it takes for the batch of cached data to be dequeued from the priority queue, referred to as the total dequeue time, in microseconds;

[0040] 4.dequeueNum: records the number of cached data in this batch that are dequeued from the priority queue, referred to as the dequeued data volume;

[0041] 5.writeDuration: records the total time taken to write the batch of data into the cache middleware, referred to as the total write time, in microseconds;

[0042] 6.writeNum: records the number of data written to the cache middleware in this batch, referred to as the written data volume or the total number of writes;

[0043] Through such structured records, the embodiment of the present invention can track and analyze the write performance of different data types in detail, and provide data support for optimizing the operation of the cache middleware.

[0044] Based on the data structure defined above, the process of the adaptive data caching method provided by the embodiment of the present invention will be described below in conjunction with relevant drawings.

[0045] See also Figure 1 , Figure 1 The schematic flow chart of the adaptive data caching method provided by the embodiment of the present invention is shown in FIG. 1 , wherein the execution subject of the method may be a server, such as a gateway station in a satellite communication network. Figure 1 As shown, the process is as follows:

[0046] S101: Obtaining the write priority of the data to be cached, and pushing the data to be cached into a priority queue based on the write priority; wherein the write priority represents the dequeue order of the data to be cached in the priority queue;

[0047] S102: When taking out the data to be cached from the priority queue, predict the data writing trend according to the historical writing frequency record, and dynamically adjust the maximum dequeue quantity and timeout range based on the data writing trend until the amount of dequeued data is greater than or equal to the average number of writes per batch;

[0048] S103: Execute data writing according to the dequeued data to be cached.

[0049] In the process of adaptive data caching provided by the embodiment of the present invention, first, the server obtains the write priority of the data to be cached, and pushes the data to be cached into the priority queue based on the write priority, thereby ensuring that the data can be processed in order according to its importance; when the server takes out the data to be cached from the priority queue, it predicts the future data writing trend by analyzing the historical write frequency records. This prediction capability enables the system to dynamically adjust the maximum dequeue number and timeout range more intelligently. This dynamic adjustment mechanism can achieve optimal writing efficiency and avoid long or short writing waiting time. Finally, when the amount of dequeued data exceeds the average number of writes per batch, the data writing process is executed, so that the writing time and the number of writes are dynamically and adaptively controlled within a reasonable and efficient range, thereby reducing the writing time caused by frequent network IO and ensuring the efficiency and reliability of data caching.

[0050] Next, the embodiments of the present invention will introduce the above steps in detail.

[0051] In step S101, an embodiment of the present invention provides a solution for pushing the data to be cached into a priority queue. The write priority represents the order in which the data to be cached is dequeued from the priority queue. The larger the priority value, the higher the write priority and the earlier the dequeuing order. Therefore, in an embodiment of the present invention, the method for obtaining the write priority of the data to be cached includes the following steps:

[0052] Step a1: obtaining the write frequency level of the data to be cached;

[0053] Step a2: Calculate the write priority based on the timeliness level set for the target data type corresponding to the data to be cached, the current timestamp, and the write frequency level.

[0054] In an embodiment of the present invention, the write frequency level reflects the frequency with which a specific data type is written within a certain period of time. The higher this frequency is, the more urgent the write demand for the data type is. Together with the timeliness level of the data and the current timestamp, it determines the write priority of the data to be cached. Data with a high timeliness level means that it has a higher requirement for real-time performance, while the current timestamp ensures that the latest data can obtain a higher priority. Therefore, when calculating the write priority, a higher write frequency level will increase the priority of the data, thereby speeding up its writing process. By combining these factors, the embodiment of the present invention can accurately obtain the write priority of the data and ensure that key data can be written in a timely manner.

[0055] In one embodiment of the present invention, the server can determine the write frequency level of the data to be cached based on the historical write frequency records corresponding to the data type of the data to be cached. If the data type has no historical write frequency level, it indicates that this data type has never been written before, and there is a write demand starting from this batch. If the data type has a corresponding historical write frequency record, then the write frequency level of the data to be cached corresponding to the data type can be determined based on the historical write situation. Therefore, the method of obtaining the write frequency level of the data to be cached in the embodiment of the present invention is as follows:

[0056] Step b1: Search for the historical write frequency records corresponding to the target data type within a preset period.

[0057] In the embodiment of the present invention, the preset period can be flexibly set. For example, as an example, the most recent 20 historical write frequency records can be searched.

[0058] Step b2: If it does not exist, confirm that the write frequency level of the data to be cached is the default value;

[0059] In the embodiment of the present invention, the default value is an empirical value, indicating a lower write frequency level. For example, as an example, the default value may be 2. That is, if no corresponding historical frequency record is found, it indicates that the data type has a write demand starting from this batch, but the write frequency of the data type is not yet known (more or less), so a lower default value is given initially, and the write frequency level is adjusted dynamically based on the actual write situation later.

[0060] Step b3: If it exists, the ratio of the total number of writes of other data types within the preset period to the write time of the target data type is used as the write frequency level weight;

[0061] Step b4: In the pre-divided write frequency level classification table, find the corresponding value of the write frequency level weight as the write frequency level of the data to be cached.

[0062] In the embodiment of the present invention, if the historical write frequency record is found, the write frequency wf and the ratio p of the total number of writes corresponding to other data types in the period to the total number of writes of the data type are calculated first, and then the write frequency level weight is calculated according to the write frequency wf and the ratio p, and then the write frequency level is divided according to the write frequency level weight. Therefore, the frequency level weight calculation method is as follows.

[0063] (1)

[0064] (2)

[0065] in, The total amount of data written for the target data type within the preset period; The writing time of the target data type within the preset period (in ms). To calculate the total number of other data types written in the preset period, this information can be obtained from the historical write frequency records corresponding to the target data type, which will not be repeated here. Further, by substituting formula (1) into formula (2), we can obtain:

[0066] (3)

[0067] Among them, w is the write frequency level weight (in times / ms). Under the condition of unchanged The larger is the w, the larger is the w. Under the condition of unchanged The larger w is, the smaller w is. The write frequency level can be obtained according to the write frequency level classification table provided by the embodiment of the present invention, wherein the write frequency level classification table is shown in Table 1.

[0068] Table 1

[0069]

[0070] In Table 1, each weight range corresponds to a write frequency level. After the embodiment of the present invention calculates a write frequency level weight through step b3, it can be matched in Table 1 to find out which weight range the write frequency level weight falls within, and then read the write frequency level corresponding to the weight range. Based on this write frequency level, step a2 can be continued.

[0071] In step a2, the embodiment of the present invention calculates the write priority according to the write priority algorithm based on the current microsecond timestamp, the preset timelinessLevel of the target data type, and the write frequency level. The priority algorithm formula is as follows:

[0072] priority=timestamp-adaptivePriority(4)

[0073] in:

[0074] adaptivePriority=timelinessLevel 100+frequencyLevel 150(5)

[0075] As mentioned above, timelinessLevel is the preset timeliness level. When the data type is determined, the value is also determined immediately. Its value range is: [-10, 10]. Therefore, the value range of adaptivePriority is: [-1000, 2200], which is converted into milliseconds: [-1ms, 2.2ms]. In other words, the cached data will be taken out of the priority queue and written to the cache middleware at the slowest 3.2ms after the current time, and will be written to the cache middleware at the fastest.

[0076] The data to be cached are constructed using the write priority, data type and other attributes obtained through the above implementation, and are pushed into a priority queue to wait for being written into the cache middleware.

[0077] To understand the process of obtaining write priority and entering the queue, see Figure 2 , Figure 2A schematic diagram of the overall process of calculating write priority and enqueuing provided for an embodiment of the present invention. First, the server checks whether there is a historical write frequency record of the data type corresponding to a certain cached data. If no historical record is found ("No historical write frequency record found"), the frequency level is set to the default value. If the historical record is found ("No historical write frequency record found"), the write frequency of the data type and the ratio of the number of writes of other data types to the data type in the cycle are calculated, and then the write frequency level weight is calculated based on the write frequency and the ratio, and the corresponding write frequency level is found in the write frequency level classification table based on the write frequency level weight. Finally, based on the current timestamp, the preset timeliness level of the data type, and the write frequency level, the write priority of the cached data is calculated according to the priority algorithm, the write priority and the data type are used as attributes to construct the cached data, and the cached data is pushed into the priority queue according to the write priority.

[0078] Next, the embodiment of the present invention will introduce the process of dequeuing the data to be cached from the priority queue, that is, step S102.

[0079] In step S102, when the data to be cached is taken out from the priority queue, the data writing trend is predicted according to the historical writing frequency records, and the maximum dequeue quantity and timeout range are dynamically adjusted based on the data writing trend until the amount of dequeued data is greater than or equal to the average write quantity per batch.

[0080] In an embodiment of the present invention, when the server takes out the data to be cached from the priority queue, it can first take out one piece of data to be cached. If the data is not taken out, it will block and wait until the data is taken out. The motivation for this implementation is to determine whether the data can be obtained. If the data can be obtained, subsequent actions will be executed. If even one piece of data cannot be taken out, it will block and wait until the data is available.

[0081] If the server can obtain data, it can be used to obtain data in batches as follows:

[0082] Step c1: within the timeout period, batch retrieve the cached data according to the maximum dequeue quantity.

[0083] In the embodiment of the present invention, the timeout range can be set to the minimum time consumption of batch dequeueing of the queue, such as 0.1ms. The maximum dequeue number is also a preset value, such as 2500, that is, 2500 data are taken in each batch. Among them, the timeout range and the maximum dequeue data can be flexibly set by the administrator according to actual needs, and are not limited here.

[0084] In the actual implementation of step c1, the preset minimum batch dequeueing time (such as 0.1ms) is used as the timeout time, and an attempt is made to batch retrieve the cached data with a maximum number of "maximum dequeueing number" (such as 2500) from the priority queue. Within the timeout time range, if the cached data with the "maximum dequeueing number" is retrieved in advance, the process directly proceeds to step c2; if the cached data with the "maximum dequeueing number" is not retrieved within the timeout time range, the process waits until the timeout, and retrieves as many as possible.

[0085] For example, if there is a large amount of data to be cached in the priority queue, and 2500 data items are retrieved in 0.001ms (less than 0.1ms), then step c2 can be directly performed. If there is less data in the priority queue, and only 200 data items are retrieved in 0.1ms, then step c2 is also performed (but the wait time is 0.1ms).

[0086] Step c2: if the amount of dequeued data is greater than or equal to the average number of writes per batch, execute the step of writing data according to the dequeued data to be cached, otherwise, obtain the last recorded preset historical write frequency record;

[0087] As can be seen from the previous text, there are two situations for the amount of data that has been dequeued within the timeout period, either the maximum dequeued amount or less than the maximum dequeued amount. Therefore, step c2 needs to first determine whether the amount of data that has been dequeued is less than the average number of data written per batch.

[0088] In the embodiment of the present invention, the average number of writes per batch is a preset value in the embodiment of the present invention, and is an indicator for measuring how many records are written to the cache middleware for best performance each time. For example, writing to Redis may be best when writing 600 records per batch. Therefore, as an example, the average number of writes per batch may be 600, and the user can flexibly set it according to the performance of the cache middleware, which is not limited here.

[0089] In the embodiment of the present invention, if the amount of dequeued data is greater than or equal to the average number of writes per batch, the write process shown in step 103 is directly performed. If it is less than the average number of writes per batch, it is necessary to adjust the timeout range and the maximum number of dequeues, and fetch data from the priority queue again. The embodiment of the present invention uses the historical frequency to refer to and predict the number of write data that may appear, and adaptively and dynamically adjusts and learns to approach the optimal efficiency, so as to avoid too long or too short write waiting time.

[0090] For example, in step c1, only 200 data items are retrieved in 0.1ms, but the average number of dequeues in the historical frequency is 400, and the average queue retrieval time in the historical frequency is 0.2ms. Then, the batch expects to retrieve 400 data items within 0.2ms. If 400 items are not retrieved within 0.2ms, then the number of items that can be retrieved is kept as many as possible.

[0091] Step c3: determining the average write quantity and the average queue retrieval time based on the preset historical write frequency record, and obtaining the dequeued data and the dequeued time corresponding to the dequeued data;

[0092] In the embodiment of the present invention, the average write quantity and the average queue retrieval time can be determined based on a plurality of recently recorded historical write frequency records, thereby achieving the effect of predicting future data write trends.

[0093] As described above, each historical write frequency record records the amount of written data and the total time consumed for dequeuing. Therefore, the embodiment of the present invention can predict the amount of written data and the time consumed for dequeuing that may occur. The specific process is:

[0094] Step 1: Determine the sum of the amount of data written and the sum of the total time taken to dequeue in each historical write frequency record;

[0095] Step 2: Take the ratio of the sum of the written data volume and the sum of the total queue removal time to the number of historical write frequency records as the average write quantity and average queue removal time.

[0096] At the same time, the embodiment of the present invention can also obtain the dequeue time according to the dequeue end time and the dequeue start time, and determine the amount of data taken out according to the amount of data taken out in step c1 and the number of entries tentatively taken out before step c1.

[0097] Based on the average number of writes that may occur in the future, the average queue retrieval time, the retrieval time of the dequeued data to be cached, and the amount of data that has been retrieved, the timeout range and the maximum dequeue number are dynamically adjusted.

[0098] Step c3: Take the minimum value of the difference between the average number of writes and the maximum number of dequeues and the number of dequeues that have been dequeued as the new maximum number of dequeues, and take the minimum value of the difference between the average queue extraction time and the preset maximum dequeue time and the time of dequeues that have been dequeued as the new timeout range;

[0099] Step c4: Based on the new timeout range and the maximum dequeue quantity, return to the step of taking out the cached data in batches according to the maximum dequeue quantity within the timeout range, until the amount of dequeued data is greater than or equal to the average number of writes per batch.

[0100] That is to say, the embodiment of the present invention uses "MIN((average queue retrieval time - queue retrieval time), (maximum queue retrieval time - queue retrieval time))" as the new timeout period, and "MIN((average write number - retrieved data volume), (maximum queue retrieval number - retrieved data volume))" as the new maximum queue retrieval number, and tries to retrieve data in batches from the priority queue again until the average write number per batch is exceeded.

[0101] To understand the above process of dequeuing data to be cached, please refer to Figure 3 , Figure 3 A schematic diagram of the overall process of fetching data from a priority queue provided by an embodiment of the present invention. The server first fetches one data to be cached from the priority queue. If the data is not fetched, it will block and wait until it is fetched. Then, within the timeout range (such as 0.1ms), the cached data is batch-fetched from the priority queue according to the maximum dequeue quantity (such as 2500) until timeout, and the number of data fetched is considered as the number of data. That is to say, within the timeout range, if the number of cached data equal to the "maximum dequeue quantity" is fetched in advance, the data retrieval is terminated; if the number of cached data equal to the "maximum dequeue quantity" is not fetched within the timeout range, it will wait until timeout (how much can be taken out is considered as much). After the timeout, determine whether the amount of dequeued data is greater than or equal to the average number of writes per batch (such as 600). If it exceeds, the subsequent data writing process can be executed; if it does not exceed, the average write quantity and average queue retrieval time are calculated according to the historical write frequency records of the last few times (such as 8 times), and the amount of data retrieved and the time taken to dequeue are obtained. "MIN((average queue retrieval time - dequeue time), (maximum dequeue time - dequeue time))" is used as the new timeout range, and "MIN((average write quantity - dequeue amount of data), (maximum dequeue quantity - dequeue amount of data))" is used as the new maximum dequeue quantity, and then the retrieval number is returned.

[0102] Based on the to-be-cached data taken out in batches from the priority queue, executing step S103 provided by the embodiment of the present invention may include the following steps:

[0103] Step d1: pre-process the dequeued data to be cached to obtain the data to be written into the cache.

[0104] In an embodiment of the present invention, cleaning, filtering and verification can be performed in sequence to ensure that there is only one write operation for a piece of data in the same batch to reduce the size of the network data packet; ensure that when writing data, the data is still in the memory (first-level cache) and is not deleted. If the data no longer exists in the memory (first-level cache), the data will not be written to the cache middleware, thereby obtaining the cache data to be written.

[0105] Step d2: determine whether the amount of cache data to be written exceeds the maximum write amount per batch;

[0106] Step d3: If it does not exceed, the same writing thread writes the cache data to be written to the cache middleware; otherwise, multiple writing threads are allocated to write the cache data to be written to the cache middleware.

[0107] In the embodiment of the present invention, the maximum write quantity of each batch can be flexibly set according to actual needs, for example, set to 1500, which is not limited here.

[0108] If the cache data to be written does not exceed the maximum write quantity per batch, the cache data to be written can be written to the cache middleware using the same write thread. In the specific implementation process, the cache data to be written can be serialized first, and then written to the cache middleware in the form of synchronous batches in the current thread and in one network request. For example, if the cache middleware is Redis, the Pipeline technology can be used.

[0109] It should be noted that the serialization speed and the size of the serialized data will greatly affect the overall writing time and the size of the network data packet. After testing, among several commonly used serialization methods such as JackJson, FastJson, and Protostuff, Protostuff performs best, with a fast serialization speed (about 5 times faster than FastsJson) and small serialized data.

[0110] If the cache data to be written exceeds the maximum write quantity per batch, multiple write threads are allocated to write the cache data to be written to the cache middleware, which can be performed as follows:

[0111] Step e1: determining the total number of write threads, and determining the binding relationship between each cache data to be written and the write thread;

[0112] Step e2: grouping all cache data to be written according to the thread index of the writing thread to obtain a writing thread queue corresponding to each writing thread;

[0113] Step e3: Each writing thread writes the cache data to be written in the writing thread queue in batches to the cache middleware in a synchronous manner.

[0114] In the embodiment of the present invention, the total number of write threads is the ratio of the number of cache data to be written to the average number of writes per batch, and the cache data to be written is written to the cache middleware in the form of asynchronous batches. The specific process is as follows.

[0115] First, determine the binding relationship between the write thread and each cached data to be written. This can be understood as: you can query whether the data has a binding relationship with the write thread index based on the hashCode of each cached data; if there is no binding relationship, then get the write thread index according to "hashCode % total number of write threads", where "%" is the modulus operator, which means that the remainder obtained after dividing the hash code by the total number of threads is used as the index of the write thread. If there is a binding relationship, then use the thread index. The reason for doing this is to ensure that the data of the same key is still handed over to the same write thread when the last write is not completed, so as to achieve the purpose of final consistency of the written data.

[0116] Secondly, the binding relationship between each cache data to be written and the writing thread is recorded, and then the cache data to be written are grouped according to the thread index, and the cache data to be written are pushed into the corresponding writing thread queue according to the grouping.

[0117] Finally, each writing thread serializes the data to be written in the writing thread queue, and then writes it to the cache middleware in a synchronous batch in one network request.

[0118] In one embodiment of the present invention, after each writing thread writes the cache data to be written that it is responsible for into the cache middleware, it can also release the binding relationship between the cache data to be written and the writing thread.

[0119] In one embodiment of the present invention, before executing step d1, the type of data type corresponding to the cached data to be dequeued in the same batch can be determined; a historical write frequency record can be created for each data type; the number of cached data corresponding to each of the data types in the same batch and the total dequeuing time can be written into the historical write frequency record corresponding to the data type for use in the next stage of adaptive data caching.

[0120] For example, the cached data retrieved from the same batch are classified according to data type, and then historical write frequency records of the corresponding type and quantity are created. If there are three data types of data to be written in the same batch, such as user data, order data, and location data, then three historical write frequency records will be created.

[0121] Similarly, after executing the write operation, the embodiment of the present invention may also record the total write time and the write quantity of the cache data to be written corresponding to each data type in the historical write frequency record corresponding to the data type.

[0122] In one embodiment of the present invention, before creating the historical write frequency record, it is also possible to determine whether the historical write batch data exceeds a preset threshold. If so, the expired data should be cleared first to ensure the rational use of memory resources.

[0123] For an overall understanding of the above writing process, see Figure 4 , Figure 4 A schematic diagram of the data writing process provided by the embodiment of the present invention. In order to intuitively understand the beneficial effects of the adaptive data caching data provided by the embodiment of the present invention, Redis is used as the cache middleware, and Java is used as the development language to develop an adaptive data caching program, and the program is installed and deployed on a server configured as "8G memory + 8-core CPU + 100G disk", and Redis is installed and deployed on a server configured as "8G memory + 8-core CPU + 100G disk". The two servers are in the same Gigabit LAN, and the preset parameters in the method are configured according to Table 2, with 50ms as the cycle and 1us as the cache data update interval, and the number of data written, the type of data written, and the proportion of the type of data written in the cycle are adjusted to obtain the test results of Table 3.

[0124] Table 2

[0125]

[0126] Table 3

[0127]

[0128] According to the test results, the following test conclusions can be obtained from the embodiments of the present invention:

[0129] 1. When the data write frequency is less than or equal to 11,000 times / 50ms (that is, 22w / s), the overall write time can be well controlled within 1843us (1.843ms), which can meet the vast majority of data caching scenarios. The write frequency of 22w / s is already a very high concurrency.

[0130] 2. When the write frequency increases from 1 time / 50ms to 100 times / 50ms, the average total time and the time consumed to write to Redis remain in a relatively low range. There is no significant increase or decrease in time consumption with the increase in write frequency, and the average total time consumption is controlled within 643us.

[0131] 3. When the write frequency increases to the range of [200 times / 50ms, 600 times / 50ms], the average time consumed for writing to Redis does not fluctuate significantly, and the overall time consumed is around 326us to 366us. However, since the write frequency is still not too high, the time consumed for dequeuing cached data is slightly longer, and the average total time consumed is around 839us to 937us.

[0132] 4. As the write frequency increases, when the write frequency increases from 600 times / ms to 5000 times / ms, the time required to dequeue cached data decreases, and the time required to write to Redis increases slowly with the increase in the number of data written per record (the overall growth rate is not large and tends to be stable). The average total time consumption slowly decreases from 864us, and the overall time consumption is controlled around 800us.

[0133] 5. When the write frequency increases from 5000 times / ms to 11000 times / ms, with the increase in write frequency and the intensification of resource competition, the average time and average total time of writing to Redis both increase significantly, but the average total time is still controlled within 1843us (1.843ms).

[0134] 6. When the write frequency increases from 11,000 times / ms to 15,000 times / ms, resource competition becomes more frequent. When the write frequency reaches 15,000 times / 50ms, the average total time consumption reaches 2465us.

[0135] In addition, since the embodiment of the present invention adopts a batch writing method, the number of network interactions with the cache middleware is greatly reduced. When the writing frequency is 10,000 times / 50ms, the number of Redis operations is reduced from the original 10,000 times / 50ms to "10,000 / 420≈24" times / 50ms. In the 50ms period of time slot resource scheduling, if there are 10,000 user stations, the overall writing time is much less than the scheduling period of 50ms, and the number of cache writes per second can be reduced from at least 200,000 times in principle to at least 480 times, which greatly reduces network IO and reduces network traffic.

[0136] In summary, the adaptive data caching method provided by the embodiment of the present invention has the following advantages:

[0137] First, the embodiment of the present invention adopts a dynamic learning method to adaptively and dynamically adjust the number of cached data and the waiting time for each dequeue from the cache priority queue, so as to avoid the cache dequeue waiting time for too long, avoid too many or too few cached data dequeues, dynamically balance the number of dequeues and the time for dequeues, and the cache write time and the number of cache writes will no longer be strongly associated due to some factors, and the time and the number of writes can be dynamically and adaptively controlled within a reasonable and efficient range. When the data write frequency is less than or equal to 5000 times / 50ms (that is, 10w / s), the overall time consumption is controlled at about 1ms, which is not much different from the write frequency of 1 time / 50ms, and it is truly efficient and adaptive; when the data write frequency is less than or equal to 11000 times / 50ms (that is, 22w / s), the overall write time consumption can be well controlled within 1843us (1.843ms), which can meet the absolute majority of data cache scenarios.

[0138] Secondly, the embodiment of the present invention writes data into the cache middleware in batches, which can significantly reduce the number of network interactions with the cache middleware, network IO, and traffic, and improve the efficiency of cache data writing.

[0139] In addition, the embodiment of the present invention adopts a frequency level and priority calculation method to predict and dynamically adjust the priority of cache data writing according to the type of written data, writing frequency, and timeliness, so that the timeliness of cache data writing can be guaranteed regardless of the data update frequency. This can effectively avoid the problem that cache data cannot be written in time according to timeliness requirements when the writing of certain high-frequency data causes queue and CPU preemption.

[0140] In order to execute the corresponding steps in the above embodiments and various possible methods, an implementation method of the adaptive data cache device 30 is given below. Figure 5 , Figure 5 Functional module diagram of the adaptive data caching device provided in the embodiment of the present invention. It should be noted that the basic principle and technical effect of the adaptive data caching device 30 provided in this embodiment are the same as those of the above-mentioned embodiment. For the sake of brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above-mentioned embodiment. The adaptive data caching device 30 includes: a data enqueue module 301, a data dequeue module 302 and a data write module 303.

[0141] The data enqueue module 301 is used to obtain the write priority of the data to be cached, and push the data to be cached into the priority queue based on the write priority; wherein the write priority represents the dequeue order of the data to be cached in the priority queue;

[0142] The data dequeue module 302 is used to predict the future data writing trend according to the historical writing frequency record when taking out the to-be-cached data from the priority queue, and dynamically adjust the maximum dequeue quantity and timeout range based on the future data writing trend until the amount of dequeued data is greater than or equal to the average number of writes per batch;

[0143] The historical write frequency record is used to maintain the amount of written data corresponding to each data type in each batch of data and the total time consumed to dequeue the data in this batch;

[0144] The data writing module 303 is used to execute data writing according to the dequeued data to be cached.

[0145] It is understandable that the data entry module 301, the data exit module 302 and the data writing module 303 can be executed in coordination. Figure 1 Each step in the process is performed to achieve the corresponding technical effect.

[0146] In an optional implementation, the data enqueue module 301, the data dequeue module 302 and the data write module 303 are each further used to execute the relevant steps in the above embodiments, which will not be described in detail here.

[0147] It should be noted that the division of modules in the above embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0148] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a server (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program executable code.

[0149] The embodiment of the present invention further provides a server 40, see Figure 6 , Figure 6 The structural block diagram of the server provided in the embodiment of the present invention, the server 40 includes: a memory 401, a processor 402, and a communication interface 403. The memory 401, the processor 402, and the communication interface 403 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0150] Optionally, the bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0151] In the embodiment of the present invention, the processor 402 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The software module may be located in the memory 401, and the processor 402 reads the program instructions in the memory 401 and completes the steps of the above method in combination with its hardware.

[0152] In the embodiment of the present invention, the memory 401 may be a non-volatile memory, such as a hard disk (HDD) or a solid-state drive (SSD), etc., or a volatile memory (Volatile Memory), such as RAM. The memory may also be any other medium that can be used to carry or store the desired program executable code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present invention may also be a circuit or any other device that can realize a storage function, for storing instructions and / or data.

[0153] The memory 401 can be used to store software programs and modules, such as the instructions / modules of the adaptive data cache device 30 provided in the embodiment of the present invention, which can be stored in the memory 401 in the form of software or firmware (Firmware) or fixed in the operating system (OS) of the server 40. The processor 402 executes various functional applications and data processing by executing the software programs and modules stored in the memory 401. The communication interface 403 can be used to communicate signaling or data with other node devices.

[0154] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0155] Understandably, Figure 6 The structure shown is for illustration only. The server 40 may also include Figure 6 More or fewer components as shown, or with Figure 6 Different configurations are shown. Figure 6 The components shown may be implemented in hardware, software or a combination thereof.

[0156] The server 40 may also include, but is not limited to, a single server, a server group consisting of multiple servers, or a cloud consisting of a large number of hosts or servers based on cloud computing.

[0157] Based on the above embodiments, the present application further provides a storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the adaptive data caching method provided in the above embodiments.

[0158] Based on the above embodiments, an embodiment of the present invention further provides a computer program. When the computer program is executed on a computer, the computer executes the adaptive data caching method provided by the above embodiments.

[0159] Based on the above embodiments, an embodiment of the present invention further provides a chip, which is used to read a computer program stored in a memory and to execute the adaptive data caching method provided in the above embodiments.

[0160] An embodiment of the present invention further provides a computer program product, comprising instructions, which, when executed on a computer, enables the computer to execute the adaptive data caching method provided in the above embodiment.

[0161] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0164] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. An adaptive data caching method, characterized in that: The method comprises: Obtaining a write priority of the data to be cached, and pushing the data to be cached into a priority queue based on the write priority; wherein the write priority represents a dequeue order of the data to be cached in the priority queue; When the data to be cached is taken out from the priority queue, the future data writing trend is predicted according to the historical writing frequency record, and the maximum dequeue quantity and timeout range are dynamically adjusted based on the future data writing trend until the amount of dequeued data is greater than or equal to the average write quantity per batch; wherein the historical writing frequency record is used to maintain the amount of written data corresponding to each data type in each batch of data and the total dequeue time of the data in this batch; predicting the future data writing trend according to the historical writing frequency record, and dynamically adjusting the maximum dequeue quantity and timeout range based on the future data writing trend, including: determining the average write quantity and the average queue retrieval time based on a preset historical writing frequency record, and obtaining the retrieved data quantity and the dequeued time; taking the minimum value of the difference between the average write quantity and the maximum dequeue quantity and the retrieved data quantity as the new maximum dequeue quantity, and taking the minimum value of the difference between the average queue retrieval time and the preset maximum dequeue time and the dequeued time as the new timeout range; Execute data writing based on the dequeued data to be cached.

2. The adaptive data caching method according to claim 1, characterized in that: Get the write priority of the data to be cached, including: Obtaining a write frequency level of the data to be cached; The write priority is calculated based on the timeliness level set for the target data type corresponding to the data to be cached, the current timestamp, and the write frequency level.

3. The adaptive data caching method according to claim 2, characterized in that: Obtaining the write priority of the data to be cached also includes: Searching for historical write frequency records corresponding to the target data type within a preset period; If it does not exist, the write frequency level of the data to be cached is set to a default value; otherwise, the ratio of the total number of writes of other data types within the preset period to the write time of the target data type is used as the write frequency level weight; In the pre-divided write frequency level classification table, find out the corresponding value of the write frequency level weight as the write frequency level of the data to be cached.

4. The adaptive data caching method according to claim 1, characterized in that: When the data to be cached is taken out from the priority queue, the future data writing trend is predicted according to the historical writing frequency record, and the maximum dequeue quantity and timeout range are dynamically adjusted based on the future data writing trend until the amount of dequeued data is greater than or equal to the average number of writes per batch, including: Within the timeout period, batch-fetch the data to be cached according to the maximum dequeue quantity; If the amount of dequeued data is greater than or equal to the average number of writes per batch, execute the step of writing data according to the dequeued data to be cached, otherwise, obtain the last recorded preset historical write frequency record; Based on the new timeout range and the maximum dequeue quantity, return to the step of taking out the data to be cached in batches according to the maximum dequeue quantity within the timeout range until the amount of dequeued data is greater than or equal to the average number of writes per batch.

5. The adaptive data caching method according to claim 1, characterized in that: Determining the average write quantity and the average queue retrieval time based on the preset historical write frequency record includes: Determine the sum of the amount of data written and the sum of the total time taken to dequeue in each historical write frequency record; The ratio of the sum of the written data volume and the sum of the total queue removal time to the number of historical write frequency records is respectively used as the average write quantity and the average queue removal time.

6. The adaptive data caching method according to claim 1, characterized in that: According to the dequeued data to be cached, data writing is performed, including: Preprocess the dequeued data to be cached to obtain the cached data to be written; Determine whether the amount of cache data to be written exceeds the maximum write amount per batch; If it exceeds, the same write thread writes the cache data to be written to the cache middleware; otherwise, multiple write threads are allocated to write the cache data to the cache middleware.

7. The adaptive data caching method according to claim 6, characterized in that: Allocating multiple write threads to write the write cache data to the cache middleware includes: Determine the total number of write threads and determine the binding relationship between each cache data to be written and the write thread; Group all cache data to be written according to the thread index of the writing thread, and obtain the writing thread queue corresponding to each writing thread; Each of the writing threads writes the cache data to be written in the writing thread queue in batches into the cache middleware in a synchronous manner.

8. The adaptive data caching method according to claim 6, characterized in that: According to the dequeued data to be cached, data writing is performed, which also includes: After obtaining the dequeued data to be cached, determine the data type type corresponding to the dequeued data to be cached in the same batch; Create historical write frequency records for each data type; The number of to-be-cached data and the total time consumed for dequeuing corresponding to each data type in the same batch are written into the historical write frequency record corresponding to the data type.

9. The adaptive data caching method according to claim 8, characterized in that: According to the dequeued data to be cached, data writing is performed, which also includes: After the write operation is performed, the total write time and the write quantity of the cache data to be written corresponding to each data type are recorded in the historical write frequency record corresponding to the data type.

10. A server having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the adaptive data caching method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Method and device for dequeuing data

    CN101594302A

  • Data caching method and device, server and storage medium

    CN108491450A