A method for dynamic adjustment of adaptive cache

By monitoring the switch operating status and port traffic information and dynamically adjusting the cache strategy, the problem that traditional switch cache management strategies cannot adapt to system changes is solved, and cache efficiency and resource utilization are improved.

CN118890328BActive Publication Date: 2025-09-09INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411139428.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-09-09
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

Traditional switch cache management strategies cannot adapt to changes in system load and data access patterns, resulting in inefficient cache and resource waste.

Method used

By monitoring the operating status of the switch and port traffic information, it calculates load data and cache usage information in real time, compares them with preset benchmarks, generates adaptive cache adjustment strategies, and dynamically adjusts cache capacity and replacement strategies.

Benefits of technology

It improves cache utilization efficiency, adapts to changes in system load and data access patterns, reduces resource waste, and improves switch operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890328B_ABST
    Figure CN118890328B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides an adaptive cache dynamic adjustment method, which includes: monitoring the operating status of a switch and regularly collecting port traffic information of the switch; calculating the load data of the switch in the operating state based on the port traffic information; and comparing the load data with a preset load performance benchmark to obtain a first evaluation result for the switch; calculating the current cache usage information of the switch based on the port traffic information; and comparing the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch; and finally, combining the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjusting the switch cache according to the cache adjustment policy. By monitoring the real-time workload and cache utilization of the switch, the embodiment of the present invention automatically adjusts the cache capacity and replacement policy to maximize cache utilization efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network communications, and in particular to a method for dynamically adjusting an adaptive cache. Background Art

[0002] With the rapid development of network technology, caching technology plays a crucial role. By storing data in cache, the number of accesses to main memory can be reduced, thereby improving data processing speed. However, as core network devices, switches face increasing data volumes and access frequencies, requiring them to process ever-increasing amounts of data and increasingly complex data access patterns. Traditional static cache management strategies are no longer sufficient to meet the requirements for efficient switch operation. Existing technologies primarily rely on fixed cache sizes and replacement policies, or on collecting historical data, using machine learning algorithms to train predictive models, and then using the predicted results to guide cache replacement and updates.

[0003] The current cache replacement strategy is fixed and cannot adapt to changes in system load and data access patterns, resulting in low cache efficiency and resource waste. It cannot be dynamically adjusted according to the real-time load and data access patterns of the switch. Summary of the Invention

[0004] The present invention provides an adaptive cache dynamic adjustment method that monitors the system's operating status and data access patterns in real time and uses intelligent algorithms to dynamically adjust the cache strategy to adapt to changes in system load and data access patterns. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a method for dynamic adaptive cache adjustment is provided, the method comprising:

[0006] Monitor the operating status of the switch and regularly collect port traffic information of the switch;

[0007] Calculating load data of the switch in a working state based on the port traffic information, and comparing the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, wherein the first evaluation result is used to indicate a working load status of the switch;

[0008] Calculating current cache usage information of the switch based on the port traffic information, and comparing the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, wherein the second evaluation result is used to indicate a cache utilization level of the switch;

[0009] The first evaluation result and the second evaluation result are combined to generate a cache adjustment policy for the switch, and the cache of the switch is adjusted according to the cache adjustment policy.

[0010] Optionally, the method further includes:

[0011] Monitoring a new operating state of the switch after applying the cache adjustment policy and generating a corresponding log record, the log record including the application time point of the cache adjustment policy, new load data of the switch after adjustment, and new cache usage information;

[0012] The log records are analyzed periodically, and a new cache adjustment policy for the switch is generated according to the log records.

[0013] Optionally, the switch includes a plurality of ports, and monitoring the operating status of the switch and periodically collecting port traffic information of the switch includes:

[0014] collecting real-time traffic data of the port through a traffic counter, and determining a traffic category of the port according to the real-time traffic data, wherein the traffic category includes a high-traffic port, a low-traffic port, and an abnormal-traffic port;

[0015] Regularly querying the accumulated flow data collected by the flow counter within a fixed time, and calculating the flow change of the port within a unit time based on the accumulated flow data;

[0016] Acquire flow information of the real-time flow data, the flow information including a source address, a destination address, and a port number of the real-time flow data, and analyze the flow information to obtain an access mode corresponding to the real-time flow data;

[0017] Monitoring a total number of data requests passing through the switch within a fixed time, the data requests being used to request data items in the cache, the total number including the number of successful requests and the number of failed requests;

[0018] When the data item corresponding to the data request exists in the cache, recording the status of the data request as a successful request;

[0019] When the data item corresponding to the data request does not exist in the cache, the status of the data request is recorded as request failure.

[0020] Optionally, the load data includes average traffic data, frame loss rate, and delay time, and calculating the load data of the switch in a working state according to the port traffic information includes:

[0021] Calculate the average flow data per unit time according to the port flow information;

[0022] collecting frame data transmitted by the switch in a continuous working state through a frame counter, the frame data including the number of input frames, the number of output frames, and the number of discarded frames, and calculating a frame loss rate of the switch when transmitting the frame data based on the number of input frames and the number of discarded frames;

[0023] Recording the input timestamp corresponding to the input frame number and the output timestamp corresponding to the output frame number;

[0024] The difference between the input timestamp and the output timestamp is calculated to obtain the delay time of the switch when transmitting the frame data.

[0025] Optionally, comparing the load data with a preset load performance benchmark includes:

