Method and system for caching web interface data
Through parameter standardization and dynamic cache management, the problem of excessive database load and mixed hot and cold data in web interface data processing is solved, and the cache hit rate and system stability are improved.
Patent Information
- Application Number
- CN202510791898.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-06-13
AI Technical Summary
The traditional web interface data processing model leads to excessive database load and mixed hot and cold data, affecting system performance and stability.
Enhanced cache keys are generated through parameter standardization and weight correction, combined with the ARIMA model and graph convolution network to predict the number of accesses, dynamically adjust the cache capacity to realize adaptive cache management.
Improve cache hit rate, reduce memory overflow risk, reduce response time fluctuations, and improve system stability and efficiency.
Smart Images

Figure CN120301946A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of Internet and caching technologies, and particularly to a method and system for caching web interface data. Background Art
[0002] With the rapid development of Internet technology, the user scale and data volume of Web applications have shown exponential growth. In high-concurrency scenarios, the interface response speed and system stability have become the core indicators of user experience. However, the traditional data processing mode relies on direct access to the database, resulting in the following problems becoming increasingly prominent.
[0003] Excessive database load: Frequent query operations make the database a performance bottleneck. According to statistics, in a system without caching, a single user request may trigger dozens of database I / O operations. In high-concurrency scenarios, the database connection pool is exhausted, the response latency surges, and even service avalanches may occur.
[0004] Mixture of hot and cold data: Full caching on the server side causes data with low-frequency access to occupy the cache space for a long time, reducing memory utilization. Summary of the Invention
[0005] In view of the above situation, the main purpose of the present invention is to propose a method and system for caching web interface data to solve the above technical problems.
[0006] The present invention proposes a method for caching web interface data, and the method includes the following steps: Step 1: Aggregate the Query parameters of the HTTP request into a parameter set; Perform standardization processing on the parameter set to obtain standardized parameters; Perform weight correction on the standardized parameters to obtain an enhanced cache key; Step 2: Retrieve cached data matching the enhanced cache key in the client cache; If the match is successful, update and output the last access timestamp of the matched cached data; If the match is not successful, generate a cache hit signal; Step 3: After the server side receives the cache hit signal, record the average response time; Calculate the maximum cache capacity based on the average response time and the current available memory; Based on the maximum cache capacity, combine the real-time network latency and the maximum tolerable latency to obtain a dynamically adjusted cache capacity upper limit after network latency compensation; Obtain the final cache capacity upper limit through the dynamically adjusted cache capacity upper limit after network latency compensation and the current available memory; Judge the current total cache volume on the server side according to the upper limit of the final cache capacity. When the current total cache volume on the server side does not exceed the upper limit of the final cache capacity, execute the cache write instruction; Step 4: When the current total cache volume on the server side exceeds the upper limit of the final cache capacity, obtain the predicted access times through the ARIMA model; Feed back the prediction result to the server side and dynamically adjust the upper limit of the final cache capacity to obtain the dynamically adjusted upper limit of the final cache capacity; Step 5: Obtain the enhanced value of the cache data based on the predicted access times and the last access timestamp; Judge the cache data according to the enhanced value, perform data elimination, and then generate an elimination result; Feed back the elimination result to the server side and readjust the upper limit of the final cache capacity.
[0007] The present invention also proposes a system for caching web interface data, and the system includes: A parameter processing module for: Aggregate the Query parameters of the HTTP request into a parameter set; Perform standardization processing on the parameter set to obtain standardized parameters; Perform weight correction on the standardized parameters to obtain an enhanced cache key; A data matching module for: Retrieve cache data matching the enhanced cache key in the client cache; If the match is successful, update and output the last access timestamp of the matched cache data; If the match fails, generate a cache hit signal; An adaptive capacity module for: After the server side receives the cache hit signal, record the average response time; Calculate the maximum cache volume through the average response time and the current available memory; Based on the maximum cache volume, combine the real-time network latency and the maximum tolerance latency to obtain a dynamically adjusted cache capacity upper limit after network latency compensation; Obtain the upper limit of the final cache capacity through the dynamically adjusted cache capacity upper limit after network latency compensation and the current available memory; Judge the current total cache volume on the server side according to the upper limit of the final cache capacity. When the current total cache volume on the server side does not exceed the upper limit of the final cache capacity, execute the cache write instruction; A prediction module for: When the current total cache volume on the server side exceeds the upper limit of the final cache capacity, obtain the predicted access times through the ARIMA model; Feed the prediction result back to the server side and dynamically adjust the upper limit of the final cache capacity to obtain the dynamically adjusted upper limit of the final cache capacity; A cache value evaluation module, configured to: Obtain the enhanced value of the cache data based on the predicted access times and the last access timestamp; Judge the cache data according to the enhanced value, perform data elimination, and then generate an elimination result; Feed the elimination result back to the server side to readjust the upper limit of the final cache capacity.
[0008] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The present invention sorts the parameter key values by ASCII code through a parameter standardization hash algorithm to generate a unique identifier with a fixed length, thereby improving the cache hit rate; 2. The present invention reduces the risk of memory overflow by real-time monitoring of the available memory and setting a safety threshold; 3. The present invention dynamically adjusts the upper limit of the capacity according to the average response time, narrowing the fluctuation range of the response time. Description of the Drawings
[0009] Figure 1 is a flowchart of a method for web interface data caching proposed by the present invention; Figure 2 is a framework diagram of a system for web interface data caching proposed by the present invention. Detailed Embodiments
[0010] The embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention.
[0011] Referring to the following description and drawings, these and other aspects of the embodiments of the present invention will be clear. In these descriptions and drawings, some specific embodiments of the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0012] Please refer to Figure 1 , an embodiment of the present invention proposes a method for web interface data caching, and the method includes the following steps: Step 1: Aggregate the Query parameters of the HTTP request into a parameter set; Perform standardization processing on the parameter set to obtain standardized parameters; Perform weight correction on the standardized parameters to obtain an enhanced cache key; In step 1, the Query parameters of the HTTP request are aggregated into a parameter set, and the relational expression existing in the corresponding process is: ; Among them, represents the parameter set, both represent the keys of the parameters, both represent the values corresponding to the parameter keys, represents the total number of Query parameters; Perform standardization processing on the parameter set to obtain standardized parameters, and the relational expression existing in the corresponding process is: ; Among them, represents the standardized function processing, represents the processing after the sorting function, both represent the keys of the standardized parameters, both represent the values corresponding to the keys of the standardized parameters; Perform weight correction on the standardized parameters to obtain an enhanced cache key, and the relational expression existing in the corresponding process is: ; Among them, represents the enhanced cache key, represents the processing after the SHA-256 hash algorithm, represents the index of the standardized parameter, represents the contribution degree corresponding to the standardized parameter when the cache is hit, represents the th key of the standardized parameter, represents the th value corresponding to the key of the standardized parameter.
[0013] Step 2, retrieve the cache data matching the enhanced cache key in the client cache; If the match is successful, update and output the last access timestamp of the matched cache data; If the match is not successful, generate a cache hit signal.
[0014] Step 3, after the server side receives the cache hit signal, record the average response time; Calculate the maximum cache capacity based on the average response time and the current available memory; Based on the maximum cache capacity, combined with the real-time network delay and the maximum tolerable delay, obtain the upper limit of the dynamic cache capacity after network delay compensation; Obtain the final cache capacity upper limit based on the dynamic cache capacity upper limit after network delay compensation and the current available memory; Judge the current total cache on the server side according to the final cache capacity upper limit. When the current total cache on the server side does not exceed the final cache capacity upper limit, execute the cache write instruction; In step 3, calculate the maximum cache amount through the average response time and the current available memory. The relationship in the corresponding process is: ; Among them, represents the maximum cache amount, represents the memory health coefficient at time represents the current available memory, represents the response time weight factor at time represents the average response time, represents the memory health coefficient at time represents the response time weight factor at time represents the cache hit rate at time represents processed through the Q-learning algorithm; Based on the maximum cache amount, combined with the real-time network delay and the maximum tolerance delay, obtain the dynamic cache capacity upper limit after network delay compensation. The specific steps are as follows: Collect the delay data of the server at different time periods to construct a network delay spatio-temporal matrix. The relationship in the corresponding process is: ; Among them, represents the network delay spatio-temporal matrix, represents the th network delay of the th server node in the th time period, represents the total length of the time period, ; Among them, represents the predicted delay matrix, represents the prediction process through the graph convolutional network, represents the topological relationship matrix; The predicted network latency is obtained based on the prediction delay matrix. By combining the real-time network latency and the maximum tolerable latency, the upper limit of the dynamic cache capacity after network latency compensation is obtained. The relational formula for the corresponding process is as follows: ; Among them, represents the upper limit of the dynamic cache capacity after network latency compensation, represents the real-time network latency, represents the maximum tolerable latency, represents the predicted network latency; The final cache capacity upper limit is obtained through the upper limit of the dynamic cache capacity after network latency compensation and the current available memory. Among them, the relational formula at the macro level is as follows: ; Among them, represents the final cache capacity upper limit, represents the total system memory, represents the system comprehensive load; represents the load safety threshold, that is, the maximum load critical value that the system can withstand; represents the load sensitivity factor. The larger this value is, the faster the capacity shrinks when the load exceeds the threshold; At the micro level, the relational formula is as follows: ; Among them, represents the cache value density, that is, the data value efficiency per unit cache space; represents the current number of cache entries, represents the enhanced value of the th cache data,
[0015] In this step, in the graph convolutional network GCN, spatial convolution is used to aggregate adjacent node latencies, and temporal convolution is used to extract temporal features.
[0016] In this step, the macro level represents the system level, and the micro level represents the data level; At the micro level, when the cache value density is lower than the cache value density threshold , active elimination of low-value data is triggered instead of passive expansion.
[0017] Step 4: When the current total cache on the server side exceeds the upper limit of the final cache capacity, the predicted access times are obtained through ARIMA model prediction; The prediction result is fed back to the server side and the upper limit of the final cache capacity is dynamically adjusted to obtain the dynamically adjusted upper limit of the final cache capacity; In step 4, when the current total cache on the server side exceeds the upper limit of the final cache capacity, the predicted access times are obtained through ARIMA model prediction, and the relational expression existing in the corresponding process is: ; Wherein, represents the predicted access times, represents being processed through ARIMA model prediction, represents the prediction time.
[0018] Step 5: Obtain the enhanced value of the cache data based on the predicted access times and the last access timestamp; Judge the cache data according to the enhanced value, and perform data elimination, and then generate an elimination result; Feed back the elimination result to the server side, and readjust the upper limit of the final cache capacity; The enhanced value of the cache data is obtained based on the predicted access times and the last access timestamp, and the relational expression existing in the corresponding process is: ; Wherein, represents the enhanced value, and both represent dynamic weight coefficients, represents the current access times, represents the total access times, represents the current timestamp, represents the last access timestamp, represents the preset expiration timestamp, represents the adjustment coefficient for controlling the load sensitivity.
[0019] Furthermore, in this step, the generated elimination result includes the actual elimination rate. When the actual elimination rate is higher than the mis-elimination rate threshold, the adjustment coefficient for controlling the load sensitivity is automatically adjusted, and the relational expression existing in the corresponding process is: ; Wherein, represents the adjusted adjustment coefficient for controlling the load sensitivity, represents the adjustment coefficient for controlling the load sensitivity before adjustment, represents the actual elimination rate; The mis-elimination rate is obtained by dividing the number of data reloading by the total number of eliminations.
[0020] Please refer to Figure 2 , an embodiment of the present invention also provides a system for caching web interface data, and the system includes: A parameter processing module, used for: Aggregate the Query parameters of the HTTP request into a parameter set; Perform normalization processing on the parameter set to obtain normalized parameters; Perform weight correction on the normalized parameters to obtain an enhanced cache key; Data matching module, used for: Retrieve cached data matching the enhanced cache key in the client cache; If the match is successful, update and output the last access timestamp of the matched cached data; If the match is unsuccessful, generate a cache hit signal; Adaptive capacity module, used for: After the server side receives the cache hit signal, record the average response time; Calculate the maximum cache capacity based on the average response time and the current available memory; Based on the maximum cache capacity, combine the real-time network latency and the maximum tolerable latency to obtain the dynamic cache capacity upper limit after network latency compensation; Obtain the final cache capacity upper limit through the dynamic cache capacity upper limit after network latency compensation and the current available memory; Judge the current total cache volume on the server side according to the final cache capacity upper limit. When the current total cache volume on the server side does not exceed the final cache capacity upper limit, execute the cache write instruction; Prediction module, used for: When the current total cache volume on the server side exceeds the final cache capacity upper limit, obtain the predicted access times through ARIMA model prediction; Feed back the prediction result to the server side and dynamically adjust the final cache capacity upper limit to obtain the dynamically adjusted final cache capacity upper limit; Cache value evaluation module, used for: Obtain the enhanced value of the cached data based on the predicted access times and the last access timestamp; Judge the cached data according to the enhanced value, perform data elimination, and then generate an elimination result; Feed back the elimination result to the server side and readjust the final cache capacity upper limit.
[0021] It should be understood that each part of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
[0022] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0023] The above-described embodiments merely represent several implementation manners of the present invention, and the description thereof is relatively specific and detailed. However, it should not be construed as a limitation on the scope of the patent of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the appended claims.
Claims
1. A method for web interface data caching, characterized in that The method includes the following steps: Step 1: Aggregate the Query parameters of the HTTP request into a parameter set; Perform standardization processing on the parameter set to obtain standardized parameters; Perform weight correction on the standardized parameters to obtain an enhanced cache key; Step 2: Retrieve cached data that matches the enhanced cache key in the client cache; If the match is successful, update and output the last access timestamp of the matched cached data; If the match is not successful, generate a cache hit signal; Step 3: After the server side receives the cache hit signal, record the average response time; Calculate the maximum cache capacity based on the average response time and the current available memory; Based on the maximum cache capacity, combine the real-time network latency and the maximum tolerable latency to obtain the upper limit of the dynamic cache capacity after network latency compensation; Obtain the final cache capacity upper limit through the upper limit of the dynamic cache capacity after network latency compensation and the current available memory; Judge the current total cache volume on the server side according to the final cache capacity upper limit. When the current total cache volume on the server side does not exceed the final cache capacity upper limit, execute the cache write instruction; Step 4: When the current total cache volume on the server side exceeds the final cache capacity upper limit, obtain the predicted access times through ARIMA model prediction; Feed back the prediction result to the server side and dynamically adjust the final cache capacity upper limit to obtain the dynamically adjusted final cache capacity upper limit; Step 5: Obtain the enhanced value of the cached data based on the predicted access times and the last access timestamp; Judge the cached data according to the enhanced value, perform data elimination, and then generate an elimination result; Feed back the elimination result to the server side and readjust the final cache capacity upper limit.
2. The method for web interface data caching according to claim 1, wherein In the said Step 1, when aggregating the Query parameters of the HTTP request into a parameter set, the relational expression existing in the corresponding process is: ; Among them, represents a parameter set, both represent the keys of the parameters, both represent the values corresponding to the parameter keys, represents the total number of Query parameters.
3. A method for web interface data caching according to claim 2, characterized in that, In the said Step 1, when performing standardization processing on the parameter set to obtain standardized parameters, the relational expression existing in the corresponding process is: ; Among them, represents the processing by the normalization function, represents the processing by the sorting function, both represent the keys of the normalization parameters, both represent the values corresponding to the keys of the normalization parameters.
4. A method for web interface data caching according to claim 3, characterized in that, In the said Step 1, when performing weight correction on the standardized parameters to obtain an enhanced cache key, the relational expression existing in the corresponding process is: ; Among them, represents an enhanced cache key, represents being processed by the SHA-256 hashing algorithm, represents the index of a normalized parameter, represents the contribution corresponding to the normalized parameter when a cache hit occurs, represents the key of the th normalized parameter, represents the value corresponding to the key of the th normalized parameter.
5. A method for web interface data caching according to claim 4, characterized in that In the said Step 3, when calculating the maximum cache capacity based on the average response time and the current available memory, the relational expression existing in the corresponding process is: ; Among them, represents the maximum cache capacity, represents the memory health coefficient at time represents the current available memory amount, represents the response time weight factor at time represents the average response time, represents the memory health coefficient at time represents the response time weight factor at time represents the cache hit rate at time represents being processed by the Q-learning algorithm.
6. A method for web interface data caching according to claim 5, characterized in that, In the said Step 3, based on the maximum cache capacity, combining the real-time network latency and the maximum tolerable latency to obtain the upper limit of the dynamic cache capacity after network latency compensation, the specific steps are as follows: Collect the latency data of the server at different time periods to construct a network latency spatio-temporal matrix, and the relational expression existing in the corresponding process is: ; Among them, represents the network latency spatio-temporal matrix, represents the th time period and the th network latency of the server node, represents the total length of the time period, represents the total number of server nodes; Based on the network latency spatio-temporal matrix, use the graph convolutional network to predict the predicted latency matrix, and the relational expression existing in the corresponding process is: ; Among them, represents the prediction delay matrix, represents the prediction processing by the graph convolutional network, represents the topological relationship matrix; Based on the predicted latency matrix to obtain the predicted network latency, combine the real-time network latency and the maximum tolerable latency to obtain the upper limit of the dynamic cache capacity after network latency compensation, and the relational expression existing in the corresponding process is: ; Among them, represents the upper limit of the dynamic cache capacity after network delay compensation, represents the real-time network delay, represents the maximum tolerable delay, represents the predicted network delay.
7. A method for web interface data caching according to claim 6, characterized in that, In the said Step 3, when obtaining the final cache capacity upper limit through the upper limit of the dynamic cache capacity after network latency compensation and the current available memory, the relational expression existing in the macroscopic layer is: ; Among them, represents the upper limit of the final cache capacity, represents the total memory of the system, represents the comprehensive load of the system, represents the load safety threshold, represents the load sensitivity factor; In the microscopic layer, the relational expression is: ; Among them, represents the cache value density, represents the current number of cache entries, represents the enhanced value of the th cache data, and represents the total cache size.
8. A method for web interface data caching according to claim 7, characterized in that, In step 4, when the total current cache on the server side exceeds the upper limit of the final cache capacity, the predicted access times are obtained through the ARIMA model. The relational expression existing in the corresponding process is as follows: ; Among them, represents the predicted number of accesses, represents being processed by the ARIMA model prediction, represents the prediction time.
9. A method for web interface data caching according to claim 8, wherein In step 5, the enhanced value of the cache data is obtained based on the predicted access times and the last access timestamp. The relational expression existing in the corresponding process is as follows: ; Among them, represents the enhanced value, and both represent the dynamic weight coefficient, represents the current access count, represents the total access count, represents the current timestamp, represents the last access timestamp, represents the preset expiration timestamp, represents the adjustment coefficient for controlling the load sensitivity.
10. A system for web interface data caching, characterized in that, The system applies any one of the methods for web interface data caching in claims 1 to 9. The system includes: A parameter processing module, configured to: Aggregate the Query parameters of the HTTP request into a parameter set; Perform normalization processing on the parameter set to obtain normalized parameters; Perform weight correction on the normalized parameters to obtain an enhanced cache key; A data matching module, configured to: Retrieve cache data matching the enhanced cache key in the client cache; If the match is successful, update and output the last access timestamp of the matched cache data; If the match is not successful, generate a cache hit signal; An adaptive capacity module, configured to: After the server side receives the cache hit signal, record the average response time; Calculate the maximum cache capacity through the average response time and the current available memory; Based on the maximum cache capacity, combine the real-time network latency and the maximum tolerable latency to obtain the dynamic cache capacity upper limit after network latency compensation; Obtain the final cache capacity upper limit through the dynamic cache capacity upper limit after network latency compensation and the current available memory; Judge the total current cache on the server side according to the final cache capacity upper limit. When the total current cache on the server side does not exceed the final cache capacity upper limit, execute the cache write instruction; A prediction module, configured to: When the total current cache on the server side exceeds the final cache capacity upper limit, obtain the predicted access times through the ARIMA model; Feed the prediction result back to the server side and dynamically adjust the final cache capacity upper limit to obtain the dynamically adjusted final cache capacity upper limit; A cache value evaluation module, configured to: Obtain the enhanced value of the cache data based on the predicted access times and the last access timestamp; Judge the cache data according to the enhanced value, perform data elimination, and then generate an elimination result; Feed the elimination result back to the server side to readjust the final cache capacity upper limit.
Citation Information
Patent Citations
Method and equipment for managing hybrid cache
CN104090852A
Data storage optimization method
CN104298475A
Dynamic hot data caching method
CN111752902A
Method and system for realizing consistency of distributed multi-level caches of industrial data
CN118820133A
Cache elimination method based on frequency driving
CN119357088A