Front-end performance optimization method and system based on cache management and electronic equipment

By analyzing user behavior and data access patterns and dynamically adjusting cache strategies, the problem of insufficient cache management in the existing technology is solved, efficient and intelligent front-end cache management is achieved, and user experience and system performance is improved.

CN119311977APending Publication Date: 2025-01-14BUBI (BEIJING) NETWORK TECH CO LTD
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202411343954.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Existing cache management technologies cannot dynamically adjust based on users' real-time behavior and resource usage, resulting in low cache hit rate, unable to promptly reflect the latest status of resources, affecting user experience, and unable to meet the performance needs in complex and changing business scenarios.

Method used

By collecting and analyzing user behavior data, building user behavior models and prediction models, dynamically generate cache policies, and storing resources on the client, server and CDN nodes, cross-platform cache management is realized, based on the importance of resources and access frequency Optimize storage and access paths.

Benefits of technology

It significantly improves cache hit rate, reduces user waiting time, improves page loading speed and application responsiveness, reduces operational costs, and enhances system stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311977A_ABST
    Figure CN119311977A_ABST
Patent Text Reader

Abstract

The invention provides a front-end performance optimization method based on cache management, and the method comprises the steps: S1, collecting and processing user behavior data, and obtaining target data; s2, analyzing a user behavior based on the target data, constructing a user behavior model, and predicting an access demand of a user by using a prediction algorithm to obtain a prediction model; s3, generating a caching strategy based on the user behavior model and the prediction model; and S4, storing resources on the client, the server and the content distribution network node based on the caching strategy. The cache hit rate is improved; the caching strategy is dynamically adjusted according to the actual use condition of the user, and the user requirement is more accurately met; the cache preloading mechanism can shorten the response time of the user request, can adapt to different user behaviors, and improves the user experience. The system and the electronic equipment provided by the invention have corresponding advantages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a front-end performance optimization method and system based on cache management and corresponding electronic equipment. Background Art

[0002] With the rapid development of Internet technology, the performance of front-end applications has become one of the key factors affecting user experience. In the current Internet environment, users have increasing requirements for page loading speed and data interaction efficiency. However, the loading and processing of data in front-end development often takes up a lot of time and resources, resulting in problems such as slow page loading and response delays, which seriously restricts the improvement of user experience. In order to improve the performance of front-end applications, the industry has proposed a variety of cache management technologies, including browser cache, server cache, CDN cache, and database cache. The above-mentioned prior art is briefly described as follows: 1. Browser cache: The browser will automatically cache visited web page resources, such as HTML, CSS, JavaScript, and pictures. By setting appropriate cache policies (such as HTTP headers such as Expires and Cache-Control), the validity period and update method of the cache can be controlled. 2. Server cache: The server side can use cache to store frequently accessed resources and reduce requests to databases or back-end services. Common server cache technologies include Nginx cache, Redis, etc. 3. CDN cache: Content distribution network (CDN) deploys servers around the world to cache static resources of websites, allowing users to obtain data from the server closest to them, thereby improving loading speed. 4. Database cache: At the database level, cache can be used to store query results or frequently used data to reduce direct access to the database.

[0003] These technologies have alleviated the pressure of resource loading and data processing to a certain extent, but there are still many shortcomings. Specifically, there are the following aspects: resource compression and merging cannot solve the problem of managing a large amount of dynamic content; although CDN can increase the speed of resource loading, it causes resource waste for infrequently used resources; traditional caching strategies are usually statically set, not flexible enough, and cannot be dynamically adjusted according to users' real-time behavior and resource usage.

[0004] It can be seen that since the cache strategy is relatively static and cannot be dynamically adjusted according to the user's real-time behavior and resource usage, the cache hit rate is low and unnecessary network requests cannot be effectively reduced; traditional cache strategies often have delays when resources are updated and cannot reflect the latest status of resources in a timely manner, affecting the user experience; when faced with complex and changing business scenarios, the existing cache management technology cannot meet the growing performance requirements.

[0005] Therefore, there is an urgent need to develop a front-end performance optimization method based on cache management and corresponding electronic equipment, and to develop a more efficient and intelligent front-end cache management solution to achieve front-end performance optimization, thereby continuously improving user experience and system performance, reducing operating costs, and enhancing system stability, thereby promoting the comprehensive development of computer technology. Summary of the invention

[0006] The present invention is to solve all or part of the problems of the above-mentioned prior art. On the one hand, the present invention proposes a front-end performance optimization method based on cache management, which dynamically adjusts the cache strategy based on user behavior analysis and business scenario understanding, improves the cache hit rate, ensures the real-time and consistency of cache data, and realizes more efficient and intelligent front-end cache management. The present invention also provides a front-end performance optimization system based on cache management and corresponding electronic equipment.