[0026] When the load data exceeds the load performance benchmark, the switch is judged to be in a high load state; when the load data is within the load performance benchmark, the switch is judged to be in a normal load state; when the load data is less than the load performance benchmark, the switch is judged to be in a low load state;

[0027] Wherein, when the load data exceeds the load performance benchmark, determining that the switch is in a high load state includes:

[0028] Presetting a load performance benchmark for the switch in a continuous working state, the load performance benchmark including an average flow benchmark, a frame loss rate benchmark, and a delay time benchmark;

[0029] Comparing the average traffic data with the average traffic benchmark to obtain a first load performance comparison result of the switch, and determining, according to the first load performance comparison result, a switch whose average traffic data exceeds the average traffic benchmark as a high-load state switch;

[0030] comparing the frame loss rate with the frame loss rate benchmark to obtain a second load performance comparison result of the switch, and determining, according to the second load performance comparison result, a switch whose frame loss rate exceeds the frame loss rate benchmark as a high-load state switch;

[0031] The delay time is compared with the delay time benchmark to obtain a third load performance comparison result of the switch, and the switch whose delay time exceeds the delay time benchmark is regarded as a high-load state switch according to the third load performance comparison result.

[0032] Optionally, the cache usage information includes a cache hit rate and a cache usage rate, the cache includes several cache layers, and calculating the current cache usage information of the switch based on the port traffic information and comparing the cache usage information with a preset cache performance benchmark includes:

[0033] Calculate the cache hit rate of the cache layer according to the total number of times and the number of successful requests;

[0034] Calculating a cache utilization rate of the cache layer according to a total space capacity of the cache and a space capacity occupied by the data item;

[0035] Presetting a cache performance benchmark of the switch in a normal working state, the cache performance benchmark including a cache hit rate benchmark and a cache utilization rate benchmark;

[0036] comparing the cache hit rate with the cache hit rate benchmark, determining that the cache layer is in a high cache hit rate state when the cache hit rate exceeds the cache hit rate benchmark, determining that the cache layer is in a normal cache hit rate state when the cache hit rate is within the cache hit rate benchmark, and determining that the cache layer is in a low cache hit rate state when the cache hit rate is less than the cache hit rate benchmark;

[0037] The cache utilization is compared with the cache utilization benchmark. When the cache utilization exceeds the cache utilization benchmark, the cache layer is judged to be in a high cache utilization state. When the cache utilization is within the cache utilization benchmark, the cache layer is judged to be in a normal cache utilization state. When the cache utilization is less than the cache utilization benchmark, the cache layer is judged to be in a low cache utilization state.

[0038] Optionally, combining the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjusting the cache of the switch according to the cache adjustment policy includes:

[0039] When the switch is in the high load state and the cache layer is in the low cache hit rate, calculating the expansion space capacity required by the switch in combination with the load performance benchmark and the cache hit rate benchmark, and increasing the total space capacity of the cache according to the expansion space capacity;

[0040] When the switch is in the low load state or the cache layer is in the low cache utilization state, calculating a reduced space capacity for the switch according to the load performance benchmark or the cache utilization benchmark, and reducing the total space capacity of the cache according to the reduced space capacity;

[0041] When the switch is in the high cache utilization state, data items in the cache are deleted until the cache utilization is within the cache utilization benchmark.

[0042] In a second aspect of the present invention, an adaptive cache dynamic adjustment device is provided, the device comprising:

[0043] The port traffic information collection module is used to monitor the operating status of the switch and regularly collect the port traffic information of the switch;

[0044] a first evaluation result generating module, configured to calculate load data of the switch in an operating state based on the port traffic information, and compare the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, wherein the first evaluation result is used to indicate a working load status of the switch;

[0045] a second evaluation result generating module, configured to calculate current cache usage information of the switch based on the port traffic information, and compare the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, wherein the second evaluation result is used to indicate a cache utilization level of the switch;

[0046] A cache adjustment policy generating module is configured to combine the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjust the cache of the switch according to the cache adjustment policy.

[0047] In a third aspect of the present invention, there is further provided a communication device comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor;

[0048] The processor is configured to read a program in a memory to implement any of the above-mentioned adaptive cache dynamic adjustment methods.

[0049] In a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium. When the computer-readable storage medium is run on a computer, the computer executes any of the above-mentioned adaptive cache dynamic adjustment methods.

[0050] The adaptive cache dynamic adjustment method provided by the embodiment of the present invention monitors the operating status of the switch and regularly collects the port traffic information of the switch, calculates the load data of the switch in the working state based on the port traffic information, and compares the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, and the first evaluation result is used to indicate the workload status of the switch; calculates the current cache usage information of the switch based on the port traffic information, and compares the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, and the second evaluation result is used to indicate the cache utilization level of the switch; finally, the first evaluation result and the second evaluation result are combined to generate a cache adjustment policy for the switch, and the cache of the switch is adjusted according to the cache adjustment policy. The embodiment of the present invention automatically adjusts the cache capacity and replacement policy by monitoring the real-time workload and cache utilization of the switch to maximize the utilization efficiency of the cache. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for describing the embodiments or the prior art.

[0052] Figure 1 A flowchart of the steps of the adaptive cache dynamic adjustment method provided by an embodiment of the present invention;

[0053] Figure 2 It is a structural diagram of an adaptive cache dynamic adjustment device provided by an embodiment of the present invention;

