Module loading method, device, electronic device and storage medium
By building a module loading strategy prediction model, obtaining the loading strategy based on user information and loading the module, the problem of slow loading speed of front-end web application modules is solved, the loading speed is improved and the application size is reduced.
Patent Information
- Application Number
- CN202411198687.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-08-29
AI Technical Summary
In the prior art, the front-end web application module loads slowly, resulting in a poor user experience, especially in medium and large-scale applications that occupy a lot of resources and have high performance requirements.
By building a module loading strategy prediction model, the module loading strategy is obtained according to user information, and modules are loaded based on the strategy. The application is pre-packaged and deployed according to the strategy to reduce unnecessary module loading.
It improves module loading speed, reduces application size, and improves user experience.
Smart Images

Figure CN119201265B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a module loading method, device, electronic device, and storage medium. Background Art
[0002] In modern front-end web projects, as projects evolve and functionality becomes increasingly complex, web applications rely on a growing number of resources and modules, leading to an increasing size of front-end applications. When users use certain features or request certain resources, multiple dependent resources and modules need to be loaded, and this loading process can be slow, significantly impacting the user experience.
[0003] In the prior art, in order to speed up loading, all functional modules are loaded before the application is started. However, for some medium and large-scale applications, this will occupy more resources, have higher performance requirements, and the module loading effect is not ideal. Summary of the Invention
[0004] In view of this, the present application provides a module loading method, device, electronic device and storage medium to solve the problem of unsatisfactory module loading effect in the prior art.
[0005] To achieve the above objectives, this application provides the following technical solutions:
[0006] In a first aspect, the present application discloses a module loading method, which is applied to a gateway. The module loading method includes:
[0007] Upon receiving a user's access request, obtaining the user's user information; wherein the user information includes user permissions and user historical routing information;
[0008] Inputting the user information into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to characterize the functional modules that the user needs to load;
[0009] The access request is sent to the application for which the module loading policy is set to trigger the application to respond to the access request and load the module based on the module loading policy; wherein each application corresponds to a module loading policy, and each application is pre-packaged and deployed according to the corresponding module loading policy.
[0010] Optionally, in the above method, the process of constructing the module loading strategy prediction model includes:
[0011] Acquire sample data of user groups; wherein the sample data includes user information sample data and function module loading strategy sample data;
[0012] Performing data preprocessing on the sample data of the user groups;
[0013] Inputting the user information sample data into the initial model for calculation to obtain the function module loading strategy corresponding to the current user information sample data;
[0014] Determine whether the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data;
[0015] If the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, then the construction of the module loading strategy prediction model is completed;
[0016] If the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, a loss function is calculated, and the parameters of the initial model are adjusted based on the loss function until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, and the construction of the module loading strategy prediction model is completed.
[0017] Optionally, in the above method, each application is pre-packaged and deployed according to a corresponding module loading strategy, including:
[0018] For each application, determine the module loading strategy corresponding to the current application;
[0019] Optimizing the code of the current application based on the module loading strategy corresponding to the current application, and packaging the application with optimized code;
[0020] Deploy the code-optimized application to a Web server.
[0021] Optionally, the above method further includes:
[0022] If user feedback information is received, the module loading strategy prediction model is optimized based on the user feedback information.
[0023] A second aspect of the present application provides a module loading device, which is applied to a gateway, wherein the module loading device includes:
[0024] An acquiring unit, configured to acquire user information of a user upon receiving an access request from the user; wherein the user information includes user authority and user historical routing information;
[0025] A processing unit, configured to input the user information into a pre-built module loading strategy prediction model for processing, and obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to characterize the functional modules that the user needs to load;
[0026] A sending unit is used to send the access request to the application program for which the module loading policy is set, so as to trigger the application program to respond to the access request and load the module based on the module loading policy; wherein each application program corresponds to a module loading policy, and each application program is pre-packaged and deployed according to the corresponding module loading policy.
[0027] Optionally, the processing unit of the above-mentioned device includes:
[0028] An acquisition subunit, configured to acquire sample data of user groups; wherein the sample data includes user information sample data and function module loading strategy sample data;
[0029] A preprocessing subunit, configured to perform data preprocessing on the sample data of the user groups;
[0030] An operation subunit, configured to input the user information sample data into an initial model for operation, and obtain a function module loading strategy corresponding to the current user information sample data;
[0031] A judging subunit, configured to judge whether the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data;
[0032] A construction subunit, configured to complete the construction of the module loading strategy prediction model if the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data;
[0033] The adjustment subunit is used to calculate the loss function if the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, and adjust the parameters of the initial model based on the loss function until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, thereby completing the construction of the module loading strategy prediction model.
[0034] Optionally, in the above-mentioned device, the adjustment subunit includes:
[0035] A determination subunit is used to determine, for each application, a module loading strategy corresponding to the current application;
[0036] a packaging subunit, configured to optimize the code of the current application based on a module loading policy corresponding to the current application, and to package the application after code optimization;
[0037] The deployment subunit is used to deploy the code-optimized application to a Web server.
[0038] Optionally, the above device further includes:
[0039] An optimization unit is configured to optimize the module loading strategy prediction model based on user feedback information if user feedback information is received.
[0040] A third aspect of the present application discloses an electronic device, comprising:
[0041] one or more processors;
[0042] a storage device having one or more programs stored thereon;
[0043] When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of the first aspects of the present invention.
[0044] A fourth aspect of the present application discloses a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method according to any one of the first aspects of the present invention is implemented.
[0045] As can be seen from the above technical solution, in a module loading method provided by the present application, upon receiving a user's access request, the user information of the user is obtained. The user information is then input into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to characterize the functional modules that the user needs to load. Finally, the access request is sent to an application program that has set a module loading strategy to trigger the application program to respond to the access request and load the module based on the module loading strategy; wherein each application program corresponds to a module loading strategy, and each application program is pre-packaged and deployed according to the corresponding module loading strategy. It can be seen that, using the method of the present application, the module loading strategy corresponding to the current user can be obtained for each user through a pre-built module loading strategy prediction model, and then the corresponding application program is matched to load the module based on the user's corresponding module loading strategy and respond to the access request. Moreover, each application program is also pre-packaged and deployed according to the corresponding module loading strategy, retaining only the modules in the module loading strategy, thereby reducing the application size and improving the module loading speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0047] Figure 1 A flowchart of a module loading method disclosed in an embodiment of the present application;
[0048] Figure 2 A schematic diagram of the correspondence between user groups and module loading strategies disclosed in an embodiment of the present application;
[0049] Figure 3 This is a schematic diagram of different module loading strategies disclosed in the embodiments of this application;
[0050] Figure 4 This is a schematic diagram of another different module loading strategy disclosed in an embodiment of the present application;
[0051] Figure 5 A flowchart of an implementation method of the process of constructing the module loading strategy prediction model disclosed in the embodiments of the present application;
[0052] Figure 6 This is an example diagram of a user accessing a server corresponding to a module loading policy disclosed in an embodiment of the present application;
[0053] Figure 7 A schematic diagram of packaging and deploying an application disclosed in an embodiment of the present application;
[0054] Figure 8 A schematic diagram of a module loading device disclosed in an embodiment of the present application;
[0055] Figure 9 A schematic diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0057] In this application, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0058] Furthermore, in this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any actual relationship or order between these entities or operations.
[0059] As can be seen from the background technology, in the existing technology, in order to speed up the loading speed, all functional modules are loaded before the application is started. However, for some medium and large-scale applications, this will occupy more resources, have higher performance requirements, and the module loading effect is not ideal.
[0060] In view of this, the present application provides a module loading method, device, electronic device and storage medium to solve the problem of unsatisfactory module loading effect in the prior art.
[0061] The embodiment of the present application provides a module loading method, which is applied to a gateway, such as Figure 1 As shown, specifically including:
[0062] S101. Upon receiving an access request from a user, obtain the user's user information; wherein the user information includes user authority and user historical routing information.
[0063] It should be noted that when a user needs to access a web server, they send an access request to the gateway. Upon receiving the access request, the gateway obtains the user's user information, which includes user permissions and historical routing information. User permissions are generally related to the user's identity, such as administrator permissions or salesperson permissions. Historical routing information refers to the front-end page URL used by the user. By checking the corresponding front-end HTML, CSS, JS, and other file resources loaded when opening the URL, you can determine the corresponding front-end resource module.
[0064] S102: Input the user information into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to represent the functional modules that the user needs to load.
[0065] It should be noted that after obtaining the user information, the user information is input into the pre-built module loading strategy prediction model for processing to obtain the module loading strategy corresponding to the user information. In this process, the module loading strategy prediction model first determines the user group information to which the user belongs based on the user information, for example, user group 1 is the management group, and user group 2 is the business group. Then, based on the following example, Figure 2 The mapping relationship between user groups and module loading strategies is shown in the figure to obtain the module loading strategy corresponding to the user. The module loading strategy is used to characterize the functional modules that the user needs to load. Different module loading strategies load different functional modules, such as Figure 3 and Figure 4 shown.
[0066] Optionally, in another embodiment of the present application, an implementation method of the construction process of the above module loading strategy prediction model is as follows: Figure 5 As shown, this may include:
[0067] S501. Obtain sample data of user groups; wherein the sample data includes user information sample data and function module loading strategy sample data.
[0068] It should be noted that first, sample data of user groups is obtained, wherein the sample data includes user information sample data and function module loading strategy sample data, and each user information sample data corresponds to a function module loading strategy sample data.
[0069] S502: Perform data preprocessing on the sample data of the user groups.
[0070] It should be noted that data preprocessing is performed on the sample data of the user groups, such as cleaning, normalization, missing value processing and other preprocessing operations to ensure data quality.
[0071] S503: Input the user information sample data into the initial model for calculation to obtain the function module loading strategy corresponding to the current user information sample data.
[0072] It should be noted that the user information sample data is input into the constructed initial model for calculation to obtain the function module loading strategy corresponding to the current user information sample data.
[0073] S504: Determine whether the function module loading policy corresponding to the current user information sample data is consistent with the function module loading policy sample data actually corresponding to the current user information sample data.
[0074] It should be noted that after the function module loading strategy corresponding to the current user information sample data is calculated in the initial calculation model, the function module corresponding to the current user information sample data obtained by calculation is compared with the function module loading strategy sample data actually corresponding to the current user information sample data, so as to determine whether the function module loading strategy corresponding to the current user information sample data obtained by calculation in the initial calculation model is accurate.
[0075] S505: If the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, the construction of the module loading strategy prediction model is completed.
[0076] It should be noted that if the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, it means that the calculation result of the model is accurate, and the construction of the module loading strategy prediction model is completed.
[0077] S506. If the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, the loss function is calculated, and the parameters of the initial model are adjusted based on the loss function until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, and the construction of the module loading strategy prediction model is completed.
[0078] It should be noted that if the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, the model calculation results are inaccurate. A loss function is then calculated, and the parameters of the initial model are adjusted based on the loss function. A new round of calculations is performed again until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data. This completes the construction of the module loading strategy prediction model.
[0079] S103. Send an access request to an application program for which a module loading policy is set, so as to trigger the application program to respond to the access request and load the module based on the module loading policy; wherein each application program corresponds to a module loading policy, and each application program is pre-packaged and deployed according to the corresponding module loading policy.
[0080] It should be noted that after determining the module loading policy corresponding to the user information, the application program that sets the module loading policy is determined, and the access request is sent to the application program. After receiving the user's access request, the application program responds to the user's access request, loads the module according to the module loading policy corresponding to the user information, and provides the user with access. The overall access process is as follows: Figure 6 As shown in the figure, each application corresponds to a module loading strategy, and each application is pre-packaged according to the corresponding module loading strategy and then deployed on the Web server.
[0081] Optionally, in another embodiment of the present application, in step S103, each application is pre-packaged and deployed according to a corresponding module loading strategy, which may include:
[0082] For each application, determine the module loading strategy corresponding to the current application.
[0083] Based on the module loading strategy corresponding to the current application, the code of the current application is optimized, and the application with optimized code is packaged.
[0084] Deploy the optimized application to a web server.
[0085] It should be noted that each application corresponds to only one module loading strategy. After a module loading strategy is determined, the application is packaged for the current module loading strategy. The most direct approach is to make restrictions directly at the code level. For example, when packaging applications used by business personnel, all codes that are not related to the business personnel's permissions are deleted, and applications are packaged specifically for business personnel to use. This can minimize the size of the packaged application. In addition, different environment variables can be set according to permissions in the front-end functions, and different logic is executed in the code according to different environment variables. Environment variables are used as input parameters during packaging. After packaging, the packaging tool will automatically optimize the code according to the different input parameters, and automatically delete unused code through strategies such as tree shaking optimization, thereby realizing the packaging of the application. DevOps tools are then used to automatically deploy these applications to the Web server. For the specific process, please refer to Figure 7 .
[0086] In a module loading method provided by the present application, when receiving a user's access request, the user information of the user is obtained. The user information is input into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein, the module loading strategy is used to characterize the functional modules that the user needs to load; the access request is sent to an application with a module loading strategy set to trigger the application to respond to the access request and load the module based on the module loading strategy; wherein, each application corresponds to a module loading strategy, and each application is pre-packaged and deployed according to the corresponding module loading strategy. It can be seen from this that, using the method of the present application, for each user, the module loading strategy corresponding to the current user can be obtained through a pre-built module loading strategy prediction model, and then the corresponding application is matched to load the module based on the module loading strategy corresponding to the user, and respond to the access request. Moreover, each application is also pre-packaged and deployed according to the corresponding module loading strategy, retaining only the modules in the module loading strategy, reducing the application volume and improving the module loading speed.
[0087] Optionally, in another embodiment of the present application, the module loading method may further include:
[0088] If user feedback information is received, the module loading strategy prediction model is optimized based on the user feedback information.
[0089] It should be noted that if user feedback is received, for example, user feedback that some modules should be loaded and some modules do not need to be loaded, then the parameters of the module loading strategy prediction model are adjusted and optimized based on the user feedback information to improve the accuracy of the model.
[0090] Another embodiment of the present application also discloses a module loading device, such as Figure 8 As shown, specifically including:
[0091] The acquisition unit 801 is configured to acquire user information of the user upon receiving an access request from the user; wherein the user information includes user authority and user historical routing information.
[0092] The processing unit 802 is used to input the user information into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to represent the functional modules that the user needs to load.
[0093] The sending unit 803 is used to send an access request to an application for which a module loading policy is set, so as to trigger the application to respond to the access request and load the module based on the module loading policy; wherein each application corresponds to a module loading policy, and each application is pre-packaged and deployed according to the corresponding module loading policy.
[0094] In this embodiment, the specific execution process of the acquisition unit 801, the processing unit 802, and the sending unit 803 can be found in the corresponding Figure 1 The content of the method embodiment will not be repeated here.
[0095] In a module loading device provided by the present application, when receiving a user's access request, the acquisition unit 801 obtains the user's user information. The processing unit 802 inputs the user information into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to characterize the functional modules that the user needs to load; the sending unit 803 sends the access request to the application with the module loading strategy set to trigger the application to respond to the access request and load the module based on the module loading strategy; wherein each application corresponds to a module loading strategy, and each application is pre-packaged and deployed according to the corresponding module loading strategy. It can be seen that using the method of the present application, for each user, the module loading strategy corresponding to the current user can be obtained through the pre-built module loading strategy prediction model, and then the corresponding application is matched to load the module based on the module loading strategy corresponding to the user, and respond to the access request. Moreover, each application is also pre-packaged and deployed according to the corresponding module loading strategy, retaining only the modules in the module loading strategy, reducing the application volume and improving the module loading speed.
[0096] Optionally, in another embodiment of the present application, an implementation of the processing unit 802 includes:
[0097] The acquisition subunit is used to acquire sample data of user groups; wherein the sample data includes user information sample data and function module loading strategy sample data.
[0098] The preprocessing subunit is used to perform data preprocessing on the sample data of the user groups.
[0099] The operation subunit is used to input the user information sample data into the initial model for operation, and obtain the function module loading strategy corresponding to the current user information sample data.
[0100] The judging subunit is used to judge whether the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data.
[0101] The construction subunit is used to complete the construction of the module loading strategy prediction model if the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data.
[0102] The adjustment subunit is used to calculate the loss function if the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, and adjust the parameters of the initial model based on the loss function until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, thereby completing the construction of the module loading strategy prediction model.
[0103] In this embodiment, the specific execution process of the acquisition subunit, preprocessing subunit, operation subunit, judgment subunit, construction subunit and adjustment subunit can be referred to the corresponding Figure 5 The content of the method embodiment will not be repeated here.
[0104] Optionally, in another embodiment of the present application, an implementation of the sending unit 803 includes:
[0105] The determination subunit is used to determine, for each application, a module loading strategy corresponding to the current application.
[0106] The packaging subunit is used to optimize the code of the current application based on the module loading strategy corresponding to the current application, and package the application with optimized code.
[0107] The deployment subunit is used to deploy the code-optimized application to the Web server.
[0108] In this embodiment, the specific execution process of determining the sub-units, packaging the sub-units, and deploying the sub-units can be found in the corresponding method embodiments described above and will not be repeated here.
[0109] Optionally, in another embodiment of the present application, the module loading device may further include:
[0110] The optimization unit is configured to optimize the module loading strategy prediction model based on the user feedback information if user feedback information is received.
[0111] Another embodiment of the present application further provides an electronic device, such as Figure 9 As shown, specifically including:
[0112] One or more processors 901.
[0113] The storage device 902 stores one or more programs.
[0114] When one or more programs are executed by one or more processors 901 , the one or more processors 901 implement any one of the methods in the above embodiments.
[0115] Another embodiment of the present application further provides a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, any one of the methods in the above embodiments is implemented.
[0116] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.
[0117] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0118] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A module loading method, characterized in that: Applied to a gateway, wherein the module loading method includes: Upon receiving a user's access request, obtaining the user's user information; wherein the user information includes user permissions and user historical routing information; Inputting the user information into a pre-built module loading strategy prediction model for processing to obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to characterize the functional modules that the user needs to load; The access request is sent to the application for which the module loading policy is set to trigger the application to respond to the access request and load the module based on the module loading policy; wherein each application corresponds to a module loading policy, and each application is pre-packaged and deployed according to the corresponding module loading policy.
2. The method according to claim 1, characterized in that The process of constructing the module loading strategy prediction model includes: Acquire sample data of user groups; wherein the sample data includes user information sample data and function module loading strategy sample data; Performing data preprocessing on the sample data of the user groups; Inputting the user information sample data into the initial model for calculation to obtain the function module loading strategy corresponding to the current user information sample data; Determine whether the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data; If the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, then the construction of the module loading strategy prediction model is completed; If the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, a loss function is calculated, and the parameters of the initial model are adjusted based on the loss function until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, and the construction of the module loading strategy prediction model is completed.
3. The method according to claim 1, characterized in that Each application is pre-packaged and deployed according to the corresponding module loading strategy, including: For each application, determine the module loading strategy corresponding to the current application; Optimizing the code of the current application based on the module loading strategy corresponding to the current application, and packaging the application with optimized code; Deploy the code-optimized application to a Web server.
4. The method according to claim 1, wherein Also includes: If user feedback information is received, the module loading strategy prediction model is optimized based on the user feedback information.
5. A module loading device, characterized in that: Applied to a gateway, wherein the module loading device includes: An acquiring unit, configured to acquire user information of a user upon receiving an access request from the user; wherein the user information includes user authority and user historical routing information; A processing unit, configured to input the user information into a pre-built module loading strategy prediction model for processing, and obtain a module loading strategy corresponding to the user information; wherein the module loading strategy is used to characterize the functional modules that the user needs to load; A sending unit is used to send the access request to the application program for which the module loading policy is set, so as to trigger the application program to respond to the access request and load the module based on the module loading policy; wherein each application program corresponds to a module loading policy, and each application program is pre-packaged and deployed according to the corresponding module loading policy.
6. The device according to claim 5, characterized in that The processing unit includes: An acquisition subunit, configured to acquire sample data of user groups; wherein the sample data includes user information sample data and function module loading strategy sample data; A preprocessing subunit, configured to perform data preprocessing on the sample data of the user groups; An operation subunit, configured to input the user information sample data into an initial model for operation, and obtain a function module loading strategy corresponding to the current user information sample data; A judging subunit, configured to judge whether the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data; A construction subunit, configured to complete the construction of the module loading strategy prediction model if the function module loading strategy corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data; The adjustment subunit is used to calculate the loss function if the function module loading strategy corresponding to the current user information sample data is inconsistent with the function module loading strategy sample data actually corresponding to the current user information sample data, and adjust the parameters of the initial model based on the loss function until the function module corresponding to the current user information sample data is consistent with the function module loading strategy sample data actually corresponding to the current user information sample data, thereby completing the construction of the module loading strategy prediction model.
7. The device according to claim 5, characterized in that The sending unit includes: A determination subunit is used to determine, for each application, a module loading strategy corresponding to the current application; a packaging subunit, configured to optimize the code of the current application based on a module loading policy corresponding to the current application, and to package the application after code optimization; The deployment subunit is used to deploy the code-optimized application to a Web server.
8. The device according to claim 5, characterized in that Also includes: An optimization unit is configured to optimize the module loading strategy prediction model based on user feedback information if user feedback information is received.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 4.
10. A computer storage medium, characterized in that A computer program is stored thereon, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Pre-downloading method of application program update package, related equipment and storage medium
CN112685058A
Page loading method and device, storage medium and computer equipment
CN116225567A