[0007] On one hand, the present invention provides a front-end performance optimization method based on cache management, including: step S1. collecting and processing user behavior data to obtain target data; step S2. analyzing user behavior based on the target data, building a user behavior model, and using a prediction algorithm to predict the user's access needs to obtain a prediction model; step S3. generating a cache strategy based on the user behavior model and the prediction model; step S4. storing resources on the client, server and content distribution network (CDN) node based on the cache strategy; wherein the user behavior data characterizes page loading information and user interaction behavior, including page loading time, loading order, resource loading time, click events, scrolling behavior and form interaction data; the cache strategy includes cache time, storage location and type of cached data.

[0008] By comprehensively collecting page loading information and user interaction behavior data, we have achieved in-depth analysis of user behavior and predicted user access needs based on this. We have considered the selection of cache content, as well as the timeliness of the cache and the optimization of the storage location, and developed a multi-dimensional, cross-platform cache strategy. We dynamically adjust the cache content according to user behavior, avoid the waste of invalid cache, improve the utilization rate of cache resources, significantly reduce user waiting time, and improve page loading speed and application responsiveness. We apply cache strategies to multiple levels such as the client, server, and CDN nodes to achieve cross-platform cache management. We can optimize resource storage and access paths based on the importance and access frequency of resources, improve the system's response speed and stability, which not only improves the performance of front-end applications, but also further improves the user experience.

[0009] In some embodiments, the step S4 includes: establishing a long connection between the client and the server, synchronizing the cache status in real time; and processing the cache data using a distributed data indexing algorithm.

[0010] In some embodiments, in step S1, the method for collecting the user behavior data includes using a front-end interaction monitoring tool to capture the user's operating behavior on the client; dynamically adjusting the sampling frequency according to the system load and user traffic; performing data deduplication processing; and encoding the collected user behavior data in a lightweight data exchange format, and then transmitting it from the client to the server for storage.

[0011] In some embodiments, the method for obtaining the target data in step S1 includes deleting duplicate data and invalid data; converting data of different dimensions into the same dimension; and detecting and processing abnormal data.

[0012] In some embodiments, in step S2, the method for analyzing user behavior includes: presetting the number of clusters, grouping the target data by a clustering algorithm (such as K-means, DBSCAN, etc.), identifying user groups with similar behavioral characteristics, and obtaining clustering results.

[0013] In a specific embodiment, based on the clustering results, the user behavior model is constructed using a machine learning algorithm (such as a decision tree, random forest, support vector machine, neural network, etc.).

[0014] In some embodiments, the method for obtaining the prediction model includes: determining the prediction algorithm based on the user behavior model.

[0015] In some embodiments, the method for generating the caching strategy includes: analyzing the user behavior model to identify the user's access patterns, preferences and behavior trends; predicting the user's access behavior and resource requirements by the prediction model; defining high-frequency access resources and low-frequency access resources, and classifying cached data; setting the caching strategy based on the classification results; the caching strategy includes cache time, storage location (local cache, server cache, CDN cache, etc.).

[0016] In a specific embodiment, the method for generating the cache strategy includes: real-time monitoring and evaluating cache indicators; iteratively optimizing the cache strategy based on the monitoring and evaluation results; wherein the cache indicators include cache hit rate, response time, and resource utilization.

[0017] On the other hand, the present invention provides a front-end performance optimization system based on cache management, which is used to execute the front-end performance optimization method based on cache management of one aspect of the present invention, including: a user behavior analysis module, configured to collect and process user behavior data to obtain target data; an intelligent cache decision module, configured to analyze user behavior based on the target data, build a user behavior model, and use a prediction algorithm to predict the user's access needs to obtain a prediction model, and generate a cache strategy based on the user behavior model and the prediction model; a cache management module, configured to store resources on the client, server and content distribution network (CDN) node based on the cache strategy; wherein the user behavior data characterizes page loading information and user interaction behavior, including page loading time, loading order, resource loading time, click events, scrolling behavior and form interaction data; the cache strategy includes cache time, storage location and type of cached data.

[0018] The system architecture adopts a modular design, dividing the key functions into user behavior analysis module, intelligent cache decision module, cache management module and cache status synchronization module. The modules work closely together through data interfaces and communication protocols to jointly optimize the front-end performance. The user behavior analysis, intelligent cache decision, cache management and status synchronization functions are separated into modules, and the modules interact with each other through clear interfaces, which reduces the complexity of the system, improves the maintainability and scalability of the system, and enhances the overall performance and user experience of the system.

[0019] In some embodiments, the front-end performance optimization system based on cache management also includes: a cache status synchronization module, which is configured to establish a long connection between the client and the server, and synchronize the cache status in real time; and use a distributed data indexing algorithm to process the cache data.