[0054] Figure 3 It is a structural diagram of a communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, each embodiment of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be understood by those skilled in the art that in each embodiment of the present invention, many technical details are provided to enable the reader to better understand the present invention. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present invention can be implemented. The division of the following embodiments is for convenience of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined with each other and referenced to each other under the premise that there is no contradiction.

[0056] Reference Figure 1 , shows a flowchart of the steps of the adaptive cache dynamic adjustment method provided by an embodiment of the present invention, the method may include:

[0057] Step 101: monitor the operating status of the switch and regularly collect port traffic information of the switch.

[0058] The switch in the embodiment of the present invention includes several ports. The collected port traffic information includes real-time traffic data of the port, cumulative traffic data of the port within a fixed time period, access patterns corresponding to the real-time traffic data, and the total number of data requests passing through the switch within the fixed time period. The specific implementation steps are as follows:

[0059] A traffic counter collects real-time traffic data from a port and determines the port's traffic category based on the real-time traffic data. Traffic categories include high-traffic ports, low-traffic ports, and abnormal-traffic ports. Real-time traffic data refers to the amount of data being transmitted on a switch port at a specific moment. For example, at a specific moment (e.g., 10:00:00), if the port's real-time traffic data is 100 Mbps (megabits per second), it indicates that the port is transmitting data at 100 Mbps at that moment. In one embodiment, a maximum and minimum real-time traffic value can be set. When the real-time traffic threshold collected by the traffic counter is greater than or equal to the maximum real-time traffic value, the port is determined to be a high-traffic port. When the real-time traffic threshold collected by the traffic counter is less than the minimum real-time traffic value, the port is determined to be a low-traffic port. For abnormal-traffic ports, analysis can be conducted in conjunction with the port's historical traffic data. If the port's real-time traffic data shows a surge or a sudden drop compared to the historical traffic data, the port is determined to be an abnormal-traffic port. In another embodiment, a port can also be determined to be an abnormal-traffic port if it maintains a high-traffic state for a period of time.

[0060] Through the above method, the traffic status of the port can be identified. For high-traffic ports, their cache allocation can be increased when specifying the cache adjustment strategy to ensure timely processing and forwarding of data. For low-traffic ports, their cache allocation can be appropriately reduced to release more cache resources for high-traffic ports. When cache resources are tight, a priority strategy can be adopted to prioritize the cache needs of important data flows or services.

[0061] The traffic counter is periodically queried for accumulated traffic data collected within a fixed time period, and the traffic change of the port per unit time is calculated based on the accumulated traffic data. Accumulated traffic data refers to the total amount of data transmitted on the switch port from a certain starting time point to the current time point. In one embodiment, a fixed time interval for querying the traffic counter can be determined, such as every minute, every hour, or every day, and the accumulated traffic data of the switch port within the fixed time interval can be periodically queried, and the collected accumulated traffic data can be recorded. The difference between the accumulated traffic data at two query time points is calculated to obtain the traffic change of the port during this period. For example:

[0062] The starting time is: January 1, 2024 0:00:00

[0063] First query time: January 1, 2024, 10:00:00

[0064] Second query time: January 1, 2024, 11:00:00

[0065] Cumulative traffic data for the first query: 100,000 bytes

[0066] Cumulative traffic data for the second query: 150,000 bytes

[0067] Among them, flow change = cumulative flow data of the second query - cumulative flow data of the first query

[0068] Therefore, the traffic change this time = 150,000 bytes - 100,000 bytes = 50,000 bytes

[0069] Traffic information of real-time traffic data is obtained, where the traffic information includes a source address, a destination address, and a port number of the real-time traffic data, and the traffic information is analyzed to obtain an access pattern corresponding to the real-time traffic data. In one example, port mirroring can be configured on a switch to mirror the port traffic to be monitored to an analysis port, thereby capturing traffic packets of the real-time data traffic on the analysis port. The source address, destination address, and port number are extracted from the captured traffic packets, and the combination of the source address, destination address, and port number is analyzed to identify the access pattern corresponding to the traffic packets.

[0070] Monitors the total number of data requests passing through the switch within a fixed time period. Data requests are used to request data items in the cache. The total number includes both successful and failed requests. If the corresponding data item exists in the cache, the request status is recorded as successful. If the corresponding data item does not exist in the cache, the request status is recorded as failed.

[0071] Step 102 calculates load data of the switch in its operating state based on the port traffic information and compares the load data with a preset load performance benchmark to obtain a first evaluation result for the switch. The first evaluation result is used to indicate the operating load status of the switch. In one embodiment, the load data includes average traffic data, frame loss rate, and delay time. The specific execution steps include:

[0072] Calculates the average traffic flow per unit time based on port traffic information. Predetermine a time interval and add all collected real-time traffic data within that interval to obtain the total traffic flow. Divide the total traffic flow by the time interval to obtain the average traffic flow. For example, if the time interval is set to 1 hour (60 minutes) and the total traffic flow collected within that hour is 60,000 bytes, the corresponding average traffic flow is 60,000 bytes / hour, or 1000 bytes / minute.

[0073] The frame counter collects frame data transmitted by the switch in a continuous working state. The frame data includes the number of input frames, output frames, and discarded frames. The frame loss rate of the switch when transmitting frame data is calculated based on the number of input frames and discarded frames.

[0074] Record the input timestamp corresponding to the input frame number and the output timestamp corresponding to the output frame number.

