A resource file loading method, device and system
By calculating the context environment parameter weights in the arbitration server, the loading method of resource files is automatically determined, which solves the problem of low human judgment efficiency and reliability in the prior art, and achieves more efficient and reliable resource file loading.
Patent Information
- Application Number
- CN202410810462.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In the prior art, the storage location and loading method of resource files are determined through the experience of technical developers, and the efficiency and reliability are low.
By obtaining the contextual environment parameters of the target application when initiating a resource file request, using the arbitration server for weight calculation, determine the loading method of resource files, including built-in application loading and resource server loading.
It realizes optimization and improvement based on the actual data used by users, reduces the risks brought by subjective judgments, and improves the efficiency and reliability of resource file loading.
Smart Images

Figure CN118626171B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method, device and system for loading resource files. Background Art
[0002] The operation of an application (APP) generally requires the use of multiple types of resource files, such as pictures, sounds, videos, text strings, script codes, etc.
[0003] These resource files are generally loaded in two ways, namely, built-in loading in the APP and loading from a resource server. The traditional approach is to distinguish the storage location of resource files when building a project, that is, it is necessary to distinguish between resource files that are suitable for storage on a file server and resource files that are to be built into the software package. When loading resource files built into the APP, the loaded resource files are read directly from the local computer and do not rely on the network; when loading resource files stored on a file server, the APP sends a network request to the file server with the uniform resource identifier URI corresponding to the required resource file as a parameter. After obtaining the resource content, it is cached in the temporary directory of the user end in the form of a file as a secondary cache for next use.
[0004] In the above scheme, the storage location and loading method of various resource files are generally determined based on the experience of technical developers. However, as the complexity of the project increases, this manual judgment method is rough, and its efficiency and reliability are low. Summary of the invention
[0005] In view of this, the present invention provides a method, device and system for loading resource files to solve the problem of low efficiency and reliability of manually judging the storage location and loading method of various resource files based on the experience of technical developers.
[0006] In a first aspect, the present invention provides a method for loading a resource file, the method being applied to an arbitration server in a resource file loading system, the system further comprising a user terminal and a resource server; a target application is running on the user terminal;
[0007] The method comprises:
[0008] Obtaining context parameters of the target application when initiating a resource file request;
[0009] Based on the context parameters, weight calculation is performed on the loading methods of each resource file corresponding to the target application to obtain the loading weight of each resource file;
[0010] Based on the loading weights of the resource files, a loading method of the resource files is determined; the loading methods include an application built-in loading method and a resource server loading method.
[0011] The above scheme collects the context environment parameters generated during the actual use of the user, understands the user's usage environment and operating habits, uploads the context environment parameters to the arbitration server, and then cooperates with the dynamically adjustable arbitration algorithm to obtain the loading weight of each resource file and judge the importance of each resource file. The loading weight is used as the basis for the subsequent iterative update of the application to determine the loading method of different resource files, so that each update can be optimized and improved in a targeted manner based on the user's actual usage data, which can reduce the risks brought by subjective judgment, thereby realizing a scientific and reasonable development method with basis, making the decision more scientific and reasonable.
[0012] In an optional implementation, the context parameters include the time difference between the request time and the start time of the target application, the account login status at the time of the request, the user terminal network status, the location area of the user terminal, and the purpose of the requested resource file.
[0013] In an optional implementation, the weight calculation of the loading mode of each resource file corresponding to the target application based on the context environment parameter to obtain the loading weight of each resource file includes:
[0014] Obtaining a first weight value and a first weight coefficient of each parameter in the context environment parameter;
[0015] For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter;
[0016] For each of the users, iterate each parameter in the context environment parameters one by one based on the first weight value and the first weight coefficient, and respectively obtain a maximum value of the user weight of each user in the iteration process;
[0017] According to the correspondence between resource files and users, iterate the maximum value of user weight of each user corresponding to the resource file, and obtain the maximum value of file weight corresponding to each resource file respectively;
[0018] The maximum value of the file weight corresponding to each resource file is determined as the respective loading weight.
[0019] In an optional implementation, the weight calculation of the loading mode of each resource file corresponding to the target application based on the context environment parameter to obtain the loading weight of each resource file includes:
[0020] Obtaining a second weight value and a second weight coefficient of each parameter in the context environment parameter;
[0021] For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter;
[0022] For each of the users, based on the second weight value and the second weight coefficient, each parameter in the context environment parameter is merged and calculated, and a total user weight value of each user in the merged calculation process is obtained respectively;
[0023] According to the correspondence between resource files and users, the total user weight values of the users corresponding to the resource files are merged and calculated, and the total user weight values corresponding to the resource files are obtained respectively;
[0024] The total user weight value corresponding to each resource file is determined as the respective loading weight.
[0025] In an optional implementation, before obtaining the loading weights of the respective resource files, the method further includes:
[0026] Parsing the context parameters to obtain the location area where the user terminal is located in the context parameters;
[0027] Based on the location area of the user terminal, each resource file is allocated to a resource server node in the corresponding area to perform loading weight calculation.
[0028] In an optional implementation, before determining the loading mode of each resource file, the method further includes:
[0029] sorting the resource files based on the loading weights of the resource files;
[0030] According to the sorting result, the loading priority of each resource file is determined; the loading priority includes high priority, medium priority and low priority.
[0031] In an optional implementation, the resource server loading method includes a first resource server loading method and a second resource server loading method;
[0032] The first resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application is started, the corresponding resource file is loaded;
[0033] The second resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application uses the corresponding resource file, the corresponding resource file is loaded.
[0034] In an optional implementation, determining the loading mode of each resource file based on the loading weight of each resource file includes:
[0035] When the loading priority of the resource file is a high priority, determining that the loading mode of the resource file is the built-in loading mode of the application;
[0036] When the loading priority of the resource file is a medium priority, determining that the loading mode of the resource file is the first resource server loading mode;
[0037] When the loading priority of the resource file is a low priority, the loading mode of the resource file is determined to be the second resource server loading mode.
[0038] In a second aspect, the present invention provides a resource file loading device, the device is applied to an arbitration server in a resource file loading system, the system further comprising a user terminal and a resource server; a target application is running on the user terminal;
[0039] The device comprises:
[0040] A context parameter acquisition module, used to acquire context parameters when the target application initiates a resource file request;
[0041] A loading weight acquisition module, used to perform weight calculation on the loading methods of each resource file corresponding to the target application based on the context environment parameters, so as to obtain the loading weight of each resource file;
[0042] The loading mode acquisition module is used to determine the loading mode of each resource file based on the loading weight of each resource file; the loading mode includes the application built-in loading mode and the resource server loading mode.
[0043] In a third aspect, the present invention provides a resource file loading system, the system comprising an arbitration server, a user terminal and a resource server; a target application is running on the user terminal;
[0044] The user terminal is used to collect context parameters of the target application when initiating a resource file request, and upload the context parameters to the arbitration server;
[0045] The arbitration server is used to perform weight calculation on the loading methods of each resource file corresponding to the target application based on the context environment parameters to obtain the loading weight of each resource file; based on the loading weight of each resource file, determine the loading method of each resource file; the loading method includes the application built-in loading method and the resource server loading method.
[0046] In a fourth aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute a method for loading a resource file according to the first aspect or any corresponding embodiment thereof.
[0047] In a fifth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute a method for loading a resource file according to the first aspect or any corresponding embodiment thereof.
[0048] In a sixth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute a method for loading a resource file according to the first aspect or any corresponding embodiment thereof.
[0049] The technical solution provided by the present invention may include the following beneficial effects:
[0050] The arbitration server obtains the context environment parameters collected by the user end when the target application initiates the resource file request, and based on the context environment parameters, performs weight calculation on the loading mode of each resource file corresponding to the target application, thereby obtaining the loading weight of each resource file; afterwards, the arbitration server determines the loading mode of each resource file based on the loading weight of each resource file. The present invention collects the context environment parameters generated during the actual use of the user, understands the user's use environment and operating habits, uploads the context environment parameters to the arbitration server, and then cooperates with a dynamically adjustable arbitration algorithm to obtain the loading weight of each resource file, judge the importance of each resource file, and the loading weight is used as the basis for the later iterative update of the application to determine the loading mode of different resource files, so that each update can be optimized and improved in a targeted manner based on the actual use data of the user, and can reduce the risks brought by subjective judgment, thereby realizing a scientific and reasonable development method with basis, making the decision more scientific and reasonable, and improving the efficiency and reliability of resource file loading. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 is a schematic diagram of the structure of a resource file loading system according to an embodiment of the present invention;
[0053] Figure 2 is a flow chart of a method for loading a resource file according to an embodiment of the present invention;
[0054] Figure 3 is a flow chart of another method for loading resource files according to an embodiment of the present invention;
[0055] Figure 4 is a structural block diagram of a resource file loading device according to an embodiment of the present invention;
[0056] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0058] It should be noted that, first of all, when loading resource files based on the built-in loading method of APP, it is necessary to compress or encrypt the resource files during the process of building the APP, and package the compressed or encrypted resource files together with the executable files to make them into an APP installation package and upload them to the application store for users to download and install.
[0059] Advantages include:
[0060] 1) It is easy to build a project, and all resource files are packaged together without distinction.
[0061] 2) Resource files load quickly when in use.
[0062] 3) When loading resource files, they are read locally, so they do not rely on the network.
[0063] Its disadvantages include:
[0064] 1) Make the APP software package larger, increase the user's installation and download time, and affect the user experience.
[0065] 2) Increase the app building time.
[0066] 3) Due to the limitation of resource file capacity, it cannot be increased indefinitely.
[0067] 4) As the project develops, some expired and useless resource files will still be included in the software package if they are not cleaned up in time, wasting system resources.
[0068] Secondly, when loading resource files based on the resource server loading method, the resource files need to be processed and stored on the file server. When the APP needs it during operation, it sends a network request to the server with the Uniform Resource Identifier (URI) corresponding to the resource file as a parameter. After obtaining the resource content, it is cached in the temporary directory of the mobile phone in the form of a file as a secondary cache for next use.
[0069] Advantages include:
[0070] 1) The APP software package is small, and the installation and downloading time is short, saving mobile phone space. For some rarely used resource files, there is no need to download them from the server to the local computer.
[0071] 2) APP building speed is fast.
[0072] 3) Not limited by the total size of resource files.
[0073] 4) As the project develops, since resource files are only stored on the server, useless resource files will not be downloaded to the mobile phone even if they are not cleaned up in time, and there is no problem of wasting mobile phone space.
[0074] Its disadvantages include:
[0075] 1) When building a project, you need to distinguish between resource files that are suitable for being placed on the server and resource files that are built into the software package, which increases complexity.
[0076] 2) The APP requests the content of the resource file from the server only when it uses it. If there is no local cache for the first request, it will take more time than local loading.
[0077] 3) There are network limitations.
[0078] It can be seen that it is very important to judge the storage location and loading method of various resource files of resource files. The relevant technology generally relies on the experience of technical developers and manual judgment. For example, the pictures required for the homepage when the APP is started and the icons of various types of devices required for the homepage display are built into the APP in order to reduce the loading waiting time, that is, the APP built-in loading method is adopted; and the operation guidance video of a specific device can be placed on a remote server, and it will only be dynamically downloaded when the user adds the device and needs guidance, that is, the resource server loading method is adopted. However, with the increase of engineering complexity, this method of judging by the experience of technical developers is rough, and its efficiency and reliability are low. Based on this, an embodiment of the present invention provides a method for loading resource files, which collects context environment parameters generated during the actual use of users, understands the user's use environment and operation habits, uploads the context environment parameters to the arbitration server, and then cooperates with a dynamically adjustable arbitration algorithm to obtain the loading weight of each resource file, judge the importance of each resource file, and determine the loading method of different resource files, so that each update can be optimized and improved in a targeted manner based on the actual use data of the user, thereby improving the efficiency and reliability of resource file loading.
[0079] According to an embodiment of the present invention, a system for loading resource files is provided. Figure 1 is a schematic diagram of the structure of a resource file loading system according to an embodiment of the present invention. Figure 1 As shown, the system includes an arbitration server 120, a client 110 and a resource server 130; a target application is running on the client 110;
[0080] The client 110 is used to collect context parameters when the target application initiates a resource file request, and upload the context parameters to the arbitration server 120;
[0081] The arbitration server 120 is used to perform weight calculation on the loading methods of each resource file corresponding to the target application based on the context environment parameters to obtain the loading weights of each resource file; based on the loading weights of each resource file, determine the loading methods of each resource file; the loading methods include the application built-in loading method and the resource server loading method. In addition, since the arbitration server 120 is only used for weight calculation, it only has algorithms but no data resource files, so it can be centralized with only one arbitration server, which is convenient for maintenance and upgrade.
[0082] Furthermore, the user terminal 110 may be a mobile device, such as a mobile phone, a tablet, etc. The user terminal 110 runs a target application (APP), and the operation of the target application (APP) generally requires the use of multiple types of resource files, such as pictures, sounds, videos, text strings, script codes, etc. In this embodiment, the above multiple types of resource files are loaded in two ways, namely, APP built-in loading and resource server loading.
[0083] Furthermore, the arbitration server 120 may be provided with different dynamically adjustable arbitration algorithms, and the arbitration server 120 determines the loading method of each resource file corresponding to the target application based on the arbitration algorithm.
[0084] Furthermore, the resource server 130 may store resource files in a resource server loading manner.
[0085] Furthermore, when performing loading mode arbitration, the user terminal 110 collects the context environment parameters of the target application when initiating a resource file request, and uploads the context environment parameters to the arbitration server 120. The arbitration server 120 performs arbitration calculations based on the context environment parameters through the arbitration algorithm therein, and then determines the loading mode of each resource file corresponding to the target application. When the loading mode is APP built-in loading, the resource file is stored locally on the user terminal 110, and the corresponding resource file is read from the local of the user terminal 110 when the resource file is loaded; when the loading mode is the resource server loading mode, the resource file is stored in the resource server 130, and the corresponding resource file is read from the resource server 130 when the resource file is loaded.
[0086] According to an embodiment of the present invention, an embodiment of a method for loading a resource file is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0087] In this embodiment, a method for loading a resource file is provided, which can be applied to Figure 1 The arbitration server 120 in the resource file loading system is shown. Figure 2 is a flow chart of a method for loading a resource file according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0088] Step S201, obtaining context parameters when the target application initiates a resource file request.
[0089] Furthermore, the present embodiment first collects the context environment parameters of the target application when initiating a resource file request through the user end, and periodically sends the context environment parameters to the arbitration server, so that the arbitration server performs arbitration calculation of the loading mode weight based on the context environment parameters. The collection of the context environment parameters involves monitoring and analyzing the internal logic, network requests or logs of the target application. The present embodiment can collect the context environment parameters about the resource file request by monitoring various system events and API calls.
[0090] Step S202: Based on the context parameters, weight calculation is performed on the loading methods of each resource file corresponding to the target application to obtain the loading weight of each resource file.
[0091] Furthermore, the arbitration server stores a preset arbitration algorithm. After receiving the context parameters sent by the user terminal, the arbitration server calculates the weight for the loading method of each resource file based on the collected context parameters through the arbitration logic of the arbitration algorithm.
[0092] Step S203, based on the loading weights of the various resource files, determining the loading methods of the various resource files; the loading methods include an application built-in loading method and a resource server loading method.
[0093] Furthermore, this implementation determines the loading method of each resource file by setting one or more thresholds for comparison with the loading weight. For example, for resource files with higher weights, this implementation can build them into the target application to reduce the dependence on external servers and the impact of network delays; for resource files with lower weights, this implementation can load them through the resource server.
[0094] In summary, this embodiment collects context environment parameters generated during actual user use, understands the user's use environment and operating habits, uploads the context environment parameters to the arbitration server, and then cooperates with a dynamically adjustable arbitration algorithm to obtain the loading weight of each resource file and judge the importance of each resource file. The loading weight is used as the basis for later iterative updates of the application program to determine the loading method of different resource files, so that each update can be targetedly optimized and improved based on the user's actual use data, which can reduce the risks brought by subjective judgment, thereby realizing a scientific, reasonable and well-founded development method, making decisions more scientific and reasonable, and improving the efficiency and reliability of resource file loading.
[0095] In this embodiment, another resource file loading method is provided, which can be applied to Figure 1 The arbitration server 120 in the resource file loading system is shown. Figure 3is a flowchart of another method for loading resource files according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0096] Step S301, obtaining context parameters when the target application initiates a resource file request.
[0097] In an optional implementation, the context environment parameters are shown in Table 1, which include the difference between the request time and the start time of the target application (i.e., the difference between the request time and the start time of the APP), the account login status at the time of the request (such as whether logged in and the type of account logged in, etc.), the user terminal network status (i.e., the mobile phone network status, such as Wi-Fi, 4G / 5G, and no network, etc.), the location area where the user terminal is located (i.e., the country and region where the mobile phone is located, which can be obtained through IP address or GPS positioning. Before the weight calculation is performed, this embodiment allocates each resource file to the resource server node of the corresponding area based on the location area parameter in the context environment parameter. Therefore, in the subsequent weight calculation, the location area parameter may not participate in the weight calculation process), the purpose of the requested resource file (which can be obtained based on the type of resource file or the context judgment of the request API). Table 1 sets the weight value range of each resource file to: [MIN=1, MAX=10]. This implementation uses these environment parameters as input, cooperates with the arbitration server to use different arbitration algorithms, and performs weight calculation on the loading method of each resource file, and finally divides each resource file into different priorities.
[0098] Table 1
[0099]
[0100]
[0101] Step S302: Based on the context parameters, weight calculation is performed on the loading methods of each resource file corresponding to the target application to obtain the loading weight of each resource file.
[0102] In an optional implementation, step S302 includes:
[0103] Obtaining a first weight value and a first weight coefficient of each parameter in the context environment parameter;
[0104] For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter;
[0105] For each of the users, iterate each parameter in the context environment parameter one by one based on the first weight value and the first weight coefficient, and respectively obtain the maximum value of the user weight of each user in the iteration process;
[0106] According to the correspondence between resource files and users, iterate the maximum value of user weight of each user corresponding to the resource file, and obtain the maximum value of file weight corresponding to each resource file respectively;
[0107] The maximum value of the file weight corresponding to each resource file is determined as the respective loading weight.
[0108] In an optional implementation, step S302 includes:
[0109] Obtaining a second weight value and a second weight coefficient of each parameter in the context environment parameter;
[0110] For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter;
[0111] For each of the users, based on the second weight value and the second weight coefficient, each parameter in the context environment parameter is merged and calculated, and a total user weight value of each user in the merged calculation process is obtained respectively;
[0112] According to the correspondence between resource files and users, the total user weight values of each user corresponding to the resource file are merged and calculated, and the total user weight values corresponding to each resource file are obtained respectively;
[0113] The total user weight value corresponding to each resource file is determined as the respective loading weight.
[0114] In an optional implementation, before obtaining the loading weights of the respective resource files, the process further includes:
[0115] Parsing the context parameter to obtain the location area where the user terminal is located in the context parameter;
[0116] Based on the location area of the user terminal, each resource file is allocated to the resource server node in the corresponding area for loading weight calculation.
[0117] Furthermore, after the user terminal of this embodiment collects the context environment parameters, it temporarily stores them in a local file and periodically sends them to the background arbitration server for arbitration calculation. During the arbitration calculation, the arbitration server in this embodiment first classifies the acquired context environment parameters according to the country / region of the mobile phone (that is, the location area information of the above-mentioned user terminal), and maps the classified context environment parameters to the CDN service nodes of the corresponding country / region based on the classification results, so as to make full use of the CDN service nodes in this area and improve the network response speed.
[0118] The purpose of obtaining and identifying the region where the user terminal is located in this embodiment is mainly to make full use of the capabilities of the Content Delivery Network (CDN). The CDN stores the resource files required by the application as close as possible to the file storage node closest to the user's network, so that there is a smaller network delay when requesting files, thereby improving the user experience.
[0119] Afterwards, this embodiment uses two different arbitration strategies to process the priority of resource files according to different usage scenarios. Among them, strategy one is a monotonically non-decreasing strategy, that is, for the classified context environment parameters, the Uniform Resource Identifier (URI) of each resource file is used as the unique key URIKey, and each context environment parameter is iterated one by one to calculate the weight of each unique key URIKey. In other words, strategy one is for each user under each resource file (because a target application may receive context environment parameters sent by multiple users, and loading the target application may also use multiple resource files, so the application, user and resource file belong to a three-dimensional correspondence relationship, so each resource file may correspond to multiple users respectively), iterate all relevant context environment parameters once, as long as there is a context environment parameter that meets the standard, take the maximum weight calculated by the parameter as the maximum user weight of the corresponding user, and then for the resource file, iterate the maximum user weight of each user under the resource file for a second time, and determine the maximum value as the final weight of URIKey (i.e. the loading weight of the resource file). Strategy one can ensure that as long as one condition meets the standard, the corresponding resource file can obtain high priority.
[0120] Strategy 2 is a weighted merging strategy, which assigns different weights to each context parameter, and after merging and calculating each item, it is used as the final weight of the URIKey (i.e., the loading weight of the resource file). In other words, Strategy 2 assigns a preset weight value to each context parameter (which can be fixed or dynamically adjusted based on business logic), and for each user corresponding to each resource file, first weights the weight values of all parameters are weighted and merged to obtain the total weight value of each user, and then the total weight value of each user under the resource file is weighted and merged again to calculate the final weight of the URIKey. Strategy 2 can more flexibly control the loading priority of resource files and dynamically adjust the weight value of each parameter according to business needs.
[0121] The following is an explanation of the above strategies 1 and 2 through a simple example:
[0122] Assume that a target application needs to determine the loading priority of resource files based on four context parameters: startup time difference, account login status at the time of request, client network status, and purpose of requesting resource files. First, assume that the weight coefficients of the four context parameters are all 1, and the target application corresponds to two users, namely user 1 and user 2. If the resource file URIKey of the target application is resource A, then when calculating the loading weight, resource A needs to take both user 1 and user 2 into account, that is, resource A corresponds to user 1 and user 2.
[0123] In this example, the weight values of the four parameters corresponding to user 1 are preset as follows: startup time difference is 5, account login status is 8, user terminal network status is 7, and resource file usage is 5; the weight values of the four parameters corresponding to user 2 are preset as follows: startup time difference is 9, account login status is 2, user terminal network status is 7, and resource file usage is 2;
[0124] For strategy 1: If the resource file URIKey of the target application is resource A, the weight of resource A is calculated as:
[0125] 1) For user 1, first iterate all its parameter sets and calculate that the maximum user weight of user 1 for resource A is 8 (5*1=5, 8*1=8, 7*1=7, 5*1=5, the maximum of which is 8); for user 2, first iterate all its parameter sets and calculate that the maximum user weight of user 2 for resource A is 9 (9*1=9, 2*1=2, 7*1=7, 2*1=5, the maximum of which is 9).
[0126] 2) For resource A, iterate the maximum value of the user weights of all users 1 and 2, and calculate the final weight value of resource A to be 9 (the maximum value is 9 among 8 for user 1 and 9 for user 2).
[0127] For strategy two: If the resource file URIKey of the target application is resource A, the weight of resource A is calculated as follows: the total user weight value of user 1 for resource A is 25 (5*1+8*1+7*1+5*1=25); the total user weight value of user 2 for resource A is 20 (9*1+2*1+7*1+2*1=20), and the final weight of resource A is calculated to be 45 (25+20=45).
[0128] Step S303: sorting the resource files based on the loading weights of the resource files.
[0129] Step S304, determining the loading priority of each resource file according to the sorting result; the loading priority includes high priority, medium priority and low priority.
[0130] Step S305, when the loading priority of the resource file is high priority, determining the loading mode of the resource file to be the built-in loading mode of the application;
[0131] When the loading priority of the resource file is a medium priority, determining that the loading mode of the resource file is the loading mode of the first resource server;
[0132] When the loading priority of the resource file is a low priority, the loading mode of the resource file is determined to be the loading mode of the second resource server.
[0133] In an optional implementation, the resource server loading method includes a first resource server loading method and a second resource server loading method;
[0134] The first resource server loading method is used to indicate that the corresponding resource files are stored in the resource server, and when the target application is started and enters the standby page, the corresponding resource files are loaded; the loading method of the first resource server is that when the application is started and enters the standby page, the corresponding resource files are immediately started to be loaded in the background. Since these resource files are marked as "most likely to be used soon", they need to be prepared in advance, so they are stored in the resource server.
[0135] The second resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application uses the corresponding resource file, the corresponding resource file is loaded.
[0136] Furthermore, this embodiment can map resource files with different loading weight values to the above three different priorities. Exemplarily, this embodiment divides the resource files into 1 / 3 of each:
[0137] 1) Loading the 1 / 3 resource files with the largest loading weight has a high priority, which is built into the application APP and distributed with the installation package.
[0138] 2) Resource files with a loading weight of 1 / 3 of the middle value have medium priority and are added to the "automatic download list". After the application APP is started, the list is obtained from the resource server and automatically starts downloading one by one.
[0139] 3) The resource files with the smallest loading weight, 1 / 3, have a low priority and are stored in the background resource server and retrieved when the application APP uses them.
[0140] Exemplarily, this embodiment can also be assisted by different adjustment algorithms when performing priority division. For example, when there are too few high-priority resource files (less than 100MB, 100MB is an empirical value, which is a reasonable capacity size for a relatively medium-sized APP), resource files with medium and low priorities are appropriately promoted to increase loading speed and enhance user experience; conversely, when there are too many high-priority resource files, the priority is appropriately lowered, or the classification of resource files is reviewed to see whether it is reasonable, or the background arbitration algorithm is adjusted to bring it into a reasonable range.
[0141] In summary, this embodiment collects context environment parameters generated during actual user use, understands the user's use environment and operating habits, uploads the context environment parameters to the arbitration server, and then cooperates with a dynamically adjustable arbitration algorithm to obtain the loading weight of each resource file and judge the importance of each resource file. The loading weight is used as the basis for later iterative updates of the application program to determine the loading method of different resource files, so that each update can be targetedly optimized and improved based on the user's actual use data, which can reduce the risks brought by subjective judgment, thereby realizing a scientific, reasonable and well-founded development method, making decisions more scientific and reasonable, and improving the efficiency and reliability of resource file loading.
[0142] In this embodiment, a resource file loading device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0143] This embodiment provides a resource file loading device, which can be applied to Figure 1 The arbitration server 120 in the resource file loading system shown in FIG. Figure 4 As shown, the device comprises:
[0144] The context parameter acquisition module 401 is used to acquire the context parameters of the target application when initiating a resource file request;
[0145] A loading weight acquisition module 402 is used to perform weight calculation on the loading methods of each resource file corresponding to the target application based on the context environment parameter to obtain the loading weight of each resource file;
[0146] The loading mode acquisition module 403 is used to determine the loading mode of each resource file based on the loading weight of each resource file; the loading mode includes an application built-in loading mode and a resource server loading mode.
[0147] In some optional implementations, the context parameters include the difference between the request time and the start time of the target application, the account login status at the time of the request, the user terminal network status, the location area of the user terminal, and the purpose of the requested resource file.
[0148] In some optional implementations, the loading weight acquisition module 402 is further used to:
[0149] Obtaining a first weight value and a first weight coefficient of each parameter in the context environment parameter;
[0150] For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter;
[0151] For each of the users, iterate each parameter in the context environment parameter one by one based on the first weight value and the first weight coefficient, and respectively obtain the maximum value of the user weight of each user in the iteration process;
[0152] According to the correspondence between resource files and users, iterate the maximum value of user weight of each user corresponding to the resource file, and obtain the maximum value of file weight corresponding to each resource file respectively;
[0153] The maximum value of the file weight corresponding to each resource file is determined as the respective loading weight.
[0154] In some optional implementations, the loading weight acquisition module 402 is further used to:
[0155] Obtaining a second weight value and a second weight coefficient of each parameter in the context environment parameter;
[0156] For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter;
[0157] For each of the users, based on the second weight value and the second weight coefficient, each parameter in the context environment parameter is merged and calculated, and a total user weight value of each user in the merged calculation process is obtained respectively;
[0158] According to the correspondence between resource files and users, the total user weight values of each user corresponding to the resource file are merged and calculated, and the total user weight values corresponding to each resource file are obtained respectively;
[0159] The total user weight value corresponding to each resource file is determined as the respective loading weight.
[0160] In some optional embodiments, the device is further used for:
[0161] Parsing the context parameter to obtain the location area where the user terminal is located in the context parameter;
[0162] Based on the location area of the user terminal, each resource file is allocated to the resource server node in the corresponding area for loading weight calculation.
[0163] In some optional embodiments, the device is further used for:
[0164] Sort the resource files based on their loading weights;
[0165] According to the sorting result, the loading priority of each resource file is determined; the loading priority includes high priority, medium priority and low priority.
[0166] In some optional implementations, the resource server loading method includes a first resource server loading method and a second resource server loading method;
[0167] The first resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application is started and enters the standby page, the corresponding resource file is loaded;
[0168] The second resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application uses the corresponding resource file, the corresponding resource file is loaded.
[0169] In some optional implementations, the loading mode acquisition module 403 is further used to:
[0170] When the loading priority of the resource file is high, the loading mode of the resource file is determined to be the built-in loading mode of the application;
[0171] When the loading priority of the resource file is a medium priority, determining that the loading mode of the resource file is the loading mode of the first resource server;
[0172] When the loading priority of the resource file is a low priority, the loading mode of the resource file is determined to be the loading mode of the second resource server.
[0173] In summary, this embodiment collects context environment parameters generated during actual user use, understands the user's use environment and operating habits, uploads the context environment parameters to the arbitration server, and then cooperates with a dynamically adjustable arbitration algorithm to obtain the loading weight of each resource file and judge the importance of each resource file. The loading weight is used as the basis for later iterative updates of the application program to determine the loading method of different resource files, so that each update can be targetedly optimized and improved based on the user's actual use data, which can reduce the risks brought by subjective judgment, thereby realizing a scientific, reasonable and well-founded development method, making decisions more scientific and reasonable, and improving the efficiency and reliability of resource file loading.
[0174] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0175] In this embodiment, a resource file loading device is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0176] The embodiment of the present invention also provides a computer device having the above Figure 4 A resource file loading device is shown.
[0177] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 510, a memory 520, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 510 is taken as an example.
[0178] The processor 510 may be a central processing unit, a network processor or a combination thereof. The processor 510 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0179] The memory 520 stores instructions executable by at least one processor 510, so that the at least one processor 510 executes the method shown in the above embodiment.
[0180] The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 520 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 520 may optionally include a memory remotely arranged relative to the processor 510, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0181] The memory 520 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 520 may also include a combination of the above types of memory.
[0182] The computer device further includes a communication interface 530 for the computer device to communicate with other devices or a communication network.
[0183] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0184] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
Claims
1. A method for loading a resource file, characterized in that: The loading method is applied to an arbitration server in a resource file loading system, the loading system also includes a user end and a resource server; the target application is running on the user end; The loading method comprises: Obtaining context parameters of the target application when initiating a resource file request; the context parameters include the time difference between the request time and the start time of the target application, the account login status at the time of the request, the user terminal network status, the location area of the user terminal, and the purpose of requesting the resource file; Based on the context parameters, weight calculation is performed on the loading methods of each resource file corresponding to the target application to obtain the loading weight of each resource file; Based on the loading weights of the resource files, determining the loading methods of the resource files; the loading methods include application built-in loading methods and resource server loading methods; The step of performing weight calculation on the loading modes of each resource file corresponding to the target application based on the context environment parameter to obtain the loading weight of each resource file includes: Obtaining a first weight value and a first weight coefficient of each parameter in the context environment parameter; For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter; For each of the users, iterate each parameter in the context environment parameters one by one based on the first weight value and the first weight coefficient, and respectively obtain a maximum value of the user weight of each user in the iteration process; According to the correspondence between resource files and users, iterate the maximum value of user weight of each user corresponding to the resource file, and obtain the maximum value of file weight corresponding to each resource file respectively; The maximum value of the file weight corresponding to each resource file is determined as the respective loading weight; Alternatively, the weight calculation of the loading modes of each resource file corresponding to the target application program based on the context environment parameter to obtain the loading weight of each resource file includes: Obtaining a second weight value and a second weight coefficient of each parameter in the context environment parameter; For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter; For each of the users, based on the second weight value and the second weight coefficient, each parameter in the context environment parameter is merged and calculated, and a total user weight value of each user in the merged calculation process is obtained respectively; According to the correspondence between resource files and users, the total user weight values of the users corresponding to the resource files are merged and calculated, and the total user weight values corresponding to the resource files are obtained respectively; The total user weight value corresponding to each resource file is determined as the respective loading weight.
2. The loading method according to claim 1, characterized in that: Before obtaining the loading weights of the respective resource files, the loading method further includes: Parsing the context parameters to obtain the location area where the user terminal is located in the context parameters; Based on the location area of the user terminal, each resource file is allocated to a resource server node in the corresponding area to perform loading weight calculation.
3. The loading method according to claim 1 or 2, characterized in that: Before determining the loading mode of each resource file, the loading method further includes: sorting the resource files based on the loading weights of the resource files; According to the sorting result, the loading priority of each resource file is determined; the loading priority includes high priority, medium priority and low priority.
4. The loading method according to claim 3, characterized in that: The resource server loading method includes a first resource server loading method and a second resource server loading method; The first resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application is started and enters the standby page, the corresponding resource file is loaded; The second resource server loading mode is used to indicate that the corresponding resource file is stored in the resource server, and when the target application uses the corresponding resource file, the corresponding resource file is loaded.
5. The loading method according to claim 4, characterized in that: The determining, based on the loading weights of the respective resource files, a loading mode of the respective resource files comprises: When the loading priority of the resource file is a high priority, determining that the loading mode of the resource file is the built-in loading mode of the application; When the loading priority of the resource file is a medium priority, determining that the loading mode of the resource file is the first resource server loading mode; When the loading priority of the resource file is a low priority, the loading mode of the resource file is determined to be the second resource server loading mode.
6. A resource file loading device, characterized in that: The loading device is applied to an arbitration server in a resource file loading system, the loading system also includes a user end and a resource server; a target application is running on the user end; The loading device comprises: A context parameter acquisition module, used to acquire context parameters of the target application when initiating a resource file request; the context parameters include the time difference between the request time and the start time of the target application, the account login status at the time of the request, the user terminal network status, the location area of the user terminal, and the purpose of the resource file request; A loading weight acquisition module, used to perform weight calculation on the loading methods of each resource file corresponding to the target application based on the context environment parameters, so as to obtain the loading weight of each resource file; A loading mode acquisition module, used to determine the loading mode of each resource file based on the loading weight of each resource file; the loading mode includes an application built-in loading mode and a resource server loading mode; The loading weight acquisition module is also used for: Obtaining a first weight value and a first weight coefficient of each parameter in the context environment parameter; For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter; For each of the users, iterate each parameter in the context environment parameters one by one based on the first weight value and the first weight coefficient, and respectively obtain a maximum value of the user weight of each user in the iteration process; According to the correspondence between resource files and users, iterate the maximum value of user weight of each user corresponding to the resource file, and obtain the maximum value of file weight corresponding to each resource file respectively; The maximum value of the file weight corresponding to each resource file is determined as the respective loading weight; Alternatively, the loading weight acquisition module is further used for: Obtaining a second weight value and a second weight coefficient of each parameter in the context environment parameter; For each resource file, obtaining each user corresponding to the resource file based on the context environment parameter; For each of the users, based on the second weight value and the second weight coefficient, each parameter in the context environment parameter is merged and calculated, and a total user weight value of each user in the merged calculation process is obtained respectively; According to the correspondence between resource files and users, the total user weight values of the users corresponding to the resource files are merged and calculated, and the total user weight values corresponding to the resource files are obtained respectively; The total user weight value corresponding to each resource file is determined as the respective loading weight.
7. A resource file loading system, characterized in that: The loading system includes an arbitration server, a user terminal and a resource server; the target application is running on the user terminal; The user terminal is used to collect context parameters of the target application when initiating a resource file request, and upload the context parameters to the arbitration server; the context parameters include the time difference between the request time and the start time of the target application, the account login status at the time of the request, the network status of the user terminal, the location area of the user terminal, and the purpose of requesting the resource file; The arbitration server is used to perform weight calculation on the loading mode of each resource file corresponding to the target application based on the context environment parameter to obtain the loading weight of each resource file; Based on the loading weights of the resource files, determining the loading methods of the resource files; the loading methods include application built-in loading methods and resource server loading methods; The arbitration server is further configured to obtain a first weight value and a first weight coefficient of each parameter in the context environment parameter; and for each resource file, obtain each user corresponding to the resource file based on the context environment parameter; For each of the users, iterate each parameter in the context environment parameters one by one based on the first weight value and the first weight coefficient, and obtain the maximum value of the user weight of each user in the iteration process respectively; for the correspondence between resource files and users, iterate the maximum value of the user weight of each user corresponding to the resource file, and obtain the maximum value of the file weight corresponding to each resource file respectively; determine the maximum value of the file weight corresponding to each resource file as the respective loading weight; Alternatively, the arbitration server is further configured to obtain a second weight value and a second weight coefficient of each parameter in the context environment parameter; and for each resource file, obtain each user corresponding to the resource file based on the context environment parameter; For each of the users, the parameters in the context environment parameters are merged and calculated based on the second weight value and the second weight coefficient, and the total user weight value of each user in the merged calculation process is obtained respectively; according to the correspondence between resource files and users, the total user weight values of each user corresponding to the resource files are merged and calculated, and the total user weight values corresponding to each resource file are obtained respectively; the total user weight values corresponding to each resource file are determined as their respective loading weights.
Citation Information
Patent Citations
Server monitoring system and method
CN110377483A
Sub-application loading method and device
CN111596966A
File loading method and device
CN117873583A