[0020] In a specific embodiment, the cache status synchronization module includes: a status synchronization submodule, configured to synchronize the cache status in real time between the client and the server via a duplex communication protocol; a consistency maintenance submodule configured to manage the cache data distribution using a consistent hashing mechanism.

[0021] In some embodiments, the user behavior analysis module includes: a data collection submodule, configured to automatically capture and record the user behavior data by client-side scripting technology during the process of user interaction with the web page; a data transmission submodule, configured to transmit the target data from the client to the server by asynchronous communication technology; and a data storage submodule, configured to use a non-relational database to store user behavior data on the server.

[0022] In some embodiments, the intelligent cache decision module includes: a behavior analysis submodule, which is configured to preset the number of clusters, and uses a clustering algorithm to group the target data, identify user groups with similar behavioral characteristics, and obtain clustering results; based on the clustering results, the user behavior model is constructed using a machine learning algorithm; a strategy generation submodule, which is configured to automatically generate the cache strategy according to the user behavior model; a strategy optimization submodule, which is configured to monitor and evaluate cache indicators in real time; and iteratively optimize the cache strategy according to the monitoring and evaluation results; wherein the cache indicators include cache hit rate, response time, and resource utilization.

[0023] In some embodiments, the cache management module includes: a local cache management submodule, configured to use browser-side storage technology to store cache data; a server cache management submodule, configured to use a high-performance memory database to cache high-frequency access resources; and a CDN cache management submodule, configured to use content distribution network (CDN) technology to cache static resources at multiple nodes.

[0024] On the other hand, the present invention provides an electronic device, comprising a memory, a processor, and one or more computer programs, wherein the computer program is stored in the memory and is configured to be executed by several of the processors to execute the front-end performance optimization method based on cache management provided on the one hand of the present invention.

[0025] Compared with the prior art, the main beneficial effects of the present invention are:

[0026] 1. The present invention provides a front-end performance optimization method based on cache management, which deeply analyzes user behavior and data access patterns, dynamically formulates and optimizes cache strategies, improves cache hit rates and system performance, reduces unnecessary network requests, and realizes personalized configuration and efficient utilization of cache resources, thereby continuously improving user experience.

[0027] 2. The present invention provides a front-end performance optimization system based on cache management. By implementing a cache hierarchical storage strategy, it reasonably allocates resources on the client, server and CDN nodes according to their importance and frequency of use, thereby improving resource utilization efficiency; closely combining user behavior analysis with resource usage, it achieves more accurate cache decisions and enhances the effectiveness of the cache; introduces a cache preloading mechanism to predict user behavior and load resources in advance, thereby improving user experience; the client and server collaborate and synchronize the cache status in real time to ensure overall performance and high reliability.

[0028] 3. The electronic device provided by the present invention can automatically implement the front-end performance optimization method based on cache management of the present invention, has corresponding advantages, and is conducive to further promotion in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A schematic diagram of a front-end performance optimization method based on cache management according to an embodiment of the present invention.

[0030] Figure 2 Schematic diagram of a front-end performance optimization system based on cache management according to an embodiment of the present invention.

[0031] Figure 3 Schematic diagram of the system architecture of an embodiment of the present invention.

[0032] Figure 4 The figure is a schematic diagram of the intelligent cache decision process according to an embodiment of the present invention.

[0033] Figure 5 Schematic diagram of the operation of the user behavior analysis module according to an embodiment of the present invention.

[0034] Figure 6 Schematic diagram of the operation of the cache management module according to an embodiment of the present invention.

[0035] Figure 7 Schematic diagram of a cache preloading mechanism according to an embodiment of the present invention.

[0036] Figure 8 Schematic diagram of cache invalidation and update strategy according to an embodiment of the present invention.

[0037] Fig. 9 Schematic diagram of synchronous cache state according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The technical solutions in the specific embodiments of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.

[0039] The present invention illustrates, through the following embodiments, that the present invention relates to a front-end performance optimization method, system and electronic device based on cache management, which improves the cache hit rate: by intelligently analyzing user behavior and data access patterns, a more reasonable cache strategy is formulated, which greatly improves the cache hit rate, reduces redundant network requests, reduces server load, and improves page loading speed; dynamic cache management: dynamically adjusts the cache strategy according to the actual usage of the user to more accurately meet the user's needs; improves user experience: the cache preloading mechanism can shorten the response time of user requests and improve user experience; and adapts to different user behaviors: the system can adjust the cache strategy according to the behavior patterns of different users to achieve personalized optimization.

[0040] The front-end performance optimization method based on cache management provided in this embodiment can be implemented by the electronic device of this embodiment. The example electronic device includes a memory, a processor, and one or more computer programs, wherein the computer program is stored in the memory and is configured to be executed by one or more processors. The specific front-end performance optimization method based on cache management provided in this embodiment.