[0075] The difference between the input timestamp and the output timestamp is calculated to obtain the delay time when the switch transmits the frame data.

[0076] When the load data exceeds the load performance benchmark, the switch is judged to be in a high-load state; when the load data is within the load performance benchmark, the switch is judged to be in a normal load state; when the load data is less than the load performance benchmark, the switch is judged to be in a low-load state.

[0077] When the load data exceeds the load performance benchmark, the switch is judged to be in a high load state, including:

[0078] The load performance benchmark of the switch in a continuous working state is preset. The load performance benchmark includes an average flow benchmark, a frame loss rate benchmark, and a delay time benchmark.

[0079] The average traffic data is compared with an average traffic benchmark to obtain a first load performance comparison result of the switch. Based on the first load performance comparison result, switches whose average traffic data exceeds the average traffic benchmark are designated as switches in a high-load state. The frame loss rate is compared with a frame loss rate benchmark to obtain a second load performance comparison result of the switch. Based on the second load performance comparison result, switches whose frame loss rate exceeds the frame loss rate benchmark are designated as switches in a high-load state. The delay time is compared with a delay time benchmark to obtain a third load performance comparison result of the switch. Based on the third load performance comparison result, switches whose delay time exceeds the delay time benchmark are designated as switches in a high-load state.

[0080] Step 103 calculates the switch's current cache usage information based on the port traffic information and compares the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch. The second evaluation result is used to indicate the switch's cache utilization. In one embodiment of the present invention, the cache usage information includes a cache hit rate and a cache usage rate. The cache includes several cache layers. The specific implementation steps include:

[0081] The cache hit ratio of the cache layer is calculated based on the total number of requests and the number of successful requests.

[0082] The cache utilization of the cache layer is calculated based on the total cache space capacity and the space capacity occupied by the data items.

[0083] A cache performance benchmark of the switch in normal working state is preset, and the cache performance benchmark includes a cache hit rate benchmark and a cache utilization rate benchmark.

[0084] The cache hit rate is compared with the cache hit rate benchmark. When the cache hit rate exceeds the cache hit rate benchmark, the cache layer is judged to be in a high cache hit rate state. When the cache hit rate is within the cache hit rate benchmark, the cache layer is judged to be in a normal cache hit rate state. When the cache hit rate is less than the cache hit rate benchmark, the cache layer is judged to be in a low cache hit rate state.

[0085] The cache utilization is compared with the cache utilization benchmark. When the cache utilization exceeds the cache utilization benchmark, the cache layer is judged to be in a high cache utilization state. When the cache utilization is within the cache utilization benchmark, the cache layer is judged to be in a normal cache utilization state. When the cache utilization is less than the cache utilization benchmark, the cache layer is judged to be in a low cache utilization state.

[0086] Through the above method, the cache hit rate and utilization can be identified, so that the data can be allocated to different cache layers according to its importance. For data with high importance, it is allocated to the high-speed cache layer with a high cache hit rate state. For data with average importance, it is allocated to the normal-speed cache layer with a normal cache hit rate state. For data with low importance, it is allocated to the low-speed cache layer with a low cache hit rate state.

[0087] Step 104: Combine the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjust the cache of the switch according to the cache adjustment policy. The specific implementation steps include:

[0088] When the switch is in a high load state and the cache layer is in a low cache hit rate, the required expansion space capacity of the switch is calculated in combination with the load performance benchmark and the cache hit rate benchmark, and the total space capacity of the cache is increased according to the expansion space capacity.

[0089] When the switch is in a low load state or the cache layer is in a low cache utilization state, a reduced space capacity for the switch is calculated according to a load performance benchmark or a cache utilization benchmark, and the total space capacity of the cache is reduced according to the reduced space capacity.

[0090] When the cache layer of the switch is in a high cache utilization state, data items in the cache are deleted until the cache utilization falls within a cache utilization baseline.

[0091] The adaptive cache dynamic adjustment method provided by the embodiment of the present invention monitors the operating status of the switch and regularly collects the port traffic information of the switch, calculates the load data of the switch in the working state based on the port traffic information, and compares the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, and the first evaluation result is used to indicate the workload status of the switch; calculates the current cache usage information of the switch based on the port traffic information, and compares the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, and the second evaluation result is used to indicate the cache utilization level of the switch; finally, the first evaluation result and the second evaluation result are combined to generate a cache adjustment policy for the switch, and the cache of the switch is adjusted according to the cache adjustment policy. The embodiment of the present invention automatically adjusts the cache capacity and replacement policy by monitoring the real-time workload and cache utilization of the switch to maximize the utilization efficiency of the cache.

[0092] The adaptive cache dynamic adjustment method provided by the embodiment of the present invention further includes the following steps:

[0093] Monitor the new operating state of the switch after applying the cache adjustment policy and generate corresponding log records, including the application time of the cache adjustment policy, the new load data of the switch after adjustment, and the new cache usage information;

[0094] Log records are analyzed regularly and new cache tuning policies for the switch are generated based on the log records.

