Dynamic adjustment method and system for cache time and storage medium

By obtaining and processing the traffic data of the network service interface in real time, and dynamically adjusting the cache time using the mapping model and neural network model, the problem that the fixed cache time cannot adapt to traffic changes is solved, and resource utilization efficiency and service stability are improved.

CN119652835APending Publication Date: 2025-03-18ANHUI HANGTIAN INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411734414.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The fixed cache time setting cannot adapt to the dynamic changes in traffic data, resulting in inefficient resource utilization or degradation of service quality.

Method used

By obtaining the traffic data of the network service interface in real time, the traffic characteristic value data set is obtained, and the cache time is dynamically adjusted according to the mapping model and neural network model to adapt to traffic changes.

Benefits of technology

It realizes more efficient cache resource utilization, improves service performance and user experience, ensures the stability of the service under high traffic conditions, and avoids system overload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652835A_ABST
    Figure CN119652835A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic adjustment method and system for cache time based on interface traffic and a storage medium, and relates to the technical field of Internet. The method comprises the following steps: acquiring flow data of a network service interface in real time, and processing to obtain a flow characteristic value data set; obtaining cache time corresponding to the traffic characteristic value data set according to the mapping model; inputting the flow characteristic value data set and the corresponding cache time into a neural network model for training to obtain a dynamic adjustment model; and inputting the current traffic characteristic value into the dynamic adjustment model to obtain current cache time, and applying the current cache time to the network service interface. According to the method, the cache time can be dynamically adjusted according to the interface traffic, the use of cache resources is optimized, and the service stability is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a method, system and storage medium for dynamically adjusting cache time based on interface traffic. Background Art

[0002] With the rapid development of network technology and the increasing number of user visits, network services are also facing tremendous pressure. In order to improve service performance and user experience, cache technology is widely used in network services.

[0003] However, fixed cache time settings often cannot adapt to the dynamic changes of traffic data, resulting in inefficient resource utilization or degraded service quality.

[0004] Therefore, there is an urgent need for a method that can dynamically adjust the cache time according to the interface traffic to optimize the use of cache resources and ensure the stability of the service. Summary of the invention

[0005] Based on this, it is necessary to provide a method, system and storage medium for dynamically adjusting the cache time in response to the above technical problems, so as to solve the problem of how to dynamically adjust the cache time according to the interface traffic.

[0006] In a first aspect, the present invention provides a method for dynamically adjusting a cache time, the method comprising: Obtain the traffic data of the network service interface in real time and process it to obtain a data set of traffic characteristic values; According to the mapping model, a cache time corresponding to the traffic characteristic value data set is obtained; Inputting the traffic characteristic value data set and the corresponding cache time into a neural network model for training to obtain a dynamic adjustment model; The current traffic characteristic value is input into the dynamic adjustment model to obtain the current cache time, and the current cache time is applied to the network service interface.

[0007] Furthermore, the traffic characteristic value data set includes: the total number of HTTP requests, the number of errors and the response time through the network service interface within a preset time window.

[0008] Furthermore, the response time is obtained in the following manner: Each response time within a preset time window is recorded, and all recorded response times are statistically calculated to obtain the average value, median value or variance of all response times to obtain the response time.

[0009] Furthermore, the mapping model is a model generated according to the relationship between the comprehensive performance index and the cache time.

[0010] Furthermore, the mapping model is generated in a manner including: using any one of a mapping formula, a machine learning algorithm or a lookup table to describe the relationship between the comprehensive performance index and the cache time.

[0011] Furthermore, obtaining the comprehensive performance index includes: The traffic characteristic value data set is obtained, and calculation is performed based on the total number of HTTP requests, the number of errors, and the response time to obtain the comprehensive performance index.

[0012] Furthermore, the comprehensive performance index The calculation formula is: ; in, Indicates the number of errors passing through the network service interface in real time; Indicates the total number of HTTP requests passing through the network service interface in real time; Indicates the response time of the network service interface in real time.

[0013] Furthermore, the mapping formula is: ; in, Indicates cache time; Indicates the initial cache time; Indicates the preset value; The comprehensive performance index representing the flow characteristic value in a set time period; A first preset threshold value representing a comprehensive performance index; Indicates a second preset threshold value of the comprehensive performance index.

[0014] In a second aspect, the present invention provides a computer system, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the above methods.

[0015] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of any of the above-mentioned methods when executed by a processor.