[0041] The overall technical solution provided in the embodiment optimizes the front-end performance through intelligent cache management, which is suitable for application scenarios that require fast response, high concurrent access and high requirements for user experience, including but not limited to: e-commerce, news, social networking, online education, financial services and other Internet application scenarios, by reducing data request delays and increasing resource loading speed, significantly improving user experience and overall system performance. Specific situations are not limited here.

[0042] For example: Personalized cache optimization of user A on an e-commerce website: When user A frequently browses the product detail page of an e-commerce website, the system intelligently identifies his access pattern, and implements a strategy to extend the cache time to 24 hours, especially for the product images and detail data that user A frequently accesses. This optimization measure significantly reduces unnecessary server requests, and by storing cached data in the client's IndexedDB, it enables fast data access, bringing a smooth shopping experience to user A. Intelligent preloading optimization of news websites: When user B first enters a news website, the system uses its advanced user behavior prediction model to predict the content that the user is interested in, and preloads key resources on the homepage such as images and CSS files. These preloaded resources are efficiently distributed through content delivery network (CDN) nodes around the world, ensuring that the page can be presented instantly when user B actually initiates the visit, greatly improving the user's first visit satisfaction and page loading speed. Systematic cache optimization strategy during peak hours: Facing the peak of visits during shopping festivals, the system shows a high degree of intelligence and flexibility. The system monitors the trend of increasing server load in real time, responds quickly and adjusts the cache strategy, and pushes the static resources of the website's core pages such as the homepage and promotional pages to the local cache and CDN cache first. This forward-looking layout effectively reduces the processing pressure on the server, ensuring that even in the case of a surge in traffic, users can quickly obtain the required resources from the nearest cache node, ensuring the overall stability of the system and the continuity of user experience.

[0043] refer to Figure 1As shown, a front-end performance optimization method based on cache management is exemplified in an embodiment of the present invention, comprising: step S1. collecting and processing user behavior data to obtain target data; step S2. analyzing user behavior based on the target data, building a user behavior model, and using a prediction algorithm to predict the user's access needs to obtain a prediction model; step S3. generating a cache strategy based on the user behavior model and the prediction model; wherein the user behavior data characterizes page loading information and user interaction behavior, including page loading time, loading order, resource loading time, click events, scrolling behavior and form interaction data; the cache strategy includes cache time, storage location and type of cached data.

[0044] In some embodiments, step S4 includes: establishing a long connection between the client and the server, synchronizing the cache status in real time; and processing the cache data using a distributed data indexing algorithm.

[0045] By implementing the long connection technology, the real-time synchronization of the cache status between the client and the server is achieved, and data consistency is enhanced. At the same time, the introduction of the distributed data indexing algorithm can efficiently process the cache data, which improves the data retrieval speed and system scalability. These improvements make the formulation of cache strategies more precise, thereby improving the cache hit rate and overall system performance. It further reduces the time delay for users to obtain resources and enhances the stability, reliability and maintainability of the system, taking into account the needs of future business growth.

[0046] In some embodiments, in step S1, the method for collecting user behavior data includes: using a front-end interaction monitoring tool to capture the user's operation behavior on the client; dynamically adjusting the sampling frequency according to the system load and user traffic; performing data deduplication processing; and encoding the collected user behavior data in a lightweight data exchange format, and then transmitting it from the client to the server for storage. This further improves the accuracy and efficiency of data collection, reduces the burden of data transmission, and enhances the flexibility and responsiveness of the system, providing more reliable and comprehensive data support for subsequent cache strategy formulation.

[0047] In some embodiments, the method for obtaining target data in step S1 includes deleting duplicate data and invalid data; converting data of different dimensions into the same dimension; and detecting and processing abnormal data. This further improves the accuracy and availability of data, lays a solid foundation for building more accurate user behavior models and prediction models, and thus enhances the pertinence and effectiveness of the cache strategy.

[0048] In some embodiments, in step S2, the method for analyzing user behavior includes: presetting the number of clusters, grouping the target data by a clustering algorithm (such as K-means, DBSCAN, etc.), identifying user groups with similar behavioral characteristics, and obtaining clustering results.

[0049] In a specific embodiment, based on the clustering results, a user behavior model is constructed using a machine learning algorithm (such as a decision tree, random forest, support vector machine, neural network, etc.).

[0050] In some embodiments, the method for obtaining a prediction model includes: determining a prediction algorithm based on a user behavior model.

[0051] In specific examples, the precision of user behavior analysis and the accuracy of prediction models are further improved, so that cache strategies can more accurately match actual user needs, thereby continuously improving cache efficiency and user experience.

[0052] In some embodiments, the method for generating a caching strategy includes: identifying a user's access patterns, preferences, and behavior trends through user behavior model analysis; predicting a user's access behavior and resource requirements through a prediction model; defining high-frequency access resources and low-frequency access resources, and classifying cached data; setting a caching strategy based on the classification results; the caching strategy includes caching time, storage location (local cache, server cache, CDN cache, etc.).