[0095] In this embodiment of the present invention, the current cache policy is first evaluated based on data collected by the monitoring system, such as cache hit rate and traffic data fluctuations. If the cache hit rate decreases or certain service requests are not being effectively processed, cache capacity needs to be adjusted or replacement policy parameters optimized to improve cache efficiency. Secondly, the adjusted cache policy is redeployed on the switch and its effectiveness is continuously monitored. This includes real-time monitoring of key metrics such as cache usage, hit rate, and latency, as well as collecting user feedback and service performance data. Then, based on the new monitoring and evaluation results, the policy is optimized again. This process may involve adjusting cache size, updating replacement algorithms, and optimizing cache warming mechanisms. Through continuous iterative optimization, a cache management mechanism is formed that dynamically adapts to network changes and service needs. Furthermore, to ensure the effectiveness and security of cache adjustments, relevant information and suggestions for cache adjustments can be provided to developers through logging, alarm notifications, and other means. Furthermore, cache adjustments can be combined with other network optimization technologies, such as routing optimization and traffic scheduling, to achieve cross-layer network performance optimization and improve overall network stability and efficiency.

[0096] In an embodiment of the present invention, for an identified abnormal traffic port, a reset isolation operation can be performed on it. The specific implementation steps are as follows:

[0097] Analyze the traffic data of the abnormal traffic port. The traffic data can be real-time traffic data or cumulative traffic data. The present invention is not limited to this. According to the characteristics of the traffic data, the corresponding abnormal pattern is identified. The abnormal pattern may include a sudden increase in traffic, a change in traffic pattern, and continuous high traffic.

[0098] Then adjust the network configuration of the abnormal traffic port according to its abnormal pattern and re-monitor it. The number of times to adjust the network configuration and re-monitor can be set. If abnormal traffic still exists after multiple readjustments, the abnormal traffic port will be isolated.

[0099] In one embodiment of the present invention, the cache replacement strategy can also be automatically adjusted based on the most recent usage time and access frequency of the cached data items. The specific implementation steps are as follows:

[0100] LRU algorithm (Least Recently Used): Based on the principle of most recent usage time, it eliminates cache items that have not been used for the longest time.

[0101] LFU (Least Frequently Used) algorithm: Based on the principle of frequency of use, the least frequently used cache items are eliminated.

[0102] Record the most recent access time and access frequency of each data item in the cache. Specifically, you can record a timestamp for each data item to indicate the last time it was accessed, and use data structures (such as linked lists, queues, hash tables, etc.) to store and manage data items and their access times. Whenever a data item is accessed, update its timestamp to the current time.

[0103] In the LRU algorithm, a linked list is used to maintain the order in which data items are accessed. Whenever a data item is accessed, it is moved to the head of the linked list, indicating that it was recently accessed. At the same time, a hash table is used to quickly find the position of the data item in the linked list, allowing for quick updates of access times.

[0104] In the LFU algorithm, in addition to recording the access time, it is also necessary to record the number of accesses for each data item. Frequency buckets (such as bucket sort) are used to manage data items with different access frequencies so that the data item with the lowest access frequency can be quickly found.

[0105] The most recent access time and access frequency analyze the cache usage pattern of each data item and identify hot data and cold data. You can set the time base value and frequency base value. Hot data refers to data items with a timestamp after the time base value or an access frequency not less than the frequency base value. Cold data refers to data items with a timestamp before the time base value or an access frequency less than the frequency base value.

[0106] Based on the analysis results, the cache replacement strategy is dynamically adjusted and implemented, so that hot data can be retained in the cache to improve response speed, and cold data can be cleared from the cache to free up space.

[0107] In an embodiment of the present invention, communication with the switch and policy application can be achieved through the API interface or SDK provided by the switch. The data storage location can also be dynamically adjusted according to specific needs. For example, the API can be used to specify that certain data items should always be stored in the cache layer, or the cache policy can be dynamically adjusted based on the status of the application. Because large data items occupy a large amount of memory resources and may cause other important data items to be eliminated, large data items can be specified to be stored separately in a fixed cache layer. However, important data items may require more reliable storage and faster access speeds. Therefore, more important data items can be specified to be stored in the cache layer.

[0108] In an embodiment of the present invention, the corresponding validity period of each data item in the cache can also be set according to its size. Specifically, the maxmemory parameter can be set in the Redis configuration file to limit the maximum size of the cache and select an appropriate replacement strategy. For example, setting maxmemory 1gb means that the maximum size of the cache is 1GB. The replacement strategy may include:

[0109] volatile-lru: Use the LRU algorithm to eliminate data items with set expiration times.

[0110] allkeys-lru: Use the LRU algorithm to eliminate all data items.

[0111] volatile-lfu: Use the LFU algorithm to eliminate data items with expiration times.

[0112] allkeys-lfu: Use the LFU algorithm to eliminate all data items.

[0113] volatile-random: Randomly eliminate data items with expiration times.

[0114] allkeys-random: Randomly eliminate all data items.

[0115] volatile-ttl: Eliminates data items with an expiration time set and the shortest remaining lifetime.

[0116] noeviction: Do not evict data items and return an error when the cache is full.

[0117] Through the above method, the two adaptive adjustment modes of time and access frequency can be effectively combined to better balance the cache size and the validity period of data items, thereby improving the performance and efficiency of the cache.

[0118] Reference Figure 2 , shows a schematic structural diagram of an adaptive cache dynamic adjustment device provided by an embodiment of the present invention, such as Figure 2 As shown, the device may include:

[0119] The port traffic information collection module 201 is used to monitor the operating status of the switch and regularly collect the port traffic information of the switch.

