WO2025119342A1 - 一种文件加载方法和装置 - Google Patents
一种文件加载方法和装置 Download PDFInfo
- Publication number
- WO2025119342A1 WO2025119342A1 PCT/CN2024/137492 CN2024137492W WO2025119342A1 WO 2025119342 A1 WO2025119342 A1 WO 2025119342A1 CN 2024137492 W CN2024137492 W CN 2024137492W WO 2025119342 A1 WO2025119342 A1 WO 2025119342A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- user
- behavior
- resource
- file
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/092—Reinforcement learning
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the present invention belongs to the technical field of file loading, and in particular relates to a file loading method, device, electronic equipment and storage medium.
- Patent CN112181532A designs a page resource loading solution, obtains the preloading parameters of the page resource according to the page resource loading request, and obtains the resource file according to whether the preloading parameters meet the preloading conditions, including obtaining from the local and loading the page resources corresponding to the preloading parameters from the resource file.
- Patent CN111666497A mainly designs page access instructions, and searches for related files in the pre-stored resource database based on the access instructions. The above patents focus on the design of the resource side and the rendering side, and focus on how to efficiently obtain resources to optimize user needs and experience.
- Patent CN110377361A designs different data representations and displays corresponding data according to the data representation, thereby saving memory space and improving user experience.
- Patent CN116225567A collects user behavior to predict the results of preloading pages and uses a multi-layer perceptron for prediction, but the multi-layer perceptron may have problems of overfitting and difficulty in debugging parameters as the number of layers increases.
- the above patents mainly conduct invention research on preloading resource selection, but give less consideration to user behavior and needs.
- the present invention proposes a hybrid loading method for JavaScript files based on user behavior, which combines resource preloading and on-demand loading methods through modules such as user historical behavior perception, user actual demand acquisition, user behavior prediction, and resource loading sequence decision to obtain the final resource loading sequence.
- resource preloading and on-demand loading methods through modules such as user historical behavior perception, user actual demand acquisition, user behavior prediction, and resource loading sequence decision to obtain the final resource loading sequence.
- the purpose of the invention is to provide a cloud desktop repeated keystroke processing method, device, electronic device and storage medium, combining the user's historical behavior trajectory with reinforcement learning to perform reasonable resource loading prediction, thereby obtaining the optimal JavaScript loading sequence.
- This method can reduce the page loading time while avoiding blocking rendering, thereby avoiding resource conflicts between different scripts, ensuring the normal operation of the page, and improving the user experience.
- a first aspect of the present invention provides a file loading method, comprising:
- Use code tracking to monitor user browsing history including page jumps, clicks, scrolling, searches, and dwell time.
- Obtain the user's historical browsing track by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics;
- An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior and the weights of different user behaviors are combined together. The initial resource loading sequence is iterated multiple times through the user behavior prediction module to obtain a resource loading order sequence.
- code tracking including:
- user_id and user_name are used to represent the user ID and user name
- page_path and page_title are used to represent the path and page title of the current page
- event_type, act_tag, begin_time, and end_time are used to represent the current event type, resource tag, start time, and end time.
- the page jump behavior is reported synchronously using the WebSocket reporting mechanism.
- the front-end and back-end establish a long connection, and the front-end transmits the relevant data of the user page jump to the server.
- the click behavior and the search behavior are asynchronously reported using the Batch mechanism.
- the Batch mechanism caches the user tracks collected by the front end using the data queue and reports when the data volume reaches the threshold data_threshold;
- the performance data is reported using the Beacon API
- the buried data is cleaned and analyzed, and the user's historical browsing behavior is classified, and the actual needs of the user are confirmed through statistics, including:
- cleaning the collected user historical browsing behavior data includes deleting duplicate records and searching for abnormal values.
- the deletion rules for duplicate records are as follows:
- the operation of searching for outliers determines whether the residence time is greater than a preset threshold.
- the actual needs of the user are mapped into the state space and behavior space in reinforcement learning, and the user behavior is predicted to output the weights of different user behaviors, including:
- Resource tags include at least: scripts, style sheets, JSON, XML, pictures, audio and video files, etc.
- the amount of resources depends on the environment and resources of the current user browsing page;
- the behavior space is defined as the user browsing behavior in the actual needs of the user.
- Predict user behavior based on behavior space and state space and output the weights of different user behaviors.
- an initialization resource loading sequence is generated according to the user's historical browsing trajectory, the predicted user behavior and the weights of different user behaviors are combined, and the initialization resource loading sequence is iterated multiple times through the user behavior prediction module to obtain a resource loading sequence, including:
- R represents the reward generated under the current resource loading sequence, Indicates the time when the user browses to resource i. Indicates the time when the front-end page finishes loading resource i. represents the difference between the user browsing and rendering time of resource i, and the reward function is the sum of the time differences of all resources;
- the predicted user behavior is combined with the weights of different user behaviors.
- the initial resource loading sequence is iterated multiple times through the user behavior prediction module.
- the reward function tests the user experience of the resource loading sequence, and finally outputs the optimal resource loading decision sequence.
- the preset resource types include:
- act_tag1 JavaScript script file
- act_tag2 css style sheet file
- act_tag3 JSON file
- act_tag4 XML file
- act_tag5 picture file.
- the file types of picture files include at least: jpg, png and gif;
- act_tag6 audio file.
- the file types of audio files include at least: mp3, opp;
- act_tag7 video file.
- the file types of video files include at least: mp4 and webm;
- act_tag8 other files.
- the file types of other files include at least: PDF files, SVG vector files, data files, and compressed files.
- a second aspect of the present invention provides a file loading device, comprising:
- Monitoring module used to monitor the user's historical browsing behavior by using code tracking, and the user's historical browsing behavior includes: page jump behavior, click behavior, scrolling behavior, search behavior and dwell time;
- Setting module used to set different reporting methods and reporting times for different user historical browsing behaviors
- Statistics module used to obtain the user's historical browsing track by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics;
- Prediction module and output module used to map the actual needs of the user into the state space and behavior space in reinforcement learning, predict the user behavior, and output the user's demand weights for different resources;
- Acquisition module used to generate an initialization resource loading sequence based on the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initialization resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence.
- an electronic device comprising: a processor and a memory;
- the processor is used to execute any one of the file loading methods described above by calling the program or instruction stored in the memory.
- a computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute a file loading method as described in any one of the above items.
- the present invention monitors the user's historical browsing behavior by adopting the code burying method, and the user's historical browsing behavior includes: page jump behavior, click behavior, scrolling behavior, search behavior and dwell time; different reporting methods and reporting times are set for different user historical browsing behaviors; the user's historical browsing trajectory is obtained by monitoring the user's historical browsing behavior, and the buried data is cleaned, analyzed and classified, and the user's actual needs are confirmed by statistics; the user's actual needs are mapped to the state space and behavior space in reinforcement learning, the user's behavior is predicted, and the user's demand weight for different resources is output; according to the user's historical browsing trajectory, an initialization resource loading sequence is generated, and the predicted user behavior is combined with the weight of the user's different behaviors, and the initialization resource loading sequence is iterated for multiple rounds through the user behavior prediction module to obtain a resource loading sequence.
- the present invention combines the user's historical behavior trajectory with reinforcement learning, performs reasonable resource loading prediction, and thus obtains the optimal JavaScript loading sequence, which can reduce the time of page loading, while avoiding blocking rendering, thereby avoiding resource conflicts of different scripts, ensuring the normal operation of the page, and improving user experience.
- FIG1 is a diagram of a file loading method provided by an embodiment of the present invention.
- FIG2 is a schematic diagram of monitoring a user's historical browsing behavior according to an embodiment of the present invention.
- FIG3 is a second diagram of a file loading method provided by an embodiment of the present invention.
- FIG4 is a diagram of a file loading device provided by an embodiment of the present invention.
- FIG5 is a schematic block diagram of an electronic device provided by an embodiment of the present invention.
- the terms “first”, “second”, and “third” are used for descriptive purposes only and should not be understood as indicating or implying relative importance.
- the terms “installed”, “connected”, and “connected” should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be internal communication between two components.
- installed”, “connected”, and “connected” should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be internal communication between two components.
- the present invention proposes a file loading method, device, electronic device and storage medium, which combine the user's historical behavior trajectory with reinforcement learning to perform reasonable resource loading prediction, thereby obtaining an optimal JavaScript loading sequence.
- the method can reduce the page loading time and avoid blocking rendering, thereby avoiding resource conflicts between different scripts, ensuring the normal operation of the page, and improving the user experience.
- JavaScript is a lightweight, interpreted or just-in-time compiled programming language with function priority.
- JavaScript is a dynamic scripting language based on prototype programming and multiple paradigms, and supports object-oriented, imperative, declarative, and functional programming paradigms. Its main functions include: embedding dynamic text in HTML (Hyper Text Markup Language) pages, responding to browser events, reading and writing HTML elements, etc.
- HTML Hyper Text Markup Language
- Reinforcement Learning As a branch of machine learning, reinforcement learning is used to describe and solve the problem of maximizing rewards or achieving specific goals by learning strategies during the interaction between an intelligent agent and the environment.
- Preloading As a performance optimization technology, resource preloading requests and loads all required resources locally in advance. During the web page loading process, such resources are directly obtained from the cache, which provides users with a better experience and reduces the waiting time during page loading.
- On-demand loading As one of the links in performance optimization, on-demand loading loads the corresponding code according to the functions currently required by the user. The number of requests issued by the browser at the same time is limited. Loading the code corresponding to all functions at once will cause the homepage to be blank for a long time when entering a single-page system. In JS, loading actions are usually triggered by some user behaviors or scheduled tasks to optimize the user experience.
- FIG. 1 is a diagram of a file loading method provided by an embodiment of the present invention.
- FIG. 2 is a schematic diagram of monitoring a user's historical browsing behavior provided by an embodiment of the present invention.
- a file loading method which includes five steps S1 to S5 in conjunction with FIG. 1 and FIG. 2 :
- S1 Use code tracking to monitor user browsing history, which includes page jumps, clicks, scrolling, searches, and dwell time.
- the front end uses code tracking to monitor the user's historical browsing behavior.
- the page jump behavior is the starting node for the user to browse the current page
- the click and search behavior indicates that the user has a greater interest in a resource
- the scrolling behavior can be monitored by monitoring the user's scrolling operation on the page, thereby understanding the user's reading browsing behavior.
- the dwell time can be used to measure the user's interest.
- S2 Set different reporting methods and reporting times for different user historical browsing behaviors.
- different reporting methods and reporting times are set for page jump behavior, click behavior, scrolling behavior, search behavior and dwell time.
- page jump behavior is synchronously reported using a WebSocket reporting mechanism, and a long connection is established between the front and back ends, and the front end transmits relevant data of the user's page jump to the server.
- S3 Obtain the user's historical browsing trajectory by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics.
- S4 Map the actual needs of users into the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources.
- a method for mapping actual user demands into state space and behavior space in reinforcement learning, predicting user behaviors, and outputting user demand weights for different resources is described in detail below.
- S5 Generate an initial resource loading sequence based on the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initial resource loading sequence multiple times through the user behavior prediction module to obtain a resource loading order sequence.
- an initialization resource loading sequence is generated according to the user's historical browsing trajectory, the predicted user behavior and the weights of different user behaviors are combined together, and the initialization resource loading sequence is iterated multiple times through the user behavior prediction module.
- the method for obtaining the resource loading order sequence is described in detail below.
- code tracking including:
- user_id and user_name are used to represent the user ID and user name
- page_path and page_title are used to represent the path and page title of the current page
- event_type, act_tag, begin_time, and end_time are used to represent the current event type, resource tag, start time, and end time.
- a code embedding method is used to monitor the user's historical browsing behavior, and the method of adding embedding codes for different behaviors is different.
- the page jump behavior is reported synchronously using the WebSocket reporting mechanism.
- the front-end and back-end establish a long connection, and the front-end transmits the relevant data of the user page jump to the server.
- the Batch mechanism caches the user tracks collected by the front end using the data queue and reports when the data volume reaches the threshold data_threshold;
- the performance data is reported using the Beacon API
- the data volume reaches the threshold data_threshold, it is reported. Since the user's interactive operations may be large, batch reporting is used to reduce the number of network requests; Beacon API is used to report such key performance data. As a new feature of HTML5, it allows data to be sent to the server before the page is unloaded. Data can be sent even if the page has been closed, and it does not affect the loading speed of the page.
- the present invention sets different reporting times and methods for tracking points, sets specific reporting methods for different user behaviors and JavaScript resource types, takes into account the front-end pressure in the front-end rendering process, can better decouple business operations from behavior collection, and uses HTML5 and other related technologies for reporting, thereby avoiding unnecessary server processing and bandwidth consumption, saving resources and costs, not blocking the main thread or delaying the unloading of the page, and not affecting the user experience when browsing the page.
- FIG. 3 is a second diagram of a file loading method provided by an embodiment of the present invention.
- the user browsing trajectory is obtained by collecting the user's historical browsing behavior, the buried data is cleaned and analyzed, and the user's historical browsing behavior is classified, and the actual needs of the user are confirmed by statistics.
- it includes three steps from S31 to S33:
- the method of cleaning the collected buried data of the user's historical browsing behavior includes: deleting duplicate records and searching for abnormal values.
- S32 Classify the cleaned data according to preset resource types.
- the preset resource types include the following eight types:
- act_tag1 JavaScript script file
- act_tag2 css style sheet file
- act_tag3 JSON file
- act_tag4 XML file
- act_tag5 picture file.
- the file types of picture files include at least: jpg, png and gif;
- act_tag6 audio file.
- the file types of audio files include at least: mp3, opp;
- act_tag7 video file.
- the file types of video files include at least: mp4 and webm;
- act_tag8 other files.
- the file types of other files include at least: PDF files, SVG vector files, data files, and compressed files.
- S33 For all resources, sort them from small to large according to begin_time to represent the user's behavior trajectory at the time level; sort the classified resources according to the stay time to determine the user's interest preference under the same resource.
- all resources are sorted from small to large according to begin_time, indicating the user's behavior trajectory at the time level; at the same time, the resources after data classification are sorted according to the residence time, so as to determine the user's interest preference under the same resource.
- cleaning the collected user historical browsing behavior data includes deleting duplicate records and searching for abnormal values.
- the deletion rules for duplicate records are as follows:
- the operation of searching for outliers determines whether the residence time is greater than a preset threshold.
- the residence time is greater than 5 seconds, that is, end_time-begin_time>5.
- end_time-begin_time the size of the preset threshold is flexibly set according to actual conditions, and the protection scope of the present invention is not limited thereto.
- the present invention can effectively improve data quality, reduce misleading analysis, and more accurately obtain user behavior through methods such as data cleaning, classification, and sorting.
- the cleaned and classified data is more standardized and accurate, and the data is complete and reasonable, which can reduce subsequent data processing and save computing resources and time.
- the actual needs of the user are mapped into the state space and behavior space in reinforcement learning, and the user behavior is predicted to output the weights of different user behaviors, including:
- Resource tags include at least: scripts, style sheets, JSON, XML, pictures, audio and video files, etc.
- the amount of resources depends on the environment and resources of the current user browsing page;
- the behavior space is defined as the user browsing behavior in the actual needs of the user.
- Predict user behavior based on behavior space and state space and output the weights of different user behaviors.
- the state space is used to represent a set of characteristics or states of the user and the environment
- the user browsing behavior represents the browsing behavior actually required by the user
- the user behavior is predicted based on the behavior space and the state space, and the weights of different user behaviors are output.
- an initialization resource loading sequence is generated according to the user's historical browsing trajectory, the predicted user behavior and the weights of different user behaviors are combined, and the initialization resource loading sequence is iterated multiple times through the user behavior prediction module to obtain a resource loading sequence, including:
- R represents the reward generated under the current resource loading sequence, Indicates the time when the user browses to resource i. Indicates the time when the front-end page finishes loading resource i. represents the difference between the user browsing and rendering time of resource i, and the reward function is the sum of the time differences of all resources;
- the predicted user behavior is combined with the weights of different user behaviors.
- the initial resource loading sequence is iterated multiple times through the user behavior prediction module.
- the reward function tests the user experience of the resource loading sequence, and finally outputs the optimal resource loading decision sequence.
- the present invention combines the user's historical behavior with reinforcement learning, uses a lightweight iteration method and prediction algorithm, performs weight analysis on the user's behavior, and obtains the resource-related loading order.
- Lightweight reinforcement learning applied to user behavior has the advantages of high computational efficiency, easy implementation and debugging, allowing developers to better apply the algorithm to development, and lightweight learning has a lower response time, can make decisions in real time according to the environment, and has better effects for time-sensitive applications.
- the present invention can start from user behavior collection, behavior data reporting, related data cleaning, and user trajectory prediction. It can effectively predict the loading of JavaScript related resources according to the user's historical behavior trajectory, and make reasonable resource loading sequence decisions based on different page resources and user behavior habits. It has a lower response time, does not block the main thread loading, reduces unnecessary resource loss, and improves the user's browsing experience.
- FIG. 4 is a diagram of a file loading device provided by an embodiment of the present invention.
- a second aspect of the present invention provides a file loading device, which includes:
- Monitoring module 41 used to monitor the user's historical browsing behavior by means of code embedding, wherein the user's historical browsing behavior includes: page jump behavior, click behavior, scrolling behavior, search behavior and dwell time;
- Setting module 42 used to set different reporting methods and reporting times for different user historical browsing behaviors
- Statistics module 43 used to obtain the user's historical browsing trajectory by monitoring the user's historical browsing behavior, clean and analyze the buried data and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics;
- Prediction module 44 and output module 45 used to map the actual needs of users into the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources;
- Acquisition module 46 used to generate an initialization resource loading sequence according to the user's historical browsing trajectory, combine the predicted user behavior with the weights of different user behaviors, and iterate the initialization resource loading sequence multiple times through the user behavior prediction module to obtain a resource loading order sequence.
- FIG5 is a schematic block diagram of an electronic device provided by an embodiment of the present invention.
- the electronic device includes: at least one processor 501, at least one memory 502 and at least one communication interface 503.
- the various components in the electronic device are coupled together through a bus system 504.
- the communication interface 503 is used for information transmission between external devices. It can be understood that the bus system 504 is used to achieve connection and communication between these components.
- the bus system 504 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as bus system 504 in FIG5 .
- the memory 502 in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
- the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system and application programs.
- the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks.
- the application includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services.
- a program that implements any of the file loading methods provided in an embodiment of the present invention can be included in the application.
- the processor 501 calls a program or instruction stored in the memory 502, specifically, a program or instruction stored in an application, and the processor 501 is used to execute the steps of each embodiment of a file loading method provided in an embodiment of the present invention.
- Use code tracking to monitor user browsing history including page jumps, clicks, scrolling, searches, and dwell time.
- Obtain the user's historical browsing track by monitoring the user's historical browsing behavior, clean and analyze the buried data, and classify the user's historical browsing behavior, and confirm the user's actual needs through statistics;
- An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior and the weights of different user behaviors are combined together. The initial resource loading sequence is iterated multiple times through the user behavior prediction module to obtain a resource loading order sequence.
- the processor 501 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 501 or instructions in the form of software.
- the above-mentioned processor 501 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
- DSP Digital Signal Processor
- ASIC Application Specific Integrated Circuit
- FPGA Field Programmable Gate Array
- the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
- any method in a file loading method can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software units in the decoding processor.
- the software unit can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc.
- the storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the method in combination with its hardware.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Debugging And Monitoring (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明涉及一种文件加载方法、装置、电子设备和存储介质,属于文件加载技术领域,该方法包括:监控用户历史浏览行为,设定不同的上报方式与上报时机;通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;将用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块进行多轮的迭代,获得资源加载顺序序列。本发明所述的方法、装置、电子设备和存储介质,减少文件加载的时间。
Description
本申请要求于2023年12月06日申请的,申请号为CN202311666484.9、名称为“一种文件加载方法和装置”的中国专利申请的优先权,在此将其全文引入作为参考。
本发明属于文件加载技术领域,尤其涉及一种文件加载方法、装置、电子设备和存储介质。
由于当前互联网技术发展迅速,过多的HTTP(Hypertext Transfer Protocol,超文本传输协议)请求、长时间对JavaScript线程的占用以及资源加载过程中存在的拥堵,造成页面加载缓慢,影响用户体验。目前存在较多的前端性能优化方案,比如资源的压缩与合并、网络连接及资源加载的优化等。在加载前端页面过程中,大多发明聚焦于数据标识的设计以便快速查找缓存与资源模块,但通过用户行为及实际需要的记录与预测进行JavaScript的资源加载的相关发明较少,因此作为本发明的发明动机。
现有页面加载优化的相关发明中,通常分为资源的数据标识设计、缓存查询操作、DOM(Document Object Model,文档对象模型)树构建方式,提高页面加载速度从而提升用户体验。专利CN112181532A设计一种页面资源加载方案,根据页面资源加载请求获取页面资源的预加载参数,根据预加载参数是否满足预加载条件进行资源文件的获取,其中包括从本地获取以及从资源文件中加载预加载参数对应的页面资源。专利CN111666497A主要设计页面的访问指令,基于访问指令在预存的资源数据库中进行查找相关文件。上述专利侧重资源侧、渲染侧的设计,重点考虑如何高效获取资源从而优化用户需求与体验。
专利CN110377361A设计不同的数据表示,根据数据表示展示相应的数据,从而节约内存空间,从而提升用户体验。专利CN116225567A通过收集用户行为进行预加载页面的预测结果,采用多层感知机进行预测,但多层感知机可能会随着层数的增加出现过拟合、参数难以调试的问题。上述专利主要针对预加载资源选择进行发明研究,但对于用户行为及需求考虑较少。
现有页面渲染背景下涉及用户行为的相关发明中,通常分为埋点设计、真实可视界面滚动检测、记录用户操作轨迹等策略,该类发明大多侧重于用户操作行为的记录,对于用户行为的预测较少。因此,本发明提出一种基于用户行为的JavaScript文件混合加载方法,通过用户历史行为感知、用户实际需求获取、用户行为预测、资源加载顺序决策等模块,结合资源预加载和按需加载方式,获得最终资源加载序列。页面加载过程中,根据资源加载序列预加载一部分JavaScript文件,按需加载其他文件,以实现更精确的资源加载控制和优化。
鉴于以上现有技术的不足,发明的目的在于提供云桌面重复按键处理方法、装置、电子设备和存储介质,将用户历史行为轨迹与强化学习结合,进行合理的资源加载预测,从而获得最优的JavaScript加载序列,该方法能够减少页面加载的时间,同时避免阻塞渲染,从而避免不同脚本的资源冲突,确保页面正常运行,提高用户体验。
本发明的第一方面,提出了一种文件加载方法,包括:
采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;
对于不同的用户历史浏览行为设定不同的上报方式与上报时机;
通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;
将所述用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;
根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
进一步地,上述一种文件加载方法中,采用代码埋点的方式监控用户历史浏览行为,包括:
在关键行为节点手动添加埋点代码;
对于用户的点击行为、滚动行为、搜索行为使用JavaScript中事件监听器与回调函数的方式引入埋点脚本;
对于停留时间,分别使用user_id、user_name表示用户ID和用户名称,使用page_path、page_title表示当前页面的路径与页面标题,使用event_type、act_tag、begin_time、end_time表示当前的事件类型,资源标签、开始时间和结束时间。
进一步地,上述一种文件加载方法中,对于不同的用户历史浏览行为设定不同的上报方式与上报时机,包括:
页面跳转行为采用WebSocket上报机制进行同步上报,前后端建立长连接,前端将用户页面跳转的相关数据传给服务器;
点击行为和所述搜索行为采用Batch机制进行异步上报,Batch机制将前端收集到的用户轨迹使用数据队列进行缓存,当数据量达到阈值data_threshold后进行上报;
滚动行为和停留行为,对应资源达到页面预设虚拟视区、用户停留某资源多于预设时间,采用Beacon API的方式对性能数据进行上报;
对于上报的内容,采用统一字段标识与表层结构。
进一步地,上述一种文件加载方法中,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求,包括:
对采集到的用户历史浏览行为的埋点数据进行清洗;
对清洗后的数据按照预设资源类型进行分类;
对于所有资源,按照begin_time从小到大进行排序,表示时间层面用户的行为轨迹,对分类后的资源按照停留时间进行排序,确定同种资源下用户的兴趣偏好;
其中,对采集到的用户历史浏览行为数据进行清洗包括删除重复记录、搜索异常值的操作,对于重复记录的删除规则如下:
滚动行为中,删除页面渲染首屏相关的用户行为数据;
若存在同个资源的滚动行为与停留行为数据,只保留停留用户行为数据;
若存在同个资源的点击行为与停留行为数据,只保留点击行为数据;
若存在同个资源的搜索行为与停留行为数据,只保留搜索行为数据;
搜索异常值的操作,确定停留时间是否大于预设阈值。
进一步地,上述一种文件加载方法中,将用户实际需求映射为强化学习中状态空间和行为空间,并通对用户行为进行预测,输出用户不同行为下的权重,包括:
将用户实际需求映射为强化学习的状态空间,其中状态空间以统一资源标签为特征,资源标签至少包括:脚本、样式表、JSON、XML、图片和音视频文件等,资源的多少取决于当前用户浏览页面的环境及资源;
将行为空间定义为用户实际需求中的用户浏览行为,用户浏览行为表示为A={a1,a2,…,an},其中,A表示当前用户的浏览资源集合,an表示用户浏览的第n个资源;
根据行为空间与状态空间对用户行为进行预测,输出用户不同行为下的权重。
进一步地,上述一种文件加载方法中,根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列,包括:
定义奖励函数为:其中,R表示当前资源加载序列下产生的奖励,表示用户浏览到资源i的时间,表示前端页面加载完毕资源i的时间,表示资源i的用户浏览与渲染时间之差,奖励函数为所有资源的时间差之和;
将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,奖励函数测试所得的资源加载序列对用户的体验感,最终输出最佳的资源加载决策序列。
进一步地,上述一种文件加载方法中,预设资源类型包括:
act_tag1:JavaScript脚本文件;
act_tag2:css样式表文件;
act_tag3:JSON文件;
act_tag4:XML文件;
act_tag5:图片文件,图片文件的文件类型至少包括:jpg、png和gif;
act_tag6:音频文件,音频文件的文件类型至少包括:mp3、opp;
act_tag7:视频文件,视频文件的文件类型至少包括:mp4、webm;
act_tag8:其他文件,其他文件的文件类型至少包括:PDF文件、SVG矢量文件、数据文件、压缩文件。
本发明的第二方面,提出了一种文件加载装置,包括:
监控模块:用于采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;
设定模块:用于对于不同的用户历史浏览行为设定不同的上报方式与上报时机;
统计模块:用于通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;
预测模块和输出模块:用于将所述用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;
获得模块:用于根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
本发明的第三方面,还提出了一种电子设备,包括:处理器和存储器;
所述处理器通过调用所述存储器存储的程序或指令,用于执行如上所述任一项所述一种文件加载方法。
本发明的第四方面,还提出了一种计算机可读存储介质,所述计算机可读存储介质存储程序或指令,所述程序或指令使计算机执行如上所述任一项所述一种文件加载方法。
本发明的有益效果如下:本发明通过采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;对于不同的用户历史浏览行为设定不同的上报方式与上报时机;通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;将用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。本发明将用户历史行为轨迹与强化学习结合,进行合理的资源加载预测,从而获得最优的JavaScript加载序列,该方法能够减少页面加载的时间,同时避免阻塞渲染,从而避免不同脚本的资源冲突,确保页面正常运行,提高用户体验。
附图仅用于示出具体实施例的目的,而并不认为是对本发明的限制,在整个附图中,相同的参考符号表示相同的部件。显而易见地,下面描述中的附图仅仅是本发明实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种文件加载方法图一;
图2为本发明实施例提供的监控用户历史浏览行为示意图;
图3为本发明实施例提供的一种文件加载方法图二;
图4为本发明实施例提供的一种文件加载装置图;
图5为本发明实施例提供的一种电子设备的示意性框图。
为了使本领域的人员更好地理解本发明实施例中的技术方案,下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。应该理解,这些描述只是示例性的,并非用于限定本发明的范围。基于本发明的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。
此外,在以下说明中,省略了对公知结构和技术的描述,以避免不必要地混淆本发明公开的概念。
在本发明的描述中,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的方法和系统的例子。
本发明提出了一种文件加载方法、装置、电子设备和存储介质,将用户历史行为轨迹与强化学习结合,进行合理的资源加载预测,从而获得最优的JavaScript加载序列,该方法能够减少页面加载的时间,同时避免阻塞渲染,从而避免不同脚本的资源冲突,确保页面正常运行,提高用户体验。
方法实施例
在介绍本发明之前,先介绍本发明涉及到的专业术语。
JavaScript(简称JS):是一种具有函数优先的轻量级,解释型或即时编译型的编程语言。JavaScript基于原型编程、多范式的动态脚本语言,并且支持面向对象、命令式、声明式、函数式编程范式。其主要功能有:在HTML(Hyper Text Markup Language,超文本标记语言)页面中嵌入动态文本、对浏览器事件做出相应、读写HTML元素等。作为一种网络的高级脚本语言,广泛应用于前端应用开发。
强化学习(Reinforcement Learning,简称RL):强化学习作为机器学习分支的一种,用于描述和解决智能体在与环境的交互过程中通过学习策略,从而达成回报最大化或实现特定目标的问题。
预加载:资源预加载作为性能优化技术的一种,将所有所需的资源提前请求并加载到本地,网页加载过程中直接从缓存中获取该类资源,为用户提高更好的体验,减少页面加载过程中的等待时间。
按需加载:按需加载作为性能优化其中的一个环节,根据用户当前需要的功能加载相应代码。浏览器在同一时间内发出的请求次数有限,一次性加载所有功能对应的代码,会造成进入单页面系统产生首页白屏时间较长的情况。在JS中,通常通过一些用户行为或者定时任务触发加载动作,从而优化用户体验。
图1为本发明实施例提供的一种文件加载方法图一。
图2为本发明实施例提供的监控用户历史浏览行为示意图。
本发明的第一方面,提出了一种文件加载方法,结合图1和图2,包括S1至S5五个步骤:
S1:采用代码埋点的方式监控用户历史浏览行为,用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间。
具体的,本发明实施例中,在前端采用代码埋点的方式来监控用户历史浏览行为,应理解,页面跳转行为作为用户浏览当前页面的开始节点,点击与搜索行为表示用户对某个资源具有较大的兴趣,滚动行为可以通过监听用户在页面上的滚动操作,从而了解用户的阅读的浏览行为。停留时间可以用来衡量用户的兴趣。
S2:对于不同的用户历史浏览行为设定不同的上报方式与上报时机。
具体的,本发明实施例中,对于页面跳转行为、点击行为、滚动行为、搜索行为与停留时间设定不同的上报方式与上报时机,如页面跳转行为采用WebSocket上报机制进行同步上报,前后端建立长连接,前端将用户页面跳转的相关数据传给服务器。
S3:通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求。
具体的,本发明实施例中,对埋点数据进行清洗、分析、用户行为分类,通过统计确认用户实际需求的方法下文详细介绍。
S4:将用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重。
具体的,本发明实施例中,将用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重的方法下文详细介绍。
S5:根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
具体的,本发明实施例中,根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列的方法下文详细介绍。
进一步地,上述一种文件加载方法中,采用代码埋点的方式监控用户历史浏览行为,包括:
在关键行为节点手动添加埋点代码;
对于用户的点击行为、滚动行为、搜索行为使用JavaScript中事件监听器与回调函数的方式引入埋点脚本;
对于停留时间,分别使用user_id、user_name表示用户ID和用户名称,使用page_path、page_title表示当前页面的路径与页面标题,使用event_type、act_tag、begin_time、end_time表示当前的事件类型,资源标签、开始时间和结束时间。
具体的,本发明实施例中,采用代码埋点的方式监控用户历史浏览行为,对于不同的行为添加埋点代码的方式不一样。
进一步地,上述一种文件加载方法中,对于不同的用户历史浏览行为设定不同的上报方式与上报时机,包括:
页面跳转行为采用WebSocket上报机制进行同步上报,前后端建立长连接,前端将用户页面跳转的相关数据传给服务器;
点击行为和搜索行为采用Batch机制进行异步上报,Batch机制将前端收集到的用户轨迹使用数据队列进行缓存,当数据量达到阈值data_threshold后进行上报;
滚动行为和停留行为,对应资源达到页面预设虚拟视区、用户停留某资源多于预设时间,采用Beacon API的方式对性能数据进行上报;
对于上报的内容,采用统一字段标识与表层结构。
具体的,本发明实施例中,当数据量达到阈值data_threshold后进行上报,由于用户的交互操作可能较多,因此使用批量上报方式从而减少网络请求次数;采用Beacon API的方式对此类关键性能数据进行上报,作为HTML5的新特性,它允许在页面卸载前发送数据到服务器,即使页面已经关闭也可以发送数据,并且不影响页面的加载速度。
应理解,本发明通过设定不同的埋点上报时机与方式,为不同的用户行为与JavaScript资源类型设定特定的上报方式,考虑前端渲染过程中的前端压力,能够较好地将业务操作与行为采集解耦,采用HTML5及其他相关技术进行上报,避免服务器不必要的处理和带宽消耗,节省资源和成本,不阻塞主线程或延迟页面的卸载,不影响用户浏览页面过程中的用户体验。
图3为本发明实施例提供的一种文件加载方法图二。
进一步地,上述一种文件加载方法中,通过采集用户历史浏览行为获取用户浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求,结合图3,包括S31至S33三个步骤:
S31:对采集到的用户历史浏览行为的埋点数据进行清洗。
具体的,本发明实施例中,对采集到的用户历史浏览行为的埋点数据进行清洗的方式包括:删除重复记录和搜索异常值的操作。
S32:对清洗后的数据按照预设资源类型进行分类。
具体的,本发明实施例中,预设资源类型,包括如下八种:
act_tag1:JavaScript脚本文件;
act_tag2:css样式表文件;
act_tag3:JSON文件;
act_tag4:XML文件;
act_tag5:图片文件,图片文件的文件类型至少包括:jpg、png和gif;
act_tag6:音频文件,音频文件的文件类型至少包括:mp3、opp;
act_tag7:视频文件,视频文件的文件类型至少包括:mp4、webm;
act_tag8:其他文件,其他文件的文件类型至少包括:PDF文件、SVG矢量文件、数据文件、压缩文件。
S33:对于所有资源,按照begin_time从小到大进行排序,表示时间层面用户的行为轨迹;对分类后的资源按照停留时间进行排序,确定同种资源下用户的兴趣偏好。
具体的,本发明实施例中,对于所有资源,按照begin_time从小到大进行排序,表示时间层面用户的行为轨迹;同时针对数据分类后的资源按照停留时间进行排序,从而确定同种资源下用户的兴趣偏好。
其中,对采集到的用户历史浏览行为数据进行清洗包括删除重复记录、搜索异常值的操作,对于重复记录的删除规则如下:
滚动行为中,删除页面渲染首屏相关的用户行为数据;
若存在同个资源的滚动行为与停留行为数据,只保留停留用户行为数据;
若存在同个资源的点击行为与停留行为数据,只保留点击行为数据;
若存在同个资源的搜索行为与停留行为数据,只保留搜索行为数据;
搜索异常值的操作,确定停留时间是否大于预设阈值。
具体的,本发明实施例中,对于异常值的操作,主要确定停留时间是否大于5秒,即end_time-begin_time>5,应理解,预设阈值的大小根据实际情况灵活设定,并不以此限定本发明的保护范围。
应理解,本发明通过数据清洗、分类、排序等方法,能够有效提高数据质量,减少误导性分析,更准确地获取用户行为,清洗与分类后的数据更加规范与准确,数据具有完备性与合理性,可以减少后期的数据处理,节约计算资源与时间。
进一步地,上述一种文件加载方法中,将用户实际需求映射为强化学习中状态空间和行为空间,并通对用户行为进行预测,输出用户不同行为下的权重,包括:
将用户实际需求映射为强化学习的状态空间,其中状态空间以统一资源标签为特征,资源标签至少包括:脚本、样式表、JSON、XML、图片和音视频文件等,资源的多少取决于当前用户浏览页面的环境及资源;
将行为空间定义为用户实际需求中的用户浏览行为,用户浏览行为表示为A={a1,a2,…,an},其中,A表示当前用户的浏览资源集合,an表示用户浏览的第n个资源;
根据行为空间与状态空间对用户行为进行预测,输出用户不同行为下的权重。
具体的,本发明实施例中,状态空间用来表示用户和环境的特征或状态的集合,用户浏览行为表示用户实际需求的浏览行为,用户浏览行为可以表示为A={a1,a2,…,an},其中,A表示当前用户的浏览资源集合,an表示用户浏览的第n个资源,根据行为空间与状态空间对用户行为进行预测,输出用户不同行为下的权重。
进一步地,上述一种文件加载方法中,根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列,包括:
定义奖励函数为:其中,R表示当前资源加载序列下产生的奖励,表示用户浏览到资源i的时间,表示前端页面加载完毕资源i的时间,表示资源i的用户浏览与渲染时间之差,奖励函数为所有资源的时间差之和;
将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,奖励函数测试所得的资源加载序列对用户的体验感,最终输出最佳的资源加载决策序列。
应理解,本发明将用户的历史行为与强化学习相结合,采用轻量级的迭代方式与预测算法,对用户行为进行权重分析,得到资源相关的加载顺序。轻量级的强化学习应用于用户行为方面具有计算效率高、易于实现与调试的优点,使得开发人员能够更好的将算法应用于开发中,并且轻量级的学习具有较低的响应时间,能够实时根据环境做出决策,对于时间敏感的应用具有更好的效果。
综上:本发明能够从用户行为采集、行为数据上报、相关数据清理、用户轨迹预测方面入手,能够有效根据用户历史行为轨迹对JavaScript相关资源进行加载资源预测,针对不同的页面资源与用户行为习惯做出合理的资源加载顺序决策,具有较低的响应时间,不阻塞主线程加载,减少不必要的资源损耗,同时提高用户的浏览体验。
装置实施例
图4为本发明实施例提供的一种文件加载装置图。
本发明的第二方面,提出了一种文件加载装置,结合图4,包括:
监控模块41:用于采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;
设定模块42:用于对于不同的用户历史浏览行为设定不同的上报方式与上报时机;
统计模块43:用于通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;
预测模块44和输出模块45:用于将用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;
获得模块46:用于根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
图5是本发明实施例提供的一种电子设备的示意性框图。
如图5所示,电子设备包括:至少一个处理器501、至少一个存储器502和至少一个通信接口503。电子设备中的各个组件通过总线系统504耦合在一起。通信接口503,用于与外部设备之间的信息传输。可理解,总线系统504用于实现这些组件之间的连接通信。总线系统504除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但为了清楚说明起见,在图5中将各种总线都标为总线系统504。
可以理解,本实施例中的存储器502可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。
在一些实施方式中,存储器502存储了如下的元素,可执行单元或者数据结构,或者他们的子集,或者他们的扩展集:操作系统和应用程序。
其中,操作系统,包含各种系统程序,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务。应用程序,包含各种应用程序,例如媒体播放器(Media Player)、浏览器(Browser)等,用于实现各种应用业务。实现本发明实施例提供的一种文件加载方法中任一方法的程序可以包含在应用程序中。
在本发明实施例中,处理器501通过调用存储器502存储的程序或指令,具体的,可以是应用程序中存储的程序或指令,处理器501用于执行本发明实施例提供的一种文件加载方法各实施例的步骤。
采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;
对于不同的用户历史浏览行为设定不同的上报方式与上报时机;
通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;
将所述用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;
根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
本发明实施例提供的一种文件加载方法中任一方法可以应用于处理器501中,或者由处理器501实现。处理器501可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器501中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器501可以是通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
本发明实施例提供的一种文件加载方法中任一方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件单元组合执行完成。软件单元可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器502,处理器501读取存储器502中的信息,结合其硬件完成方法的步骤。
本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。
本领域的技术人员能够理解,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
虽然结合附图描述了本发明的实施方式,但是本领域技术人员可以在不脱离本发明的精神和范围的情况下做出各种修改和变型,这样的修改和变型均落入由所附权利要求所限定的范围之内以上,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。
以上,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。
Claims (10)
- 一种文件加载方法,其特征在于,包括:采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;对于不同的用户历史浏览行为设定不同的上报方式与上报时机;通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;将所述用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
- 根据权利要求1所述的一种文件加载方法,其特征在于,采用代码埋点的方式监控用户历史浏览行为,包括:在关键行为节点手动添加埋点代码;对于用户的点击行为、滚动行为、搜索行为使用JavaScript中事件监听器与回调函数的方式引入埋点脚本;对于停留时间,分别使用user_id、user_name表示用户ID和用户名称,使用page_path、page_title表示当前页面的路径与页面标题,使用event_type、act_tag、begin_time、end_time表示当前的事件类型,资源标签、开始时间和结束时间。
- 根据权利要求1所述的一种文件加载方法,其特征在于,所述对于不同的用户历史浏览行为设定不同的上报方式与上报时机,包括:所述页面跳转行为采用WebSocket上报机制进行同步上报,前后端建立长连接,前端将用户页面跳转的相关数据传给服务器;所述点击行为和所述搜索行为采用Batch机制进行异步上报,Batch机制将前端收集到的用户轨迹使用数据队列进行缓存,当数据量达到阈值data_threshold后进行上报;所述滚动行为和所述停留行为,对应资源达到页面预设虚拟视区、用户停留某资源多于预设时间,采用Beacon API的方式对性能数据进行上报;对于上报的内容,采用统一字段标识与表层结构。
- 根据权利要求1所述的一种文件加载方法,其特征在于,所述对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求,包括:对采集到的用户历史浏览行为的埋点数据进行清洗;对清洗后的数据按照预设资源类型进行分类;对于所有资源,按照begin_time从小到大进行排序,表示时间层面用户的行为轨迹,对分类后的资源按照停留时间进行排序,确定同种资源下用户的兴趣偏好;其中,对采集到的用户历史浏览行为数据进行清洗包括删除重复记录、搜索异常值的操作,对于重复记录的删除规则如下:滚动行为中,删除页面渲染首屏相关的用户行为数据;若存在同个资源的滚动行为与停留行为数据,只保留停留用户行为数据;若存在同个资源的点击行为与停留行为数据,只保留点击行为数据;若存在同个资源的搜索行为与停留行为数据,只保留搜索行为数据;搜索异常值的操作,确定停留时间是否大于预设阈值。
- 根据权利要求1所述的一种文件加载方法,其特征在于,所述将所述用户实际需求映射为强化学习中状态空间和行为空间,并通对用户行为进行预测,输出用户不同行为下的权重,包括:将用户实际需求映射为强化学习的状态空间,其中状态空间以统一资源标签为特征,资源标签至少包括:脚本、样式表、JSON、XML、图片和音视频文件等,资源的多少取决于当前用户浏览页面的环境及资源;将行为空间定义为用户实际需求中的用户浏览行为,用户浏览行为表示为A={a1,a2,…,an},其中,A表示当前用户的浏览资源集合,an表示用户浏览的第n个资源;根据行为空间与状态空间对用户行为进行预测,输出用户不同行为下的权重。
- 根据权利要求1所述的一种文件加载方法,其特征在于,所述根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列,包括:定义奖励函数为:其中,R表示当前资源加载序列下产生的奖励,表示用户浏览到资源i的时间,表示前端页面加载完毕资源i的时间,表示资源i的用户浏览与渲染时间之差,奖励函数为所有资源的时间差之和;将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,奖励函数测试所得的资源加载序列对用户的体验感,最终输出最佳的资源加载决策序列。
- 根据权利要求4所述的一种文件加载方法,其特征在于,所述预设资源类型包括:act_tag1:JavaScript脚本文件;act_tag2:css样式表文件;act_tag3:JSON文件;act_tag4:XML文件;act_tag5:图片文件,图片文件的文件类型至少包括:jpg、png和gif;act_tag6:音频文件,音频文件的文件类型至少包括:mp3、opp;act_tag7:视频文件,视频文件的文件类型至少包括:mp4、webm;act_tag8:其他文件,其他文件的文件类型至少包括:PDF文件、SVG矢量文件、数据文件、压缩文件。
- 一种文件加载装置,其特征在于,包括:监控模块:用于采用代码埋点的方式监控用户历史浏览行为,所述用户历史浏览行为包括:页面跳转行为、点击行为、滚动行为、搜索行为与停留时间;设定模块:用于对于不同的用户历史浏览行为设定不同的上报方式与上报时机;统计模块:用于通过监控用户历史浏览行为获取用户历史浏览轨迹,对埋点数据进行清洗、分析并对用户历史浏览行为进行分类,通过统计确认用户实际需求;预测模块和输出模块:用于将所述用户实际需求映射为强化学习中状态空间和行为空间,对用户行为进行预测,输出用户对于不同资源的需求权重;获得模块:用于根据用户历史浏览轨迹生成初始化资源加载序列,将预测得到的用户行为与用户不同行为下的权重结合在一起,通过用户行为预测模块对初始化资源加载序列进行多轮的迭代,获得资源加载顺序序列。
- 一种电子设备,其特征在于,包括:处理器和存储器;所述处理器通过调用所述存储器存储的程序或指令,用于执行如权利要求1至7任一项所述一种文件加载方法。
- 一种计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储程序或指令,所述程序或指令使计算机执行如权利要求1至7任一项所述一种文件加载方法。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311666484.9A CN117873583B (zh) | 2023-12-06 | 2023-12-06 | 一种文件加载方法和装置 |
| CN202311666484.9 | 2023-12-06 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025119342A1 true WO2025119342A1 (zh) | 2025-06-12 |
Family
ID=90595538
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2024/137492 Pending WO2025119342A1 (zh) | 2023-12-06 | 2024-12-06 | 一种文件加载方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN117873583B (zh) |
| WO (1) | WO2025119342A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121350372A (zh) * | 2025-12-19 | 2026-01-16 | 浪潮云洲工业互联网有限公司 | 一种虚拟列表动态渲染方法、系统、设备及介质 |
| CN121387683A (zh) * | 2025-09-26 | 2026-01-23 | 中科世通亨奇(北京)科技有限公司 | 基于人工智能技术的前端用户行为预测方法及装置 |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117873583B (zh) * | 2023-12-06 | 2025-10-31 | 天翼云科技有限公司 | 一种文件加载方法和装置 |
| CN118626171B (zh) * | 2024-06-21 | 2025-02-25 | 杭州行至云起科技有限公司 | 一种资源文件的加载方法、装置以及系统 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110532479A (zh) * | 2019-09-05 | 2019-12-03 | 北京思维造物信息科技股份有限公司 | 一种信息推荐方法、装置及设备 |
| CN113268695A (zh) * | 2021-05-31 | 2021-08-17 | 平安国际智慧城市科技股份有限公司 | 数据埋点处理方法、装置及相关设备 |
| CN113689257A (zh) * | 2021-08-09 | 2021-11-23 | 青岛海尔科技有限公司 | 一种用户行为埋点构建方法及系统 |
| WO2022126901A1 (zh) * | 2020-12-18 | 2022-06-23 | 平安科技(深圳)有限公司 | 一种商品推荐方法及其相关设备 |
| CN116484134A (zh) * | 2023-03-27 | 2023-07-25 | 清华大学 | 一种网页加速处理方法及系统 |
| CN117873583A (zh) * | 2023-12-06 | 2024-04-12 | 天翼云科技有限公司 | 一种文件加载方法和装置 |
Family Cites Families (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10846193B2 (en) * | 2017-12-01 | 2020-11-24 | Dynatrace Llc | Method and system for real-user capable detecting of the visual completeness of browser rendering process |
| CN111190654B (zh) * | 2019-12-30 | 2022-05-03 | 网易(杭州)网络有限公司 | 功能模块的加载方法、装置、存储介质和电子装置 |
| CN113297515B (zh) * | 2020-07-16 | 2025-03-07 | 阿里巴巴集团控股有限公司 | 资源信息的处理方法和装置,计算机存储介质和电子设备 |
| CN112347367B (zh) * | 2020-12-04 | 2024-05-07 | 上海帜讯信息技术股份有限公司 | 信息服务提供方法、装置、电子设备和存储介质 |
| CN112612552B (zh) * | 2020-12-31 | 2023-05-23 | 五八有限公司 | 应用程序资源加载方法、装置、电子设备及可读存储介质 |
| CN115828017A (zh) * | 2022-11-24 | 2023-03-21 | 邹位 | 用于网页浏览控制的信息解析系统 |
| CN116029757B (zh) * | 2022-12-30 | 2025-10-14 | 天翼云科技有限公司 | 一种基于深度学习的运营策略触发方法、装置和电子设备 |
| CN116225567A (zh) * | 2023-02-09 | 2023-06-06 | 平安付科技服务有限公司 | 页面加载方法、装置、存储介质及计算机设备 |
| CN116522031A (zh) * | 2023-05-04 | 2023-08-01 | 康键信息技术(深圳)有限公司 | 网页页面区域模块的点击流量预测方法、装置、设备及介质 |
-
2023
- 2023-12-06 CN CN202311666484.9A patent/CN117873583B/zh active Active
-
2024
- 2024-12-06 WO PCT/CN2024/137492 patent/WO2025119342A1/zh active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110532479A (zh) * | 2019-09-05 | 2019-12-03 | 北京思维造物信息科技股份有限公司 | 一种信息推荐方法、装置及设备 |
| WO2022126901A1 (zh) * | 2020-12-18 | 2022-06-23 | 平安科技(深圳)有限公司 | 一种商品推荐方法及其相关设备 |
| CN113268695A (zh) * | 2021-05-31 | 2021-08-17 | 平安国际智慧城市科技股份有限公司 | 数据埋点处理方法、装置及相关设备 |
| CN113689257A (zh) * | 2021-08-09 | 2021-11-23 | 青岛海尔科技有限公司 | 一种用户行为埋点构建方法及系统 |
| CN116484134A (zh) * | 2023-03-27 | 2023-07-25 | 清华大学 | 一种网页加速处理方法及系统 |
| CN117873583A (zh) * | 2023-12-06 | 2024-04-12 | 天翼云科技有限公司 | 一种文件加载方法和装置 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121387683A (zh) * | 2025-09-26 | 2026-01-23 | 中科世通亨奇(北京)科技有限公司 | 基于人工智能技术的前端用户行为预测方法及装置 |
| CN121350372A (zh) * | 2025-12-19 | 2026-01-16 | 浪潮云洲工业互联网有限公司 | 一种虚拟列表动态渲染方法、系统、设备及介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN117873583A (zh) | 2024-04-12 |
| CN117873583B (zh) | 2025-10-31 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112486708B (zh) | 页面操作数据的处理方法和处理系统 | |
| CN117873583B (zh) | 一种文件加载方法和装置 | |
| US9787795B2 (en) | System for prefetching digital tags | |
| US10503710B2 (en) | Webpage pre-reading method, apparatus and smart terminal | |
| US7801891B2 (en) | System and method for collecting user interest data | |
| JP5786105B2 (ja) | 情報処理装置、情報処理方法、情報処理プログラム、表示制御装置、および表示制御プログラム | |
| CN111813629B (zh) | 一种Web页面的监控数据生成方法、装置及设备 | |
| CA2917048C (en) | Method and apparatus for determining user browsing behavior | |
| CN110309463B (zh) | 落地页优化方法、装置、计算机存储介质及网络设备 | |
| CN108334641B (zh) | 采集用户行为数据的方法、系统、电子设备、存储介质 | |
| CN103530292A (zh) | 网页显示方法和装置 | |
| CN115563423B (zh) | 数据采集方法、装置、计算机设备及存储介质 | |
| CN109688184A (zh) | 基于日志的资源调整方法、设备、存储介质及装置 | |
| CN107483443B (zh) | 广告信息处理方法、客户端、存储介质和电子设备 | |
| CN118551128B (zh) | 页面资源的加载方法和装置、存储介质及电子设备 | |
| CN120687692A (zh) | 一种基于流式数据的页面渐进式渲染方法及系统 | |
| CN120470168A (zh) | 一种基于浏览器渲染的网站地图爬虫方法及装置 | |
| CN116226557B (zh) | 待标注数据的拾取方法、装置、电子设备和存储介质 | |
| CN119201271A (zh) | 页面加载方法、装置、计算机设备及存储介质 | |
| CN117573998A (zh) | 一种浏览器多标签页显示的web系统 | |
| WO2023169165A1 (zh) | 访问数据处理方法和装置、电子设备、计算机可读介质 | |
| CN115314404B (zh) | 服务优化方法、装置、计算机设备及存储介质 | |
| CN113220958B (zh) | 页面信息展示方法、系统及存储介质 | |
| CN117493113B (zh) | 数据上报方法、装置、计算机设备和存储介质 | |
| KR102716392B1 (ko) | 웹 로그 분석 솔루션 시스템 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24899975 Country of ref document: EP Kind code of ref document: A1 |