[0053] In a specific embodiment, the method for generating a cache strategy includes: real-time monitoring and evaluating cache indicators; iteratively optimizing the cache strategy according to the monitoring and evaluation results; wherein the cache indicators include cache hit rate, response time, and resource utilization rate. This further improves the adaptability and efficiency of the cache strategy and ensures efficient use of cache resources.

[0054] The following reference Figure 1 , the implementation steps are specifically exemplified as follows: In the process of collecting user behavior data, first use the front-end customized JavaScript script to automatically capture various user interaction data. The relevant data includes but is not limited to page loading data such as page loading time, loading order and resource loading time, click event data such as the specific location, time, frequency and element ID of the user's click, scrolling behavior data such as page scrolling depth, scrolling speed and stay area, and form interaction data such as user input behavior, stay time and submission behavior in the form. In order to ensure data representativeness and system performance, random sampling or systematic sampling methods are used to adjust the data collection frequency according to traffic and actual needs, and duplicate data is removed by uniquely identifying the user ID and session ID. The front-end interaction monitoring tool can also be Google Analytics, Sentry, etc. When the website loads cross-domain resources (such as APIs, pictures, scripts, etc.), the loading of resources is monitored through the CORS strategy, which is not limited.

[0055] The collected data is then formatted and transmitted using a lightweight data exchange format (such as JSON or Protocol Buffers) to reduce transmission overhead, and is stored in a NoSQL database (such as MongoDB or Cassandra) that supports high-concurrency read and write operations to meet the storage needs of massive user behavior data.

[0056] In the data preprocessing stage, data cleaning is first performed, and duplicate and invalid data are judged and deleted through hash values ​​to ensure data quality. Then, data normalization is performed to convert data of different dimensions to the same standard for subsequent analysis. At the same time, the box plot method or Z-score method is used to detect and process outliers in the data to improve data stability and reliability.

[0057] In the user behavior analysis phase, the K-means clustering algorithm is used to group user behavior data. In the example, the elbow method is used to determine the appropriate number of clusters k, and then the behavior characteristics of each user group are analyzed. Based on the clustering results, a user behavior model is constructed, and the decision tree algorithm is used to identify the key factors affecting user behavior. Subsequently, a prediction model is constructed using random forest and support vector machine algorithms to predict future access needs based on user historical behavior data, providing guidance for cache preloading.

[0058] The intelligent cache decision engine automatically generates cache strategies based on the results of the user behavior model and the prediction model, including the setting of cache time and the selection of storage locations (such as local cache, server cache, and CDN cache). To further optimize the cache strategy, the Q-learning reinforcement learning algorithm is introduced to continuously adjust the strategy through reward mechanisms (such as the improvement of cache hit rate and user experience) to improve the overall performance of the system.

[0059] During the implementation of the cache strategy, appropriate cache technology is selected according to the specific scenario. The client uses IndexedDB to store large data caches, while localStorage is used to store small data caches. The server uses Redis to store frequently accessed data, and Memcached is used to store less frequently accessed data. At the same time, static resources such as images, CSS, and JavaScript files are cached on the CDN node to increase the resource loading speed.

[0060] To ensure the consistency of the cache state, a long connection is established between the client and the server through WebSocket to achieve real-time synchronization of the cache state. In addition, the consistent hashing algorithm is used to manage the distributed cache, which effectively prevents the occurrence of cache data inconsistency problems and ensures the stability and reliability of the cache system.

[0061] In the example, the application of algorithms and data structures is crucial in the process of user behavior analysis and cache decision-making. For user behavior analysis, the K-means clustering algorithm is first used to deeply mine user behavior data. In this process, the data needs to be standardized to eliminate the impact of different dimensions on the clustering results. Subsequently, the Euclidean distance is used to measure the similarity between samples, and the cluster center is updated iteratively until the center is stable or the preset maximum number of iterations is reached, thereby completing the effective division of user groups.

[0062] When predicting user behavior, random forest and support vector machine algorithms are used in parallel. The feature selection process selects key features that can characterize user behavior, such as access frequency, dwell time, and click path. Using these features, the model can be trained on historical data and verified to ensure the accuracy and stability of the prediction. Ultimately, the model predicts the user's future access needs based on the user's current behavior data, providing a strong basis for the formulation of caching strategies.

[0063] In terms of cache decision-making, dynamic programming algorithms and reinforcement learning algorithms complement each other. The dynamic programming algorithm defines cache states and strategy selections, constructs state transition equations, and solves the optimal cache strategy. The Q-learning reinforcement learning algorithm further refines and defines the state space (including cache hit rate, resource loading time, etc.) and action space (such as adjusting cache time, changing storage location, etc.) of the cache system, and continuously optimizes the cache strategy through a reward mechanism (based on the improvement of cache hit rate and user experience) to achieve intelligent adjustment of the strategy.