[0120] The first evaluation result generating module 202 is used to calculate the load data of the switch in the working state based on the port traffic information, and compare the load data with the preset load performance benchmark to obtain a first evaluation result for the switch. The first evaluation result is used to indicate the working load status of the switch.

[0121] The second evaluation result generating module 203 is used to calculate the current cache usage information of the switch based on the port traffic information, and compare the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, which is used to indicate the cache utilization level of the switch.

[0122] The cache adjustment policy generating module 204 is configured to combine the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjust the cache of the switch according to the cache adjustment policy.

[0123] Optionally, the adaptive cache dynamic adjustment device further includes:

[0124] The log recording module is used to monitor the new operating status of the switch after applying the cache adjustment policy and generate corresponding log records. The log records include the application time point of the cache adjustment policy, the new load data of the switch after adjustment, and the new cache usage information.

[0125] Feedback optimization module, which is used to periodically analyze log records and generate new cache adjustment policies for switches based on the log records.

[0126] Optionally, the switch includes several ports, and the port traffic information collection module 201 further includes:

[0127] The real-time traffic data collection module is used to collect the real-time traffic data of the port through the traffic counter and determine the traffic category of the port according to the real-time traffic data. The traffic categories include high-traffic ports, low-traffic ports and abnormal traffic ports.

[0128] The cumulative flow data query module is used to regularly query the cumulative flow data collected by the flow counter within a fixed time, and calculate the flow change of the port within a unit time based on the cumulative flow data.

[0129] The traffic information analysis module is used to obtain traffic information of real-time traffic data, the traffic information including the source address, destination address and port number of the real-time traffic data, and analyze the traffic information to obtain the access mode corresponding to the real-time traffic data.

[0130] The total number of monitoring modules is used to monitor the total number of data requests that pass through the switch within a fixed time. The data request is used to request data items in the cache. The total number of requests includes the number of successful requests and the number of failed requests.

[0131] A request success recording module is used to record the status of the data request as a successful request when a data item corresponding to the data request exists in the cache;

[0132] The request failure recording module is used to record the status of the data request as request failure when there is no data item corresponding to the data request in the cache.

[0133] Optionally, the load data includes average traffic data, frame loss rate, and delay time, and the first evaluation result generating module 202 further includes:

[0134] The average flow data calculation module is used to calculate the average flow data per unit time based on the port flow information.

[0135] The frame loss rate calculation module is used to collect frame data transmitted by the switch in a continuous working state through a frame counter. The frame data includes the number of input frames, the number of output frames, and the number of discarded frames, and calculate the frame loss rate of the switch when transmitting frame data based on the number of input frames and the number of discarded frames.

[0136] The timestamp recording module is used to record the input timestamp corresponding to the input frame number and the output timestamp corresponding to the output frame number.

[0137] The delay time calculation module is used to calculate the difference between the input timestamp and the output timestamp to obtain the delay time of the switch when transmitting frame data.

[0138] Optionally, the first evaluation result generating module 202 further includes:

[0139] A load status judgment module is used to judge that the switch is in a high-load state when the load data exceeds the load performance benchmark, judge that the switch is in a normal-load state when the load data is within the load performance benchmark, and judge that the switch is in a low-load state when the load data is less than the load performance benchmark;

[0140] The load status judgment module includes:

[0141] A load performance benchmark setting module is used to pre-set the load performance benchmark of the switch in a continuous working state. The load performance benchmark includes an average flow benchmark, a frame loss rate benchmark, and a delay time benchmark;

[0142] a first high-load state switch determination module, configured to compare the average traffic data with an average traffic benchmark to obtain a first load performance comparison result of the switch, and, based on the first load performance comparison result, determine a switch whose average traffic data exceeds the average traffic benchmark as a high-load state switch;

[0143] a second high-load state switch determination module, configured to compare the frame loss rate with a frame loss rate benchmark to obtain a second load performance comparison result of the switch, and determine, based on the second load performance comparison result, a switch whose frame loss rate exceeds the frame loss rate benchmark as a high-load state switch;

[0144] The third high-load state switch determination module is used to compare the delay time with the delay time benchmark to obtain a third load performance comparison result of the switch, and according to the third load performance comparison result, determine the switch whose delay time exceeds the delay time benchmark as a high-load state switch.

[0145] Optionally, the cache usage information includes a cache hit rate and a cache usage rate, and the cache includes several cache layers. The second evaluation result generating module 203 further includes:

[0146] The cache hit rate calculation module is used to calculate the cache hit rate of the cache layer based on the total number of times and the number of successful requests;

[0147] A cache utilization calculation module is used to calculate the cache utilization of the cache layer based on the total space capacity of the cache and the space capacity occupied by the data items;

[0148] A cache performance benchmark setting module is used to pre-set the cache performance benchmark of the switch under normal working conditions. The cache performance benchmark includes a cache hit rate benchmark and a cache utilization benchmark.

[0149] a cache hit rate status judgment module, configured to compare the cache hit rate with a cache hit rate benchmark, and to judge that the cache layer is in a high cache hit rate state when the cache hit rate exceeds the cache hit rate benchmark; to judge that the cache layer is in a normal cache hit rate state when the cache hit rate is within the cache hit rate benchmark; and to judge that the cache layer is in a low cache hit rate state when the cache hit rate is less than the cache hit rate benchmark;

