Dynamic resource loading method and device, computer equipment and storage medium
Through the resource interest score prediction model trained based on historical browsing behavior data, the current browsing behavior data is predicted, and the resource loading strategy is dynamically adjusted, which solves the problem of over-preloading resources in the existing technology, and optimizes the resource response speed and user experience.
Patent Information
- Application Number
- CN202411711794.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art excessively preload unnecessary resources when loading resources on front-end pages, resulting in waste of broadband and memory.
By obtaining the resource interest score prediction model obtained based on historical browsing behavior data training, the current browsing behavior data is predicted, and the resources are dynamically distinguished for preloading and lazy loading.
Real-time adjustment of resource loading strategies according to changes in user behavior is achieved, avoiding excessive preloading of unnecessary resources, and optimizing resource response speed and user experience.
Smart Images

Figure CN119622136A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a resource dynamic loading method, device, computer equipment and storage medium. Background Art
[0002] With the rapid development of Internet technology, front-end pages are becoming increasingly complex. Loading a large amount of resources has become a key factor affecting page performance. Existing technologies rely on static configuration and do not consider factors such as real-time changes in user behavior. In order to ensure timely response of resources, unnecessary resources can only be over-preloaded, resulting in a waste of bandwidth and memory. Summary of the invention
[0003] In view of this, the present invention provides a method, apparatus, computer device and storage medium for dynamically loading resources, which can solve the current technical problem of excessive preloading of unnecessary resources, resulting in waste of bandwidth and memory.
[0004] According to a first aspect of the present invention, a method for dynamically loading resources is provided, the method comprising:
[0005] Obtaining a resource interest score prediction model, wherein the resource interest score prediction model is trained based on historical browsing behavior data and historical resource interest scores corresponding to next historical browsing behavior;
[0006] The resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors;
[0007] Different resources are preloaded and lazy loaded according to the interest scores of the resources.
[0008] According to a second aspect of the present invention, a dynamic resource loading device is provided, the device comprising:
[0009] An acquisition module, used to acquire a resource interest score prediction model, wherein the resource interest score prediction model is obtained by training based on historical browsing behavior data and historical resource interest scores corresponding to the next historical browsing behavior;
[0010] A prediction module, used to predict the current browsing behavior data using the resource interest score prediction model to obtain resource interest scores of resources corresponding to different next browsing behaviors;
[0011] The loading module is used to preload and lazy load different resources according to the interest scores of the resources.
[0012] According to a third aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the dynamic loading method of the above-mentioned resources is implemented.
[0013] According to a fourth aspect of the present application, a computer device is provided, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned dynamic loading method of resources when executing the program.
[0014] By means of the above technical scheme, the present invention provides a method, device, computer equipment and storage medium for dynamically loading resources. First, a resource interest score prediction model is obtained, wherein the resource interest score prediction model is obtained by training based on historical browsing behavior data and historical resource interest scores corresponding to the next historical browsing behavior; then, the resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors; finally, different resources are preloaded and lazy loaded according to the resource interest scores. Through the technical scheme of the present invention, the current browsing behavior data is predicted, and resource interest scores of resources corresponding to multiple next browsing behaviors can be predicted, so that different resources can be dynamically divided into preloaded resources and lazy loaded resources according to changes in user behavior in real time, that is, only part of the resources need to be preloaded, rather than all the resources, thereby ensuring resource response speed and user experience, and avoiding excessive preloading of unnecessary resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation on the local application. In the drawings:
[0016] Figure 1 A schematic diagram showing a flow chart of a method for dynamically loading resources provided by an embodiment of the present invention;
[0017] Figure 2 A schematic diagram showing a flow chart of another method for dynamically loading resources provided by an embodiment of the present invention;
[0018] Figure 3 A schematic diagram of the structure of a dynamic loading device for resources provided by an embodiment of the present invention is shown;
[0019] Figure 4 A schematic diagram showing the structure of another dynamic loading device for resources provided by an embodiment of the present invention is shown;
[0020] Figure 5is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0021] Figure 6 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0022] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0023] This embodiment provides a method for dynamically loading resources, such as Figure 1 As shown, the method includes:
[0024] 101. Obtain a resource interest score prediction model, wherein the resource interest score prediction model is trained based on historical browsing behavior data and historical resource interest scores corresponding to next historical browsing behavior.
[0025] For this embodiment, as an implementation method, the historical browsing behavior data is determined in chronological order to obtain each step of the historical browsing behavior and the corresponding historical browsing behavior data. For each step of the historical browsing behavior, there is a corresponding historical resource interest score for the resource. The historical resource interest score can be calculated by collecting historical interaction data between users and resources.
[0026] Therefore, the historical browsing behavior data of any step and the historical resource interest score corresponding to its next historical browsing behavior are used as a set of training data, the historical browsing behavior data are used as model input, and the historical resource interest score corresponding to the next historical browsing behavior is used as a label. After training with multiple sets of training data, a resource interest score prediction model is obtained.
[0027] 102. Use the resource interest score prediction model to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors.
[0028] For this embodiment, as an implementation method, when applying the resource interest score prediction model, the current browsing behavior data is input, and the output is the resource interest score of the resources corresponding to different next browsing behaviors. Since the current browsing behavior data is real-time, each prediction of the interest level of different resources is also dynamic, so that it is possible to dynamically adjust which resources have a high interest level and which resources have a low interest level.
[0029] 103. Preload and lazy load different resources according to the resource interest scores.
[0030] For this embodiment, as an implementation method, preloading refers to loading in advance, and lazy loading refers to delayed loading, also called on-demand loading. Loading begins when the user scrolls to a certain position. In a specific application scenario, such as during a shopping platform promotion, it is predicted that one of the resources corresponding to different next browsing behaviors is a resource for continued scrolling. After judgment, this resource has a low level of interest, and this resource with a low level of interest is lazy loaded. That is, when the user's actual next browsing behavior is to continue scrolling, the resource for continued scrolling is loaded. Preferably, at this time, while the user is waiting, a clear loading prompt or placeholder is provided to improve the user experience.
[0031] The present invention provides a method, device, computer equipment and storage medium for dynamically loading resources. First, a resource interest score prediction model is obtained, wherein the resource interest score prediction model is obtained by training based on historical browsing behavior data and historical resource interest scores corresponding to the next historical browsing behavior; then, the resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors; finally, different resources are preloaded and lazy loaded according to the resource interest scores. Through the technical solution of the present invention, the current browsing behavior data is predicted, and the resource interest scores of resources corresponding to multiple next browsing behaviors can be predicted, so that different resources can be dynamically divided into preloaded resources and lazy loaded resources according to the changes in user behavior in real time, that is, only part of the resources need to be preloaded, rather than all the resources, thereby ensuring the resource response speed and user experience, and avoiding excessive preloading of unnecessary resources.
[0032] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another dynamic loading method of resources is provided, such as Figure 2 As shown, the method includes:
[0033] 201. Obtain historical browsing behavior data and historical resource interest data, calculate a historical resource interest score based on the historical resource interest data, train an initial resource interest score prediction model based on the historical browsing behavior data and the historical resource interest score corresponding to the next historical browsing behavior, and obtain a trained resource interest score prediction model.
[0034] 202. Obtain a resource interest score prediction model, wherein the resource interest score prediction model is trained based on historical browsing behavior data and historical resource interest scores corresponding to next historical browsing behavior.
[0035] For example, steps 201 and 202 are implemented as an implementation method, by monitoring page scrolling events, mouse movement events, click events, etc., historical browsing behavior data is collected, and each step of historical browsing behavior and the corresponding historical browsing behavior data are determined in chronological order of the behavior. For each step of historical browsing behavior, there is a corresponding historical resource interest score for the resource.
[0036] The historical resource interest score can be calculated by collecting historical interaction data between users and resources, where the historical interaction data can be dwell time data, scroll speed data, click frequency data, sharing data, etc. For example, the parameters can be set to dwell time, scroll speed, click frequency, sharing, and a numerical range and a corresponding score can be set for each parameter. Weights can be set for different parameters. The historical resource interest score = the dwell time score corresponding to the dwell time data multiplied by the dwell time weight + the scroll speed score corresponding to the scroll speed data multiplied by the scroll speed weight + the click frequency score corresponding to the click frequency data multiplied by the click frequency weight + the sharing score corresponding to the sharing data multiplied by the sharing weight.
[0037] Therefore, the historical browsing behavior data of any step and the historical resource interest score corresponding to the historical browsing behavior of the next step are used as a set of training data, the historical browsing behavior data are used as model input, and the historical resource interest score corresponding to the historical browsing behavior of the next step is used as a label. The initial resource interest score prediction model is trained with multiple sets of training data to obtain a resource interest score prediction model, wherein the initial resource interest score prediction model can be constructed based on decision trees, random forests, etc., which is not limited here.
[0038] 203. Use the resource interest score prediction model to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors.
[0039] For this embodiment, the resource interest score prediction model is used to predict the current browsing behavior data. In terms of input and output, the input is the current browsing behavior data, and the output is the resource interest score of the resources corresponding to different next browsing behaviors. In fact, the prediction process is to obtain different next browsing behaviors, and each next browsing behavior corresponds to the resources that need to be loaded. The preferences for different next browsing behaviors are different, that is, the preferences for the resources that need to be loaded are different. Therefore, the real needs of the user can be judged based on the current browsing behavior data, and the preferences for the resources corresponding to different next browsing behaviors can be distinguished.
[0040] 204. Preload and lazy load different resources according to the resource interest scores.
[0041] For this embodiment, as an implementation method, preloading and lazy loading different resources according to the resource interest score include: determining the resource loading order according to the resource interest score; determining the resources whose resource interest score is greater than a first preset score threshold or the resources whose resource loading order is in the front preset position as high-interest resources, and determining the resources whose resource interest score is less than or equal to the first preset score threshold and the resources whose resource loading order is not in the front preset position as low-interest resources; preloading the high-interest resources, and lazy loading the low-interest resources.
[0042] Among them, although resources with resource interest scores greater than the first preset score threshold or resources with resource loading orders in the front preset positions are all high-interest resources, the resource interest scores and resource loading orders both prioritize the resources accordingly. Therefore, on the basis of preloading all high-interest resources, there is also a priority order for preloading these high-interest resources, thereby avoiding congestion and delay caused by simultaneous loading.
[0043] Specifically, a progressive loading mechanism is implemented for these high-priority resources, that is, all high-priority resources are preloaded, and low-priority resources are preloaded only when the user approaches their area. The boundary between high and low priorities can be set according to actual conditions and is not limited here. Compared with preloading all high-interest resources, more accurate dynamic adjustments are made according to changes in user behavior, that is, only high-priority resources are preloaded, which reduces the problem of excessive preloading and optimizes the use of bandwidth and memory.
[0044] As another implementation, the preloading of the high-interest resources and the lazy loading of the low-interest resources include: real-time monitoring of the network environment status, determining the network environment status greater than a preset network threshold as a fast state, and determining the network environment status less than or equal to the preset network threshold as a slow state; if the network environment status is the fast state, preloading the high-interest resources and the low-interest resources greater than or equal to a second preset scoring threshold, wherein the second preset scoring threshold is less than or equal to the first preset scoring threshold; if the network environment status is the slow state, preloading the high-interest resources and lazy loading the low-interest resources.
[0045] Among them, on the basis of the first implementation method, restrictions on dynamic resource loading due to network environment status are added, and preloaded and lazy loaded resources are dynamically adjusted according to user behavior and network status to avoid unnecessary bandwidth consumption.
[0046] 205. Cache the loaded resources, and adjust the loaded resources according to the usage mode and the preset resource update frequency.
[0047] For this embodiment, as an implementation method, the loaded resources are adjusted according to the usage mode and the preset resource update frequency, including: determining the first maximum effective duration of the usage mode for the loaded resources and the second maximum effective duration of the preset resource update frequency for the same loaded resources; calculating the minimum value of the first maximum effective duration and the second maximum effective duration; if the cache duration of the loaded resource is greater than or equal to the minimum value, deleting the loaded resource, and if the cache duration of the loaded resource is less than the minimum value, retaining the loaded resource.
[0048] Among them, in order to reduce repeated loading of the same resources, resource invalidation processing is performed through usage mode and preset resource update frequency. In specific application scenarios, the usage mode may include youth mode and normal mode. For example, the same loaded resource will expire faster in youth mode than in normal mode. In specific application scenarios, when the loaded resource is an account password, for example, the preset resource update frequency is invalid once every three hours. After expiration, you need to log in again.
[0049] For the same loaded resource, the maximum effective duration is limited from two aspects (usage mode and preset resource update frequency). The usage mode corresponds to the first maximum effective duration, and the preset resource update frequency corresponds to the second maximum effective duration. The minimum value of the two is calculated, which represents the maximum duration that the loaded resource can be retained under the joint restrictions of the two aspects. The minimum value of the two is used as the cache duration boundary of the loaded resource, which means that when it is greater than or equal to the minimum value, the loaded resource needs to be deleted.
[0050] 206. Using the current browsing behavior data and the actual resource interest score corresponding to the next browsing behavior as new training data, continue to train the resource interest score prediction model to optimize the resource interest score prediction model.
[0051] For this embodiment, as an implementation method, the user-resource interaction data corresponding to the current browsing behavior data and the next browsing behavior is continuously collected. The actual resource interest score can be calculated based on the interaction data. The current browsing behavior data of any step and the actual resource interest score corresponding to its next browsing behavior are used as a new set of training data. The current browsing behavior data is used as the model input, and the actual resource interest score corresponding to the next browsing behavior is used as a label. The resource interest score prediction model is continuously trained, so that the resource interest score prediction model can be optimized in real time. The optimized resource interest score prediction model is used regularly to distinguish different resources into high-interest resources and low-interest resources, thereby improving the dynamic loading accuracy of resources and user experience.
[0052] It should be noted that the actual resource interest score corresponding to the next browsing behavior in this embodiment is different from the resource interest score corresponding to the next browsing behavior in step 203 of the embodiment. The difference is that the actual resource interest score in this embodiment is calculated based on the interaction data between the user and the resource corresponding to the next browsing behavior, while the resource interest score in step 203 of the embodiment is predicted based on the resource interest score prediction model.
[0053] The present invention provides a method, device, computer equipment and storage medium for dynamically loading resources. On the one hand, the current browsing behavior data is predicted, and the resource interest scores of multiple resources corresponding to the next browsing behavior can be predicted, so that different resources are dynamically divided into preloaded resources and lazy loaded resources according to the changes in user behavior in real time, that is, only some resources need to be preloaded, rather than all resources, so as to ensure the resource response speed and user experience, and avoid excessive preloading of unnecessary resources. On the other hand, on the basis of differentiating different resources into preloaded resources and lazy loaded resources, the priority of preloaded resources is distinguished. For preloaded resources with high priority, all are preloaded. For high-interest resources with low priority, preloading begins when the user approaches the area where the user is located. Compared with preloading all high-interest resources, more accurate dynamic adjustment is made according to the changes in user behavior, that is, only high-priority high-interest resources are preloaded, reducing the problem of excessive preloading and optimizing the use of broadband and memory. On the other hand, the loaded resources are invalidated from the two aspects of usage mode and preset resource update frequency to reduce repeated loading of the same resources.
[0054] Further, as Figure 1 and Figure 2 The specific implementation of the method shown in the figure, the embodiment of the present invention provides a dynamic loading device for resources, such as Figure 3As shown, the device includes: an acquisition module 31, a prediction module 32, and a loading module 33;
[0055] An acquisition module 31 is used to acquire a resource interest score prediction model, wherein the resource interest score prediction model is obtained by training based on historical browsing behavior data and historical resource interest scores corresponding to the next historical browsing behavior;
[0056] Prediction module 32, used to predict the current browsing behavior data using the resource interest score prediction model to obtain resource interest scores of resources corresponding to different next browsing behaviors;
[0057] The loading module 33 is used to preload and lazy load different resources according to the resource interest scores.
[0058] Accordingly, in order to preload and lazily load different resources according to the resource interest score, the loading module 33 can be specifically used to determine the resource loading order according to the resource interest score; determine the resources whose resource interest score is greater than the first preset score threshold or the resources whose resource loading order is in the front preset position as high-interest resources, and determine the resources whose resource interest score is less than or equal to the first preset score threshold and the resources whose resource loading order is not in the front preset position as low-interest resources; preload the high-interest resources, and lazily load the low-interest resources.
[0059] Correspondingly, in order to preload the high-interest resources and lazily load the low-interest resources, the loading module 33 can be specifically used to monitor the network environment status in real time, determine the network environment status greater than the preset network threshold as a fast state, and determine the network environment status less than or equal to the preset network threshold as a slow state; if the network environment status is the fast state, preload the high-interest resources and the low-interest resources greater than or equal to the second preset scoring threshold, wherein the second preset scoring threshold is less than or equal to the first preset scoring threshold; if the network environment status is the slow state, preload the high-interest resources and lazily load the low-interest resources.
[0060] In specific application scenarios, such as Figure 4 As shown, a dynamic resource loading device further includes: a cache module 34, which can be used to cache the loaded resources and adjust the loaded resources according to the usage mode and the preset resource update frequency.
[0061] Accordingly, in order to adjust the loaded resources according to the usage mode and the preset resource update frequency, the cache module 34 can be specifically used to determine the first maximum effective duration of the usage mode for the loaded resources and the second maximum effective duration of the preset resource update frequency for the same loaded resource; calculate the minimum value of the first maximum effective duration and the second maximum effective duration; if the cache duration of the loaded resource is greater than or equal to the minimum value, delete the loaded resource; if the cache duration of the loaded resource is less than the minimum value, retain the loaded resource.
[0062] In specific application scenarios, such as Figure 4 As shown, a dynamic loading device for resources also includes: a first training module 35, which can be specifically used to obtain historical browsing behavior data and historical resource interest data; calculate the historical resource interest score based on the historical resource interest data; train an initial resource interest score prediction model based on the historical browsing behavior data and the historical resource interest score corresponding to the next historical browsing behavior, to obtain a trained resource interest score prediction model.
[0063] In specific application scenarios, such as Figure 4 As shown, a dynamic loading device for resources also includes: a second training module 36, which can be used to use the actual resource interest score corresponding to the current browsing behavior data and the next browsing behavior as new training data, and continue to train the resource interest score prediction model to optimize the resource interest score prediction model.
[0064] The present invention provides a method, device, computer equipment and storage medium for dynamically loading resources. First, a resource interest score prediction model is obtained, wherein the resource interest score prediction model is obtained by training based on historical browsing behavior data and historical resource interest scores corresponding to the next historical browsing behavior; then, the resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors; finally, different resources are preloaded and lazy loaded according to the resource interest scores. Through the technical solution of the present invention, the current browsing behavior data is predicted, and the resource interest scores of resources corresponding to multiple next browsing behaviors can be predicted, so that different resources can be dynamically divided into preloaded resources and lazy loaded resources according to the changes in user behavior in real time, that is, only part of the resources need to be preloaded, rather than all the resources, thereby ensuring the resource response speed and user experience, and avoiding excessive preloading of unnecessary resources.
[0065] For the specific definition of the dynamic loading device of resources, please refer to the definition of the dynamic loading method of resources in the above text, which will not be repeated here. Each module in the above-mentioned dynamic loading device of resources can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0066] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a dynamic loading method for resources on the server side.
[0067] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of the client side of a dynamic loading method for resources.
[0068] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0069] Obtaining a resource interest score prediction model, wherein the resource interest score prediction model is trained based on historical browsing behavior data and historical resource interest scores corresponding to next historical browsing behavior;
[0070] The resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors;
[0071] Different resources are preloaded and lazy loaded according to the interest scores of the resources.
[0072] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0073] Obtaining a resource interest score prediction model, wherein the resource interest score prediction model is trained based on historical browsing behavior data and historical resource interest scores corresponding to next historical browsing behavior;
[0074] The resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors;
[0075] Different resources are preloaded and lazy loaded according to the interest scores of the resources.
[0076] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0077] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0078] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0079] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for dynamically loading resources, characterized in that: The method comprises: Obtaining a resource interest score prediction model, wherein the resource interest score prediction model is trained based on historical browsing behavior data and historical resource interest scores corresponding to next historical browsing behavior; The resource interest score prediction model is used to predict the current browsing behavior data to obtain resource interest scores of resources corresponding to different next browsing behaviors; Different resources are preloaded and lazy loaded according to the interest scores of the resources.
2. The method according to claim 1, characterized in that The preloading and lazy loading of different resources according to the resource interest scores include: Determining a resource loading order according to the resource interest scores; Determine the resources whose resource interest score is greater than the first preset score threshold or the resources whose resource loading order is in the front preset position as high-interest resources, and determine the resources whose resource interest score is less than or equal to the first preset score threshold and the resources whose resource loading order is not in the front preset position as low-interest resources; The high-interest resources are preloaded, and the low-interest resources are lazily loaded.
3. The method according to claim 2, characterized in that The preloading of the high-interest resource and the lazy loading of the low-interest resource include: Monitor the network environment status in real time, determine the network environment status greater than a preset network threshold as a fast status, and determine the network environment status less than or equal to the preset network threshold as a slow status; If the network environment state is the fast state, preloading the high-interest resources and low-interest resources greater than or equal to a second preset score threshold, wherein the second preset score threshold is less than or equal to the first preset score threshold; If the network environment state is the slow state, the high-interest resources are preloaded and the low-interest resources are lazily loaded.
4. The method according to claim 1, characterized in that After preloading and lazy loading different resources according to the resource interest scores, the method further includes: Cache loaded resources; The loaded resources are adjusted according to the usage pattern and the preset resource update frequency.
5. The method according to claim 4, characterized in that The adjusting the loaded resources according to the usage mode and the preset resource update frequency includes: Determine a first maximum effective duration of the usage mode for the loaded resource and a second maximum effective duration of the preset resource update frequency for the same loaded resource; Calculate the minimum value of the first maximum effective duration and the second maximum effective duration; If the cache duration of the loaded resource is greater than or equal to the minimum value, the loaded resource is deleted; if the cache duration of the loaded resource is less than the minimum value, the loaded resource is retained.
6. The method according to claim 1, characterized in that Before obtaining the resource interest score prediction model, the method further includes: Obtain historical browsing behavior data and historical resource interest data; Calculating a historical resource interest score based on the historical resource interest data; An initial resource interest score prediction model is trained according to the historical browsing behavior data and the historical resource interest score corresponding to the next historical browsing behavior to obtain a trained resource interest score prediction model.
7. The method according to claim 1, characterized in that After loading the resource according to the resource interest score, the method further includes: The actual resource interest score corresponding to the current browsing behavior data and the next browsing behavior is used as new training data to continue training the resource interest score prediction model to optimize the resource interest score prediction model.
8. A dynamic resource loading device, characterized in that: The device comprises: An acquisition module, used to acquire a resource interest score prediction model, wherein the resource interest score prediction model is obtained by training based on historical browsing behavior data and historical resource interest scores corresponding to the next historical browsing behavior; A prediction module, used to predict the current browsing behavior data using the resource interest score prediction model to obtain resource interest scores of resources corresponding to different next browsing behaviors; The loading module is used to preload and lazy load different resources according to the interest scores of the resources.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for dynamically loading resources described in any one of claims 1 to 7 is implemented.
10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method for dynamically loading resources described in any one of claims 1 to 7 is implemented.