[0064] At the data structure level, the design of a combination of hash tables and linked lists is used to efficiently manage cached data. Hash tables provide fast data location capabilities, while linked lists are responsible for maintaining the order of data access. The combination of the two implements a cache replacement strategy based on the LRU (Least Recently Used) algorithm, ensuring the validity and timeliness of cached data. In addition, the B+ tree, as an efficient tree data structure, is also introduced to manage cache strategies. The characteristics of the B+ tree enable it to support fast insertion, deletion, and search operations, providing solid support for the dynamic adjustment and update of cache strategies.

[0065] like Figure 2As shown, a front-end performance optimization system based on cache management is also provided in an embodiment of the present invention, which is used to execute the front-end performance optimization method based on cache management in an embodiment of the present invention, including: a user behavior analysis module, configured to collect and process user behavior data to obtain target data; an intelligent cache decision module, configured to analyze user behavior based on target data, build a user behavior model, and use a prediction algorithm to predict the user's access needs to obtain a prediction model, and generate a cache strategy based on the user behavior model and the prediction model; a cache management module, configured to store resources on the client, server and content distribution network (CDN) node based on the cache strategy; wherein the user behavior data characterizes page loading information and user interaction behavior, including page loading time, loading order, resource loading time, click events, scrolling behavior and form interaction data; the cache strategy includes cache time, storage location and type of cached data.

[0066] In some embodiments, the front-end performance optimization system based on cache management also includes: a cache status synchronization module, which is configured to establish a long connection between the client and the server, and synchronize the cache status in real time; and use a distributed data indexing algorithm to process the cache data.

[0067] In a specific embodiment, the cache status synchronization module includes: a status synchronization submodule, configured to synchronize the cache status between the client and the server in real time through a duplex communication protocol; a consistency maintenance submodule is configured to use a consistent hashing mechanism to manage cache data distribution.

[0068] In some embodiments, the user behavior analysis module includes: a data collection sub-module, which is configured to automatically capture and record user behavior data by client-side scripting technology during the process of user interaction with the web page; a data transmission sub-module, which is configured to transmit target data from the client to the server by asynchronous communication technology; and a data storage sub-module, which is configured to use a non-relational database to store user behavior data on the server.

[0069] In some embodiments, the intelligent cache decision module includes: a behavior analysis submodule, which is configured to preset the number of clusters, and uses a clustering algorithm to group the target data, identify user groups with similar behavioral characteristics, and obtain clustering results; based on the clustering results, a user behavior model is constructed using a machine learning algorithm; a strategy generation submodule, which is configured to automatically generate a cache strategy based on the user behavior model; a strategy optimization submodule, which is configured to monitor and evaluate cache indicators in real time, and iteratively optimize the cache strategy based on the monitoring and evaluation results; wherein the cache indicators include cache hit rate, response time, and resource utilization.

[0070] In some embodiments, the cache management module includes: a local cache management submodule, which is configured to use browser-side storage technology to store cache data; a server cache management submodule, which is configured to use a high-performance memory database to cache high-frequency access resources; and a CDN cache management submodule, which is configured to use content distribution network (CDN) technology to cache static resources at multiple nodes.

[0071] The following reference Figure 1 , each module is specifically described as follows: The user behavior analysis module integrates data collection, transmission and storage functions to ensure comprehensive acquisition and efficient management of user behavior data. This module captures user interaction data in real time through front-end JavaScript scripts, and uses AJAX or WebSocket technology to achieve asynchronous data transmission to the server to reduce the delay caused by page refresh. On the server side, NoSQL databases (such as MongoDB) are used as data storage solutions, using their flexible data models and efficient read and write performance to support the storage and query of large-scale user behavior data.

[0072] The intelligent cache decision module includes three submodules: behavior analysis, strategy generation, and strategy optimization. The behavior analysis submodule uses cluster analysis and prediction models to deeply mine user behavior data, build user behavior models, and reveal user access patterns and preferences. Based on these models, the strategy generation submodule intelligently formulates cache strategies, including determining cache time, selecting storage locations, etc., to maximize cache benefits. The strategy optimization submodule further introduces reinforcement learning algorithms, and continuously optimizes cache strategies through continuous trial and error and reward mechanisms to improve cache hit rates and user experience.

[0073] The cache management module is responsible for the actual storage and access control of cached data, including local cache, server cache and CDN cache. The local cache management submodule uses Web storage technologies such as IndexedDB and localStorage to implement data caching on the client and provide fast access capabilities. The server cache management submodule uses high-performance memory databases such as Redis and Memcached to store frequently accessed data and reduce the query pressure on the backend database. The CDN cache management submodule caches static resources such as images, videos and JavaScript files on globally distributed CDN nodes to achieve local access to resources and significantly improve resource loading speed.