[0150] The cache utilization status judgment module is used to compare the cache utilization with the cache utilization benchmark. When the cache utilization exceeds the cache utilization benchmark, it is judged that the cache layer is in a high cache utilization state; when the cache utilization is within the cache utilization benchmark, it is judged that the cache layer is in a normal cache utilization state; when the cache utilization is less than the cache utilization benchmark, it is judged that the cache layer is in a low cache utilization state.

[0151] Optionally, the cache adjustment strategy generating module 204 further includes:

[0152] The expansion module is used to calculate the expansion space capacity required by the switch based on the load performance benchmark and the cache hit rate benchmark when the switch is in a high load state and the cache layer is in a low cache hit rate, and increase the total cache space capacity according to the expansion space capacity;

[0153] A capacity reduction module is configured to calculate a reduced space capacity for the switch based on a load performance benchmark or a cache utilization benchmark when the switch is in a low load state or the cache layer is in a low cache utilization state, and reduce the total space capacity of the cache based on the reduced space capacity;

[0154] The deletion module is used to delete data items in the cache when the cache layer of the switch is in a high cache utilization state until the cache utilization is within a cache utilization benchmark.

[0155] The adaptive cache dynamic adjustment method provided by the embodiment of the present invention monitors the operating status of the switch and regularly collects the port traffic information of the switch, calculates the load data of the switch in the working state based on the port traffic information, and compares the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, and the first evaluation result is used to indicate the workload status of the switch; calculates the current cache usage information of the switch based on the port traffic information, and compares the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, and the second evaluation result is used to indicate the cache utilization level of the switch; finally, the first evaluation result and the second evaluation result are combined to generate a cache adjustment policy for the switch, and the cache of the switch is adjusted according to the cache adjustment policy. The embodiment of the present invention automatically adjusts the cache capacity and replacement policy by monitoring the real-time workload and cache utilization of the switch to maximize the utilization efficiency of the cache.

[0156] The embodiment of the present invention also provides a communication device, such as Figure 3 As shown, it includes a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304.

[0157] Memory 303, for storing computer programs;

[0158] The processor 301 is configured to execute the program stored in the memory 303, and implement the following steps:

[0159] Monitor the operating status of the switch and regularly collect port traffic information of the switch;

[0160] Calculating load data of the switch in a working state based on the port traffic information, and comparing the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, where the first evaluation result is used to indicate a working load status of the switch;

[0161] Calculating current cache usage information of the switch based on the port traffic information, and comparing the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, the second evaluation result being used to indicate a cache utilization level of the switch;

[0162] The first evaluation result and the second evaluation result are combined to generate a cache adjustment policy for the switch, and the cache of the switch is adjusted according to the cache adjustment policy.

[0163] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0164] The communication interface is used for communication between the above terminal and other devices.

[0165] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0166] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0167] The present invention also provides a readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the adaptive cache dynamic adjustment method of the aforementioned embodiment.

[0168] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0169] The algorithm and display provided herein are not inherently related to any particular computer, virtual device or other equipment. According to the above description, it is obvious that the structure required for constructing this type of device is suitable. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the above description of specific languages ​​is for the purpose of disclosing the best mode of the present invention.

[0170] In the description provided herein, numerous specific details are described. However, it is understood that embodiments of the present invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0171] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Accordingly, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the invention.

[0172] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0173] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the sorting device according to the present invention. The present invention may also be implemented as an apparatus or device program for performing a portion or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0174] It should be noted that the above embodiments illustrate rather than limit the invention, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

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

[0176] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

[0177] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

[0178] It should be noted that the various data-related processes in the embodiments of the present invention are all carried out in compliance with the corresponding data protection laws and policies of the country where they are located, and with the authorization given by the corresponding device owner.

Claims

1. A method for dynamic adaptive cache adjustment, characterized in that: The method comprises: Monitor the operating status of the switch and regularly collect port traffic information of the switch; Calculating load data of the switch in a working state based on the port traffic information, and comparing the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, wherein the first evaluation result is used to indicate a working load status of the switch; Calculating current cache usage information of the switch based on the port traffic information, and comparing the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, wherein the second evaluation result is used to indicate a cache utilization level of the switch; The first evaluation result and the second evaluation result are combined to generate a cache adjustment policy for the switch, and the cache of the switch is adjusted according to the cache adjustment policy.

2. The method according to claim 1, characterized in that The method further comprises: Monitoring a new operating state of the switch after applying the cache adjustment policy and generating a corresponding log record, the log record including the application time point of the cache adjustment policy, new load data of the switch after adjustment, and new cache usage information; The log records are analyzed periodically, and a new cache adjustment policy for the switch is generated according to the log records.

3. The method according to claim 1, characterized in that The switch includes a plurality of ports. The monitoring of the operating status of the switch and the regular collection of port traffic information of the switch include: collecting real-time traffic data of the port through a traffic counter, and determining a traffic category of the port according to the real-time traffic data, wherein the traffic category includes a high-traffic port, a low-traffic port, and an abnormal-traffic port; Regularly querying the accumulated flow data collected by the flow counter within a fixed time, and calculating the flow change of the port within a unit time based on the accumulated flow data; Acquire flow information of the real-time flow data, the flow information including a source address, a destination address, and a port number of the real-time flow data, and analyze the flow information to obtain an access mode corresponding to the real-time flow data; Monitoring a total number of data requests passing through the switch within a fixed time, the data requests being used to request data items in the cache, the total number including the number of successful requests and the number of failed requests; When the data item corresponding to the data request exists in the cache, recording the status of the data request as a successful request; When the data item corresponding to the data request does not exist in the cache, the status of the data request is recorded as request failure.