[0016] In general, the present invention provides a method, system and storage medium for dynamically adjusting cache time, which can achieve the following beneficial effects compared with the prior art: The present invention obtains the cache time corresponding to the traffic characteristic value data set through a mapping model; at the same time, the traffic characteristic value data set and the corresponding cache time are input into a neural network model for training to establish a dynamic adjustment model; the adjustment model generated by machine learning determines the relationship between the traffic characteristic value and the cache time, and then the cache time can be dynamically adjusted directly according to the real-time traffic characteristic value, which can better adapt to changes in network service interface traffic.

[0017] The present invention can not only optimize cache efficiency and service performance, improve the utilization efficiency of cache resources, reduce server load, and improve user access speed and experience; but also maintain service stability even under high traffic conditions and prevent system overload.

[0018] In addition, the system architecture of the present invention is simple, easy to implement and maintain, and has good scalability and applicability. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 The present invention provides a method flow chart of a method, system and storage medium for dynamically adjusting cache time. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in combination with the drawings and embodiments of the present invention. Obviously, the described embodiments are partial embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0022] It should be noted that, in the description of the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method, step or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such method, step or system. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the method, step or system including the element.

[0023] The present invention provides a method, system and storage medium for dynamically adjusting cache time, which can dynamically adjust cache time according to interface traffic, optimize the use of cache resources and ensure service stability. Figure 1 As shown, the specific methods include: Step 101: Acquire the flow data of the network service interface in real time, and process it to obtain a flow characteristic value data set.

[0024] It should be noted that a traffic data monitoring module can be set up to collect traffic data of the network service interface, wherein the traffic monitoring module is deployed on the network server and is used to record in real time information such as the total number of HTTP requests, number of errors, and response time passing through the network service interface.

[0025] More specifically, the traffic characteristic value data set includes: the total number of HTTP requests, the number of errors, and the response time through the network service interface within a preset time window.

[0026] The response time is obtained by recording each response time within a preset time window, performing statistical calculations on all recorded response times, and obtaining the average, median or variance of all response times to obtain the response time.

[0027] Preferably, the average value of all response times is taken as the flow characteristic value.

[0028] Step 102: According to the mapping model, a cache time corresponding to the traffic characteristic value data set is obtained.

[0029] It should be noted that the mapping model is a model generated according to the relationship between the comprehensive performance index and the cache time. The mapping model is generated by describing the relationship between the comprehensive performance index and the cache time using any one of a mapping formula, a machine learning algorithm or a lookup table.

[0030] More specifically, the comprehensive performance index is a parameter that describes the importance of traffic data. The comprehensive performance index is obtained by obtaining a traffic characteristic value data set, calculating based on the total number of HTTP requests, the number of errors, and the response time to obtain the comprehensive performance index.

[0031] Since lower error rates mean higher reliability, they contribute positively to the overall performance index. The total number of requests reflects the frequency of use of the network service interface, and shorter response times mean higher efficiency and better user experience.

[0032] Therefore, as a preferred embodiment, the comprehensive performance index The calculation formula is: ; in, Indicates the number of errors passing through the network service interface in real time; Indicates the total number of HTTP requests passing through the network service interface in real time; Indicates the response time of the network service interface in real time.

[0033] When a mapping formula is used to describe the relationship between the comprehensive performance index and the cache time, the mapping formula is a mapping model. As an embodiment, when the comprehensive performance index is greater than or equal to a first preset threshold, the cache time is appropriately reduced; when the comprehensive performance index is less than or equal to a second preset threshold, the cache time is appropriately increased; when the comprehensive performance index is greater than the second preset threshold and less than the first preset threshold, the cache time remains unchanged and is equal to the initial cache time.

[0034] As a specific embodiment, the mapping model may be: ; in, Indicates cache time; Indicates the initial cache time; Indicates the preset value; The comprehensive performance index representing the flow characteristic value in a set time period; A first preset threshold value representing a comprehensive performance index; Indicates a second preset threshold value of the comprehensive performance index.

[0035] For example, the first preset threshold , the second preset threshold , default value , the initial cache time is 20s, then That is to say, when the comprehensive performance index is greater than or equal to 70, the cache time is reduced to 16 seconds; when the comprehensive performance index is less than or equal to 40, the cache time is increased to 24 seconds; when the comprehensive performance index is between 40 and 70, the cache time remains unchanged at 20 seconds.

[0036] When the relationship between the comprehensive performance index and the cache time is described by a machine learning algorithm, that is, the relationship between the cache time and the comprehensive performance index generated by the machine learning algorithm. The input value of the second mapping model is the comprehensive performance index, and the output value is the cache time. Through linear regression algorithm learning and training, a mapping model in which the comprehensive performance index and the cache time are in a one-to-one correspondence is obtained.