[0074] The cache state synchronization module ensures the consistency of the states between the components of the cache system and reduces data conflicts and inconsistencies. The state synchronization submodule uses WebSocket technology to establish a long connection between the client and the server, and synchronizes cache state information in real time, including the update, deletion, and invalidation of cache content. The consistency maintenance submodule uses a consistent hashing algorithm to effectively partition and locate data in the distributed cache system, ensuring that data can be smoothly migrated when cache nodes are added, reduced, or fail, maintaining high availability and data consistency of the cache system. Figure 2 The modules of the example implement data transmission and sharing through HTTP request / response, WebSocket, internal call, data sharing mechanism and other methods, and the specific circumstances are not limited here.

[0075] like Figure 3 As shown in the figure, the system architecture includes the client, server, and intelligent cache decision engine. The client is responsible for collecting user behavior data and sending it to the server, which processes the data and passes it to the intelligent cache decision engine. The intelligent cache decision engine adjusts the cache strategy based on the data analysis results and sends the instructions to the client and server for execution. Based on intelligent cache management, the system dynamically analyzes the user's access behavior and resource usage, intelligently adjusts the cache strategy, reduces unnecessary network requests, and improves page loading speed and data interaction efficiency. The intelligent cache decision engine combines user behavior analysis and resource usage patterns to formulate the optimal cache strategy and achieve efficient management and utilization of the cache.

[0076] like Figure 4 As shown in FIG, the intelligent cache decision process includes specific steps such as resource classification and tagging, user behavior analysis, cache strategy adjustment, cache hierarchical storage, cache preloading, cache invalidation and update, and client-server collaboration.

[0077] like Figure 5 As shown, the user behavior analysis module collects user behavior data on the website through front-end scripts, and derives the user's resource usage pattern through data analysis.

[0078] like Figure 6 As shown, the cache management module stores commonly used resources (high-frequency access resources) in the local cache, and stores infrequently used resources (low-frequency access resources) on the server side or CDN to optimize the use of storage space.

[0079] like Figure 7 As shown, the cache preloading mechanism loads resources that may be accessed in advance based on the user behavior prediction model to shorten the response time of user requests.

[0080] like Figure 8As shown in the figure, the cache invalidation and update strategy ensures that when the resource content changes, the old cache can be invalidated in time and updated to the new cache, ensuring that users access the latest content.

[0081] like Fig. 9 As shown in the figure, the client and server synchronize the cache status through WebSocket and work together to ensure the consistency of the cache at both ends, thereby improving the overall performance and reliability of the system.

[0082] From the above specific examples, we can see that by implementing a cache hierarchical storage strategy, we can automatically divide storage levels according to the importance and frequency of use of resources, and optimize the allocation and access efficiency of storage resources; by integrating user behavior analysis data and resource usage data, we use this as an objective basis for making cache decisions to improve the effectiveness of the cache and reduce redundancy; we have designed a cache preloading mechanism that predicts user behavior based on data analysis and loads resources that may be accessed into the cache in advance to shorten access delays; and we have established a collaborative mechanism between the client and the server to ensure the synchronization and consistency of the cache status between the two ends, and to maintain the overall performance and stability of the system.

[0083] In order to facilitate the description, some common English nouns or letters and concepts used in the present invention are only used for exemplary reference rather than restrictive interpretation or specific usage, and the protection scope of the present invention should not be limited by their Chinese translation or specific letters.

[0084] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solutions provided in the embodiments of the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0085] The above description is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the present invention will not be limited to the embodiments shown herein, but should conform to the widest scope consistent with the principles and novel features applied herein.

Claims

1. A front-end performance optimization method based on cache management, characterized in that: include: Step S1. Collect and process user behavior data to obtain target data; Step S2. Analyze user behavior based on the target data, build a user behavior model, and use a prediction algorithm to predict the user's access needs to obtain a prediction model; Step S3. Generate a cache strategy based on the user behavior model and the prediction model; Step S4. storing resources on the client, server and content distribution network node based on the cache strategy; Among them, the user behavior data represents page loading information and user interaction behavior, including page loading time, loading order, resource loading time, click events, scrolling behavior and form interaction data; the cache strategy includes cache time, storage location and type of cached data.

2. The front-end performance optimization method based on cache management according to claim 1 is characterized in that: The step S4 includes: establishing a long connection between the client and the server, synchronizing the cache status in real time; and processing the cache data using a distributed data indexing algorithm.

3. The front-end performance optimization method based on cache management according to claim 1, characterized in that: In the step S1, the method for collecting the user behavior data includes capturing the user's operation behavior on the client using a front-end interaction monitoring tool; Dynamically adjust sampling frequency based on system load and user traffic; Perform data deduplication processing; The collected user behavior data is encoded in a lightweight data exchange format and then transmitted from the client to the server for storage.