4. The method according to claim 3, characterized in that The load data includes average flow data, frame loss rate and delay time, and the load data of the switch in the working state is calculated according to the port flow information, including: Calculate the average flow data per unit time according to the port flow information; collecting frame data transmitted by the switch in a continuous working state through a frame counter, the frame data including the number of input frames, the number of output frames, and the number of discarded frames, and calculating a frame loss rate of the switch when transmitting the frame data based on the number of input frames and the number of discarded frames; Recording the input timestamp corresponding to the input frame number and the output timestamp corresponding to the output frame number; The difference between the input timestamp and the output timestamp is calculated to obtain the delay time of the switch when transmitting the frame data.

5. The method according to claim 4, characterized in that The comparing the load data with a preset load performance benchmark includes: When the load data exceeds the load performance benchmark, the switch is judged to be in a high load state; when the load data is within the load performance benchmark, the switch is judged to be in a normal load state; when the load data is less than the load performance benchmark, the switch is judged to be in a low load state; Wherein, when the load data exceeds the load performance benchmark, determining that the switch is in a high load state includes: Presetting a load performance benchmark for the switch in a continuous working state, the load performance benchmark including an average flow benchmark, a frame loss rate benchmark, and a delay time benchmark; Comparing the average traffic data with the average traffic benchmark to obtain a first load performance comparison result of the switch, and determining, according to the first load performance comparison result, a switch whose average traffic data exceeds the average traffic benchmark as a high-load state switch; comparing the frame loss rate with the frame loss rate benchmark to obtain a second load performance comparison result of the switch, and determining, according to the second load performance comparison result, a switch whose frame loss rate exceeds the frame loss rate benchmark as a high-load state switch; The delay time is compared with the delay time benchmark to obtain a third load performance comparison result of the switch, and the switch whose delay time exceeds the delay time benchmark is regarded as a high-load state switch according to the third load performance comparison result.

6. The method according to claim 5, characterized in that The cache usage information includes a cache hit rate and a cache usage rate. The cache includes several cache layers. The current cache usage information of the switch is calculated based on the port traffic information, and the cache usage information is compared with a preset cache performance benchmark, including: Calculate the cache hit rate of the cache layer according to the total number of times and the number of successful requests; Calculating a cache utilization rate of the cache layer according to a total space capacity of the cache and a space capacity occupied by the data item; Presetting a cache performance benchmark of the switch in a normal working state, the cache performance benchmark including a cache hit rate benchmark and a cache utilization rate benchmark; comparing the cache hit rate with the cache hit rate benchmark, determining that the cache layer is in a high cache hit rate state when the cache hit rate exceeds the cache hit rate benchmark, determining that the cache layer is in a normal cache hit rate state when the cache hit rate is within the cache hit rate benchmark, and determining that the cache layer is in a low cache hit rate state when the cache hit rate is less than the cache hit rate benchmark; The cache utilization is compared with the cache utilization benchmark. When the cache utilization exceeds the cache utilization benchmark, the cache layer is judged to be in a high cache utilization state. When the cache utilization is within the cache utilization benchmark, the cache layer is judged to be in a normal cache utilization state. When the cache utilization is less than the cache utilization benchmark, the cache layer is judged to be in a low cache utilization state.

7. The method according to claim 6, characterized in that The combining the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjusting the cache of the switch according to the cache adjustment policy, includes: When the switch is in the high load state and the cache layer is in the low cache hit rate, calculating the expansion space capacity required by the switch in combination with the load performance benchmark and the cache hit rate benchmark, and increasing the total space capacity of the cache according to the expansion space capacity; When the switch is in the low load state or the cache layer is in the low cache utilization state, calculating a reduced space capacity for the switch according to the load performance benchmark or the cache utilization benchmark, and reducing the total space capacity of the cache according to the reduced space capacity; When the switch is in the high cache utilization state, data items in the cache are deleted until the cache utilization is within the cache utilization benchmark.

8. An adaptive cache dynamic adjustment device, characterized in that: The device comprises: The port traffic information collection module is used to monitor the operating status of the switch and regularly collect the port traffic information of the switch; a first evaluation result generating module, configured to calculate load data of the switch in an operating state based on the port traffic information, and compare the load data with a preset load performance benchmark to obtain a first evaluation result for the switch, wherein the first evaluation result is used to indicate a working load status of the switch; a second evaluation result generating module, configured to calculate current cache usage information of the switch based on the port traffic information, and compare the cache usage information with a preset cache performance benchmark to obtain a second evaluation result for the switch, wherein the second evaluation result is used to indicate a cache utilization level of the switch; A cache adjustment policy generating module is configured to combine the first evaluation result and the second evaluation result to generate a cache adjustment policy for the switch, and adjust the cache of the switch according to the cache adjustment policy.

9. A communication device, characterized in that: include: A transceiver, a memory, a processor, and a program stored on the memory and executable on the processor; The processor is configured to read a program in a memory to implement the steps of the adaptive cache dynamic adjustment method according to any one of claims 1 to 7.

10. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the adaptive cache dynamic adjustment method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Network intermediate node cache optimization method based on flow characteristic analysis

    CN103023801A

  • Flow-aware switch shared cache scheduling method and device

    CN113507423A