[0037] When a lookup table is used to describe the relationship between the comprehensive performance index and the cache time, the cache change value, the minimum cache time and the optimal comprehensive performance index can be preset. The optimal comprehensive performance index is used as a benchmark, and the optimal comprehensive performance index corresponds to the initial cache time. When it is less than the optimal comprehensive performance index, the cache change value is gradually increased based on the initial cache time. When it is greater than the optimal comprehensive performance index, the cache change value is gradually decreased based on the initial cache time until the minimum cache time is reached.

[0038] As an embodiment, the lookup table may be:

[0039] That is, when a lookup table is used to describe the relationship between the comprehensive performance index and the cache time, the cache time corresponding to the comprehensive performance index can be directly obtained by looking up the table.

[0040] Step 103: Input the traffic characteristic value data set and the corresponding cache time into the neural network model for training to obtain a dynamic adjustment model.

[0041] It should be noted that when the mapping formula is used to describe the relationship between the comprehensive performance index and the cache time, the traffic characteristic value dataset and the corresponding cache time are input into the neural network model for learning and training to obtain a dynamic adjustment model of the relationship between different input parameters and the optimal cache time.

[0042] When a machine learning algorithm is used to describe the relationship between the comprehensive performance index and the cache time, since the relationship between the cache time and the comprehensive performance index generated based on the machine learning algorithm has been learned and trained, the mapping model is a dynamic adjustment model.

[0043] When a lookup table is used to describe the relationship between the comprehensive performance index and the cache time, the traffic characteristic value dataset and the corresponding cache time are input into the neural network model for learning and training, and a dynamic adjustment model of the relationship between different input parameters and the optimal cache time is obtained.

[0044] Step 104: Input the current traffic characteristic value into the dynamic adjustment model to obtain the current cache time, and apply the current cache time to the network service interface to achieve dynamic update of the cache time of the network service interface.

[0045] In a second aspect, the present invention provides a computer system, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the above methods.

[0046] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of any of the above-mentioned methods when executed by a processor.

[0047] The system and storage medium are consistent with the technical solutions of the above method and will not be described in detail here.

[0048] It should be noted that, for the above-mentioned various embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, and according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0049] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. In the several embodiments provided in this application, it should be understood that the disclosed method or system can be implemented in other ways. For example, the embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0050] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0051] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit 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 software functional units.

[0052] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

[0053] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0054] It will be easily understood by those skilled in the art that 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 protection scope of the present invention.

Claims

1. A method for dynamically adjusting cache time, characterized in that: The method comprises: Obtain the traffic data of the network service interface in real time and process it to obtain a data set of traffic characteristic values; According to the mapping model, a cache time corresponding to the traffic characteristic value data set is obtained; Inputting the traffic characteristic value data set and the corresponding cache time into a neural network model for training to obtain a dynamic adjustment model; The current traffic characteristic value is input into the dynamic adjustment model to obtain the current cache time, and the current cache time is applied to the network service interface.

2. The method for dynamically adjusting cache time according to claim 1, characterized in that: The traffic characteristic value data set includes: the total number of HTTP requests, the number of errors and the response time through the network service interface within a preset time window.

3. The method for dynamically adjusting cache time according to claim 2, characterized in that: The response time is obtained in the following manner: Each response time within a preset time window is recorded, and all recorded response times are statistically calculated to obtain the average value, median value or variance of all response times to obtain the response time.

4. The method for dynamically adjusting cache time according to claim 1, characterized in that: The mapping model is a model generated according to the relationship between the comprehensive performance index and the cache time.

5. The method for dynamically adjusting cache time according to claim 4, characterized in that: The mapping model is generated by using any one of a mapping formula, a machine learning algorithm or a lookup table to describe the relationship between the comprehensive performance index and the cache time.

6. A method for dynamically adjusting cache time according to claim 5, characterized in that: The comprehensive performance index is obtained by: The traffic characteristic value data set is obtained, and calculation is performed based on the total number of HTTP requests, the number of errors, and the response time to obtain the comprehensive performance index.

7. A method for dynamically adjusting cache time according to claim 6, characterized in that: The comprehensive performance index The calculation formula is: ; in, Indicates the number of errors passing through the network service interface in real time; Indicates the total number of HTTP requests passing through the network service interface in real time; Indicates the response time of the network service interface in real time.

8. The method for dynamically adjusting cache time according to claim 5, characterized in that: The mapping formula is: ; in, Indicates cache time; Indicates the initial cache time; Indicates the preset value; The comprehensive performance index representing the flow characteristic value in a set time period; A first preset threshold value representing a comprehensive performance index; Indicates a second preset threshold value of the comprehensive performance index.

9. A computer system comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.