4. The front-end performance optimization method based on cache management according to claim 1, characterized in that: The method for obtaining the target data in step S1 includes deleting duplicate data and invalid data; converting data of different dimensions into the same dimension; and detecting and processing abnormal data.

5. The front-end performance optimization method based on cache management according to claim 1, characterized in that: In the step S2, the method for analyzing user behavior includes: presetting the number of clusters, grouping the target data by a clustering algorithm, identifying user groups with similar behavior characteristics, and obtaining clustering results.

6. The front-end performance optimization method based on cache management according to claim 5, characterized in that: Based on the clustering results, the user behavior model is constructed using a machine learning algorithm (such as decision tree, random forest, support vector machine, neural network, etc.).

7. The front-end performance optimization method based on cache management according to any one of claims 1 to 6, characterized in that: The method for generating the cache strategy includes: analyzing and identifying the user's access pattern, preference and behavior trend by the user behavior model; predicting the user's access behavior and resource requirements by the prediction model; defining high-frequency access resources and low-frequency access resources, and classifying cache data; setting the cache strategy based on the classification results; the cache strategy includes cache time and storage location.

8. The front-end performance optimization method based on cache management according to claim 7, characterized in that: The method for generating the cache strategy includes: real-time monitoring and evaluation of cache indicators; iteratively optimizing the cache strategy according to the monitoring and evaluation results; wherein the cache indicators include cache hit rate, response time, and resource utilization.

9. A front-end performance optimization system based on cache management, characterized in that: A method for optimizing front-end performance based on cache management according to any one of claims 1 to 8; comprising: A user behavior analysis module is configured to collect and process user behavior data to obtain target data; An intelligent cache decision module is configured to analyze user behavior based on the target data, build a user behavior model, and use a prediction algorithm to predict the user's access needs to obtain a prediction model, and generate a cache strategy based on the user behavior model and the prediction model; A cache management module, configured to store resources on the client, server, and content distribution network node based on the cache strategy; Among them, the user behavior data represents page loading information and user interaction behavior, including page loading time, loading order, resource loading time, click events, scrolling behavior and form interaction data; the cache strategy includes cache time, storage location and type of cached data.

10. The front-end performance optimization system based on cache management according to claim 9, characterized in that: include: The cache status synchronization module is configured to establish a long connection between the client and the server, synchronize the cache status in real time, and process the cache data using a distributed data indexing algorithm.

11. The front-end performance optimization system based on cache management according to claim 10, characterized in that: The cache status synchronization module includes: a status synchronization submodule, configured to synchronize the cache status between the client and the server in real time via a duplex communication protocol; and a consistency maintenance submodule configured to manage the cache data distribution using a consistent hashing mechanism.

12. The front-end performance optimization system based on cache management according to claim 9, characterized in that: The user behavior analysis module includes: The data collection submodule is configured to automatically capture and record the user behavior data during the user's interaction with the webpage by using client-side scripting technology; A data transmission submodule, configured to transmit the target data from the client to the server by asynchronous communication technology; The data storage submodule is configured to use a non-relational database to store user behavior data on the server side.

13. The front-end performance optimization system based on cache management according to claim 9, characterized in that: The intelligent cache decision module includes: The behavior analysis submodule is configured to preset the number of clusters, and the target data is grouped by a clustering algorithm to identify user groups with similar behavior characteristics and obtain clustering results; Based on the clustering results, construct the user behavior model using a machine learning algorithm; A strategy generation submodule, configured to automatically generate the cache strategy according to the user behavior model; A strategy optimization submodule is configured to monitor and evaluate cache indicators in real time, and iteratively optimize the cache strategy according to the monitoring and evaluation results; The cache indicators include cache hit rate, response time, and resource utilization.

14. The front-end performance optimization system based on cache management according to any one of claims 9 to 13, characterized in that: The cache management module includes: The local cache management submodule is configured to store cache data using browser-side storage technology; The server cache management submodule is configured to use a high-performance in-memory database to cache high-frequency access resources; The CDN cache management submodule is configured to cache static resources at multiple nodes using content distribution network technology.

15. An electronic device, characterized in that: It comprises a memory, a processor, and a plurality of computer programs, wherein the computer programs are stored in the memory and are configured so that the plurality of processors execute the front-end performance optimization method based on cache management as claimed in any one of claims 1 to 8.

Citation Information

Cited By

  • Intelligent caching method and device for loading front-end resources as required, equipment and medium

    CN119691305A

  • Method for improving cache hit strategy and response speed

    CN120011265A

  • Intelligent cache management method and system based on user requirements

    CN120216410A

  • Web application performance improving system and method based on distributed cache management

    CN120434301A

  • Video acceleration method based on multi-scene dynamic perception intelligent switching

    CN120455783A