Loading strategy issuing method, device and electronic device
By receiving and analyzing the historical loading time of the target page sent by the client, and adding native interface links if the conditions are met, it solves the problem of poor compatibility of the application layer transmission interface on different pages, and improves loading speed and versatility.
Patent Information
- Application Number
- CN202010615593.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2040-11-08
AI Technical Summary
The generation of native transmission interfaces at the application layer requires analysis of fixed pages, and the compatibility with other web pages cannot be achieved, resulting in poor universality.
By receiving the historical loading time of the target interface of the target page sent by the client, if the preset conditions are met, the native interface link will be added to the page link, so that the client can cache resources in advance through the native interface and optimize the loading speed.
It improves the universality of the target interface and can be used on multiple pages, solves the problem that the native transmission interface is incompatible with other web pages, and improves the response speed and user experience.
Smart Images

Figure CN111859203B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computers, and specifically relates to a method, device and electronic device for issuing a loading strategy. Background Art
[0002] With the continuous development of Internet applications, many mobile terminal applications are embedded with Hypertext 5.0 (H5, HTML5) pages. In order to ensure the user's browsing experience of H5 pages, optimizing the response speed of H5 pages is an important issue at present.
[0003] At present, when a user opens an H5 page for the first time, the response speed from initializing the view control to rendering the document object model is an important factor affecting the user experience. In order to optimize the response speed of this stage, the native transmission interface of the application layer can be extracted from the page through analysis of the fixed page, thereby replacing the original browser kernel transmission interface, and requesting the resources required to open the page through the native transmission interface, so as to obtain resources in parallel through the native transmission interface before or during the view control initialization process, so as to change the original serial processing process and improve the response speed.
[0004] However, in the current solution, the generation of the native transmission interface of the application layer requires analysis of a fixed page. This process is pre-made in advance and cannot achieve compatibility with other web pages, resulting in poor versatility. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method, device and electronic device for issuing a loading strategy, which can solve the problem that the generation of a native transmission interface at the application layer requires analysis of fixed pages and cannot achieve compatibility with other web pages, resulting in poor versatility.
[0006] In order to solve the above technical problems, this application is implemented as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for issuing a loading strategy, which is applied to a server, and receives a first historical loading duration of a target interface of a target page sent by M clients;
[0008] If the M first historical loading durations meet a preset condition, adding the native interface link of the target interface to the page link of the target page;
[0009] Send a page link of the target page.
[0010] In a second aspect, an embodiment of the present application provides a loading strategy issuing device, which is applied to a server, and the device includes:
[0011] A first receiving module is used to receive a first historical loading time of a target interface of a target page sent by M clients;
[0012] An adding module, configured to add the native interface link of the target interface to the page link of the target page if the M first historical loading durations meet a preset condition;
[0013] The sending module is used to send the page link of the target page.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0015] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0016] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0017] In an embodiment of the present application, the client can report the data loading time of the historical interface during the process of loading the historical interface, so that the server can analyze the loading time of the interfaces used by the massive web pages reported by each client, and thus determine the target interfaces that need to be replaced by the native interfaces. These target interfaces can be used as target interfaces that meet the preset conditions, and their native interface links are added to the page links of the target pages and fed back to the client, so that the client can cache the interface resources in advance through the native interface. The present application does not need to analyze the target interfaces that meet the preset conditions for a fixed page, which enables the server to obtain a larger number of target interfaces that meet the preset conditions through big data processing, and these target interfaces can be used in multiple pages, which solves the problem that the target interfaces that meet the preset conditions cannot be compatible in other web pages, and improves the versatility of the target interfaces. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 This is a schematic diagram of the steps of a method for issuing a loading strategy provided in an embodiment of the present application;
[0019] Figure 2 It is a schematic diagram of specific steps of a method for issuing a loading strategy provided in an embodiment of the present application;
[0020] Figure 3 It is a block diagram of a loading strategy issuing device provided in an embodiment of the present application;
[0021] Figure 4 is a block diagram of an electronic device provided in an embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0025] The following, in conjunction with the accompanying drawings, describes in detail the method, device and electronic device for issuing the loading strategy provided by the embodiments of the present application through specific embodiments and their application scenarios.
[0026] Reference Figure 1 , which shows a schematic diagram of the steps of a method for issuing a loading strategy provided in an embodiment of the present application, applied to a server, including:
[0027] Step 101: Receive the first historical loading duration of the target interface of the target page sent by M clients.
[0028] In the embodiment of the present application, there may be multiple clients, and the clients may be distributed in various location areas to use the target page, and in the process of using the target page, historical usage data is generated, the historical usage data includes the target interface used by the target page and the historical loading time of the target interface, the historical loading time of the target interface refers to the time spent in the process of using the target interface to request data. After obtaining the historical loading time of the target interface, the client can send these data to the server.
[0029] For example, when accessing page a, client 1 and client 2 both obtain certain data through interface A included in page a, and the time spent by client 1 in loading interface A to obtain the data is 1 second, and the time spent by client 2 in loading interface A to obtain the data is 6 seconds. Through statistics on the loading time of interface A, the data sent by client 1 to the server includes: page a, interface A, 1 second. The data sent by client 2 to the server includes: page a, interface A, 6 seconds. Among them, 1 second and 6 seconds are the historical loading times of interface A of client 1 and client 2, respectively.
[0030] In the embodiment of the present application, the interface can be an interface for requesting data from the data end, and the relationship between the data end and the interface is fixed, that is, the address of the data end can be fixedly written into the link of the interface. Further, each interface of the target page can be a browser kernel transmission interface, and the browser kernel transmission interface is an interface of the kernel layer, so its data request process needs to occur when the browser is working, and the processing process is: first initialize the browser view control, and then request data through the browser kernel transmission interface, and this process is a serial process. Since the loading time of the interface is an important factor affecting the user experience during the user's use of the page, the historical loading time of each interface of the target page can effectively reflect the quality of each interface of the target page. The longer the historical loading time of the interface, the slower the loading speed of the interface, and the more it affects the user experience. In order to ensure the user experience, the interface with a slower loading speed needs to be optimized.
[0031] During the process of the client loading the target interface, the data loading time of the target interface is reported, so as to achieve the purpose of detecting the target interface loaded by the client in the process of using the target web page. Based on the use of the massive target interfaces in the massive target web pages by each client, the pages using these target interfaces are counted, so that the server can analyze the loading time of the target interfaces used by the massive target web pages, thereby completing the analysis of the target interface loading speed and the subsequent optimization of the target interface.
[0032] Step 102: If the M first historical loading durations meet a preset condition, the native interface link of the target interface is added to the page link of the target page.
[0033] In an embodiment of the present application, for a target interface, if the M first historical loading durations of the target interface received by the server meet the preset condition, it is considered that the response speed of the target interface does not meet the requirements and needs to be optimized to improve the response speed of the client side when using the target page with the target interface. The preset condition can be a fixed condition set according to actual needs, or a condition obtained by analyzing the first historical loading duration of the target interface received by the server.
[0034] In practical applications, the prior art usually uses a browser kernel transmission interface to request data. Since the browser kernel transmission interface is an interface of the kernel layer, the data request process needs to occur when the browser is working and has loaded a page. The processing process is: first initialize the browser view control, and then request data through the browser kernel transmission interface. This process is a serial process. In the embodiment of the present application, after a browser kernel transmission interface is determined as a target interface that meets the preset conditions, it is necessary to optimize the target interface that meets the preset conditions, thereby increasing the speed of obtaining the data corresponding to the target interface that meets the preset conditions and improving the user experience.
[0035] In an embodiment of the present application, the optimization of the target interface that meets the preset conditions can be specifically as follows: on the client side, the target interface of the browser kernel transmission interface type is replaced with the native transmission interface of the application layer. The data requested by the native transmission interface and the browser kernel transmission interface are the same. Since the native transmission interface of the application layer works at the application layer and is a non-kernel layer interface, replacing the original browser kernel transmission interface with the native transmission interface can enable the user to request the resources required for opening the page in advance through the native transmission interface before using the browser to process the page on the client, and extract and cache the resources. When the browser is used to process the page subsequently, the cached resources are directly called for use, and the process of requesting resources can occur before the browser view control initialization process, or in parallel with the browser view control initialization process, thereby changing the original page serial processing process, so that when the user opens the browser to browse the page on the client, the resources required for the page have been cached in advance, thereby eliminating the process of requesting the resources and improving the response speed of the page.
[0036] Specifically, the server can obtain the native interface link corresponding to the target interface that meets the preset conditions, and add the native interface link to the page link of the page that uses the browser kernel transmission interface, and then send the page link to the client. The page link can be regarded as the interface loading strategy issued by the server for the client to execute. The client user can obtain the data of the native interface link in advance for caching before using the browser to browse the page, and when the user views the page, open the page link through the client's browser to load the page to meet the user's needs.
[0037] In one implementation, M first historical loading times satisfy a preset condition, which may include: after the server receives a certain number (M-1) of first historical loading times of target interfaces sent by the client, the server can analyze the first historical loading time of each target interface to determine the upper limit threshold of the loading time of each target interface, where the upper limit threshold of the loading time of the target interface is the upper limit value of the loading time of the target interface. If the first loading time of the target interface (the Mth target interface) currently newly received by the server exceeds the upper limit threshold of the loading time, it is considered that the loading time of the newly received target interface is slow and inefficient, which will affect the user experience, and it is considered to meet the preset condition; if the first loading time of the newly received target interface is less than the upper limit threshold of the loading time, it is considered that the loading time of the newly received target interface is normal and will not affect the user experience, and it is considered to not meet the preset condition.
[0038] It should be noted that a larger threshold (such as M-1=10,000) can be set for the number of first historical loading times of the target interfaces previously received by the server (M-1), so that the server will determine the upper limit threshold of the first loading time of each target interface only when the number of first historical loading times received by the server is greater than the threshold. In this way, by analyzing the first historical loading times of a large number of target interfaces, as many pages using these target interfaces as possible can be expanded, making the data analysis process more accurate.
[0039] Specifically, the upper limit threshold of the loading time of the target interface can be a fixed time threshold. In addition, the upper limit threshold of the loading time of the target interface can also be: the average value of all first historical loading times of the target interface. The embodiment of the present application is not limited to this.
[0040] In this implementation, if the first historical loading time currently received by the target interface is greater than or equal to the upper limit threshold of the loading time, the target interface is considered to meet the preset conditions. The target interface that meets the preset conditions is considered to be an interface with a slower loading speed, and it takes a longer time to request data. In order to ensure user experience, the client side needs to further optimize the target interface that meets the preset conditions to reduce the time spent by the client for subsequent calls to the target interface that meets the preset conditions.
[0041] In another implementation, optionally, M first historical loading durations meet preset conditions, specifically including: at least N of the M first historical loading durations are greater than a first threshold, or, the target historical loading duration is greater than a second threshold; wherein, the target historical loading duration is determined based on the M first historical loading durations.
[0042] In the embodiment of the present application, the other implementation method has two judgment methods for the M first historical loading durations to meet the preset condition:
[0043] Method 1: When at least N first historical loading durations among the M first historical loading durations are greater than the first threshold, the target interface is determined to meet the preset condition.
[0044] Among them, the minimum value of N and the value of the first threshold can be fixed values. For example, a first threshold is preset to 2 seconds for the target interface, and the minimum value of N is preset to 10. Then, for each target interface, among its M first historical loading times, as long as the number of first historical loading times greater than 2 seconds exceeds 10, the target interface is determined to meet the preset conditions, and it is considered that the time spent on data loading is too long, which affects the user experience and needs to be optimized.
[0045] In addition, the value of the first threshold can be a fixed value, and the ratio of N and M can also be a fixed value. For example, assuming that M is 10, a first threshold of 2 seconds is preset for the target interface, and the ratio of N and M is preset to 0.6. Then, for each target interface, among its 10 first historical loading times, as long as the ratio of the number of first historical loading times greater than 2 seconds to 10 is 0.6, the target interface is determined to meet the preset conditions, and it is considered that the time spent on data loading is too long, which affects the user experience and needs to be optimized.
[0046] Method 2: The target historical loading duration determined according to the M first historical loading durations is greater than the second threshold.
[0047] Among them, the target historical loading duration determined according to the M first historical loading durations can be the average value of the M first historical loading durations. According to actual needs, the second threshold can be the same as the above-mentioned first threshold or different from the above-mentioned first threshold.
[0048] For example, a second threshold of 2 seconds is preset for the target interface. According to its M first historical loading times, the average value of the M first historical loading times is obtained as a. If the average value a is greater than 2 seconds, the target interface is determined to meet the preset conditions, and it is considered that the time spent on data loading is too long, which affects the user experience and needs to be optimized.
[0049] In addition, when the client generates M first historical loading times, it can also set a corresponding weight for each first historical loading time according to actual conditions. The target historical loading time determined according to the M first historical loading times can also be a weighted average calculated based on the M first historical loading times and the weight values of the M first historical loading times.
[0050] Step 103: Send the page link of the target page.
[0051] In an embodiment of the present application, the server can send the page link of the target page to all clients that have established a connection with it. In addition, the server can also add the page link of the target page to the response to the request only when it receives the request sent by the client.
[0052] The client can establish a communication connection with the data end corresponding to the native interface link by opening the native interface link in the page link, thereby requesting the data end to obtain the target data corresponding to the native interface link and storing the target data locally.
[0053] After the client has stored the target data requested by the target interface locally, when a subsequent user requests a page according to the page link and calls the target interface, the target data can be directly extracted locally and processed by the browser view control.
[0054] In summary, the embodiment of the present application provides a method for issuing a loading strategy. The server can analyze the loading time of the interfaces used by the massive web pages fed back by each client, so as to determine the target interfaces that need to be replaced by the native interfaces. These target interfaces can be used as target interfaces that meet the preset conditions, and their native interface links are added to the page links of the target pages and fed back to the client, so that the client can cache the interface resources in advance through the native interface. The present application does not need to analyze the target interfaces that meet the preset conditions for a fixed page. This enables the server to obtain a larger number of target interfaces that meet the preset conditions through big data processing, and these target interfaces can be used in multiple pages, which solves the problem that the target interfaces that meet the preset conditions cannot achieve compatibility in other web pages, and improves the versatility of the target interfaces.
[0055] Reference Figure 2 , which shows a schematic diagram of specific steps of a method for issuing a loading strategy provided in an embodiment of the present application, applied to a server, including:
[0056] Step 201: Receive a first historical loading duration of a target interface of a target page sent by M clients located in a first location area.
[0057] In the embodiment of the present application, the client can be distributed in various location areas to use the target page, and generate historical usage data in the process of using the target page. For the same target interface, its loading time in different location areas may be different. Therefore, the historical loading time of the target interface should also be associated with the location area where the client is located when loading the interface. The historical usage data can include both the first historical loading time of the target interface of the target page and the location area where the client is located when loading the target interface.
[0058] Step 202: Receive second historical loading durations sent by X clients located in a second location area, and determine a third threshold value according to the X second historical loading durations.
[0059] In actual applications, regardless of the location area of the user, the requirements for the ideal loading time of the same target interface are the same, that is, the shorter the ideal loading time, the better. In view of this situation, the embodiment of the present application can perform a separate optimization of the target interface in a certain location area when the historical loading time of the target interface does not meet the user's requirements, so that when the client opens the browser to browse the page, the resources required by the target interface in the page have been cached in advance, thereby eliminating the process of requesting the resource and improving the response speed of the page.
[0060] Therefore, while the server obtains the first historical loading time of the target interface of the target page sent by M clients located in the first location area, it can also obtain the second historical loading time sent by X clients located in the second location area, where the second location area may include a location area different from the first location area.
[0061] Afterwards, the server may determine a third threshold value based on the X second historical loading times, where the third threshold value is a threshold value for judging whether the target interface meets a preset condition. If the loading time of a target interface is less than or equal to the third threshold value, it indicates that the loading time of the target interface is normal and can be accepted by the user. If the loading time of a target interface is greater than the third threshold value, it indicates that the loading time of the target interface is too slow and needs to be optimized.
[0062] For example, assuming that the first location area is Jiangsu Province and the second location area is Zhejiang Province, and the server receives the second historical loading times sent by five clients in Zhejiang Province, then the third threshold can be the average of the second historical loading times sent by the five clients in Zhejiang Province. In addition, when the client generates five second historical loading times, it can also set a corresponding weight for each second historical loading time according to actual conditions. Then the third threshold can also be a weighted average value obtained based on the five second historical loading times and the weight values of the five second historical loading times.
[0063] Step 203: If at least N of the M first historical loading times are greater than the third threshold, or the target historical loading time is greater than the third threshold, it is determined that the M first historical loading times meet the preset conditions, and the native interface link of the target interface is added to the page link of the target page.
[0064] Among them, the target historical loading duration is determined according to the M first historical loading durations.
[0065] In an embodiment of the present application, if at least N of the M first historical loading times are greater than the third threshold, or the target historical loading time is greater than the third threshold, then it is determined that the M first historical loading times meet the preset conditions. The process uses the third threshold corresponding to the target interface in the second location area as a basis for judgment, and considers that the loading time of the target interface by the client in the first location area does not meet user requirements. Therefore, it is necessary to separately optimize the process of the client in the first location area using the target page including the target interface. The specific optimization process may include adding the native interface link of the target interface to the page link of the target page for sending.
[0066] For example, assuming that the first location area is Jiangsu Province and the second location area is Zhejiang Province, the server receives the second historical loading time sent by 5 clients from Zhejiang Province, and based on the 5 second historical loading time, determines that the third threshold is 2 seconds. When the server subsequently receives the second historical loading time of the target interface sent by a client from Jiangsu Province as 2.5 seconds, it is considered that the client in Jiangsu Province is too slow in loading the target interface and needs to be optimized.
[0067] In addition, assuming that the first location area is the United States and the second location area is China, when accessing page a, certain data is obtained through interface A included in page a, and interface A obtains data specifically by accessing a data terminal located in China. Due to the distance between the area where the data terminal providing the data is located and the area where the client is located, and the data terminal is in China, the time required for clients in the two countries to load interface A is different, that is, when the client in the United States accesses interface A, it needs to access the server in China. The longer distance will make the loading time too long. For example, a third threshold of 2 seconds can be determined based on the second historical loading time of the client in China, and the average first loading time of the client in the United States is 6 seconds. At this time, the first loading time of the client in the United States meets the preset conditions, and the native interface link of the target interface needs to be added to the page link of the target page and sent to the client in the United States. After optimization, the client in the United States can cache the resources required for the target interface in advance through the native interface link of the target interface, thereby eliminating the process of requesting the resource from the server in China when the target page is officially opened, thereby improving the response speed of the page.
[0068] Specifically, in the embodiment of the present application, there are two ways to judge whether the M first historical loading durations meet the preset conditions:
[0069] Method 1: When at least N first historical loading durations among the M first historical loading durations are greater than the third threshold, the target interface is determined to meet the preset condition.
[0070] Among them, the minimum value of N and the value of the first threshold can be fixed values. For example, according to the second loading time of the target interface in the second location area, the third threshold is determined to be 1.5 seconds, and the minimum value of N is preset to 10. Then, for each target interface loaded in the first location area, among its M first historical loading times, as long as the number of first historical loading times greater than 1.5 seconds exceeds 10, the target interface is determined to meet the preset conditions, and it is considered that in the first location area, the data loading process of the target interface takes too long, affecting the user experience and needs to be optimized.
[0071] In addition, the ratio of N and M can also be a fixed value. For example, assuming that M is 10, and the ratio of N and M is preset to 0.6, then for each target interface, among its 10 first historical loading times, as long as the ratio of the number of first historical loading times greater than 1.5 seconds to 10 is 0.6, the target interface is determined to meet the preset conditions, and it is considered that in the first location area, the data loading process of the target interface takes too long, affecting the user experience, and needs to be optimized.
[0072] Method 2: The target historical loading duration determined according to the M first historical loading durations is greater than the third threshold.
[0073] Among them, the target historical loading duration determined according to the M first historical loading durations may be an average value of the M first historical loading durations.
[0074] For example, based on the second loading time of the target interface in the second location area, the third threshold is determined to be 1.5 seconds. Based on the M first historical loading time of the target interface in the first location area, the average value of the M first historical loading time is obtained as a. If the average value a is greater than 2, the target interface is determined to meet the preset conditions, and it is considered that the time spent on data loading is too long, which affects the user experience and needs to be optimized.
[0075] In addition, when the client in the first location area generates M first historical loading times, it can also set a corresponding weight for each first historical loading time according to actual conditions. The target historical loading time determined according to the M first historical loading times can also be a weighted average calculated based on the M first historical loading times and the weight values of the M first historical loading times.
[0076] Optionally, step 203 may specifically include:
[0077] Sub-step 2031: Encode the native interface link of the target interface according to a preset encoding rule to obtain a link code.
[0078] In the embodiment of the present application, the page link includes a page body link, which is a link used by the client browser to request the entire page. In the embodiment of the present application, the client browser can identify the default format of the page link for a page link, and the default format of the page link is a format that only includes the identifiable page body link. If the server directly splices the native interface link of the target interface with the page body link to obtain the page link, then since the native interface link that can also be identified changes the default format of the page link, the browser will face two executable links at the same time, resulting in an execution logic conflict, and the page link cannot be processed. In addition, by modifying the browser kernel parameters, the browser can be enabled to process the page link obtained by directly splicing the native interface link of the target interface with the page body link, but since the kernel parameter modification process is cumbersome and complicated, the actual application value is not high.
[0079] In this step, the server can encode the native interface link of the target interface according to the preset encoding rules to obtain the link code, so that after the link code is spliced with the page body link, the link code that cannot be directly processed can be used as a parameter of the page body link. In this way, after the spliced page link is sent to the client, the client browser can directly process the page body link of the page link, and the link code will not affect the normal recognition of the page body link.
[0080] It should be noted that the preset encoding rule may be any encryption encoding rule, for example, the encoding rule may be URL encoding (URL encoding, uniform resource locator encoding), which is not limited in the embodiment of the present application.
[0081] For example, for an H5 page, a page main link is: http: / / www.XXXXXX.com / in / XXXXXX / 10021?; a native interface connection for requesting data from a data terminal in the UK is: https: / / connect.XXXXXX.net / XXXXXX / sdk.js; if the server directly splices these two links into a page link and sends it to the client, the client will not be able to process the page link normally.
[0082] Therefore, the native interface connection can be encoded according to the urlencode encoding rules to obtain the link encoding: synlink=https%3a%2f%2.XXXXXX.net%2fen%2YYYY.js; it can be seen that this encoding method encodes and replaces the special characters in the native interface connection.
[0083] Sub-step 2032: concatenate the link code with the page body link to obtain the page link.
[0084] Referring to the example of step 205 above, after concatenating the link code: synlink=https%3a%2f%2XXXXXX.XXXXXX.net%2fen_%2fsdk.js with the page body link http: / / www.XXXXXX.com / in / product / 10021?, the page link can be obtained: http: / / www.XXXXXX.com / in / XXXXXX / 10021?synlink=https%3a%2f%2.XXXXXX.net%XXXXXX%2fsdk.js.
[0085] Furthermore, since the server processes the native interface link into a link code according to preset encoding rules, when the client receives a page link and needs to request the target data corresponding to the native interface link for advance resource caching, in order to process the link code, the client needs to decode the link code according to the same encoding rules as the server to obtain a decoding result.
[0086] The client obtains the target data according to the decoding result. The client can establish a communication connection with the data end corresponding to the native interface link by opening the decoding result, thereby requesting the data end to obtain the target data corresponding to the native interface link, and locally storing the target data. It should be noted that the client can open the decoding result and the client can open the native interface link.
[0087] In the embodiment of the present application, the client stores the correspondence between the link code and the target data in a preset storage area.
[0088] In order to optimize the storage of target data, the target data and the link code corresponding to the target data may be stored in the form of a key-value pair, that is, the link code is used as the key and the target data corresponding to the link code is used as the key value.
[0089] When the client requests a page according to the page link and calls the target interface, the client extracts the target data from the preset storage area according to the link code corresponding to the target interface for processing. A mapping relationship between the target interface and the link code is established in the client. When the client requests a page according to the page link and calls the target interface, the client can use the link code corresponding to the target interface as a query key to extract the target data corresponding to the query key from the preset storage area for processing.
[0090] In addition, the client can also send the total time spent by the page link to the server. In an embodiment of the present application, after the client completes the page request process according to the page link, the client can also count the total time spent on requesting the page according to the page link, and send the total time to the server. The server can use the total time as a parameter for evaluating the quality of the corresponding native interface in the page link, thereby achieving further optimization of the interface.
[0091] When the server determines that the total time is greater than the preset time threshold, the server marks the page link. In an embodiment of the present application, the preset time threshold corresponding to the page can be determined based on the total historical request time of the page. For example, in one implementation, the preset time threshold can be the average of all the total historical request times of the page.
[0092] When the total time of a page sent by the client is greater than a preset time threshold, it can be considered that the page response speed is too slow. The server can mark the page link so that the developer can optimize the native interface link and the page body link in the marked page link to improve the response speed of the page requested based on the page link.
[0093] Optionally, the above steps 202 and 203 may also be replaced by step 102 in the previous embodiment to achieve the same effect as step 102 in the previous embodiment, which will not be described in detail herein.
[0094] Step 204: Send a page link of the target page to the client located in the first location area.
[0095] In an embodiment of the present application, when the server determines that the first historical loading duration of the target interface in the first location area meets the preset conditions, it can be further considered that all clients in the first location area will have a slow response problem when using the target interface.
[0096] The server can push a page link including a native interface link of the target interface to all clients in the first location area, so that all clients in the first location area can replace the target interface of the browser kernel transmission interface with the native transmission interface of the application layer on the client side to achieve early caching of the target data resource corresponding to the target interface, thereby improving the response speed of the page and achieving adaptive acceleration for all clients in the first location area. In addition, the server can also add the page link of the target page to the response to the request only when receiving a request sent by a client in the first location area.
[0097] In summary, the embodiment of the present application provides a method for issuing a loading strategy. The server can analyze the loading time of the interfaces used by the massive web pages fed back by each client, so as to determine the target interfaces that need to be replaced by the native interfaces. These target interfaces can be used as target interfaces that meet the preset conditions, and their native interface links are added to the page links of the target pages and fed back to the client, so that the client can cache the interface resources in advance through the native interface. The present application does not need to analyze the target interfaces that meet the preset conditions for a fixed page, which enables the server to obtain a larger number of target interfaces that meet the preset conditions through big data processing, and these target interfaces can be used in multiple pages, which solves the problem that the target interfaces that meet the preset conditions cannot achieve compatibility in other web pages, and improves the versatility of the target interfaces.
[0098] Furthermore, in the embodiment of the present application, when generating the page link, the server can also process the native interface link in the page link into a link code through a preset coding rule, and splice the link code with the page body link to obtain the page link, so that the native interface link can be used as a parameter of the page body link, thereby avoiding the cost increase caused by modifying the browser kernel parameters when the client processes the page link. In addition, the server can also send the page link including the native interface link of the target interface to all clients in the target location area corresponding to the target interface, thereby achieving adaptive acceleration for these clients.
[0099] It should be noted that the loading policy issuing method provided in the embodiment of the present application can be executed by a server, or a control module in the loading policy issuing device for executing the loading policy issuing method.
[0100] Reference Figure 3 , which shows a block diagram of a loading strategy issuing device provided in an embodiment of the present application, including:
[0101] The first receiving module 301 is used to receive the first historical loading duration of the target interface of the target page sent by M clients;
[0102] Optionally, the first receiving module 301 specifically includes:
[0103] A receiving submodule, configured to receive a first historical loading duration of a target interface of a target page sent by M clients located in a first location area;
[0104] An adding module 302, configured to add the native interface link of the target interface to the page link of the target page if the M first historical loading durations meet a preset condition;
[0105] Optionally, the page link includes: a page body link, and the adding module 302 specifically includes:
[0106] The encoding submodule is used to encode the native interface link of the target interface according to a preset encoding rule to obtain a link code;
[0107] The splicing submodule is used to splice the link code with the page body link to obtain the page link.
[0108] The sending module 303 is used to send the page link of the target page.
[0109] Optionally, the sending module 303 specifically includes:
[0110] The sending submodule is used to send a page link of a target page to a client located in the first location area.
[0111] Optionally, the M first historical loading durations satisfy a preset condition, specifically including:
[0112] At least N of the M first historical loading durations are greater than a first threshold, or the target historical loading duration is greater than a second threshold;
[0113] Among them, the target historical loading duration is determined according to the M first historical loading durations.
[0114] Optionally, the device further comprises:
[0115] A second receiving module is configured to receive second historical loading durations sent by X clients located in a second location area, and determine a third threshold value according to the X second historical loading durations;
[0116] Optionally, the M first historical loading durations satisfy a preset condition, specifically including:
[0117] At least N of the M first historical loading durations are greater than the third threshold, or the target historical loading duration is greater than the third threshold;
[0118] Among them, the target historical loading duration is determined according to the M first historical loading durations.
[0119] In summary, the embodiment of the present application provides a loading strategy issuing device, and the server can analyze the loading time of the interfaces used by the massive web pages fed back by each client, so as to determine the target interfaces that need to be replaced by the native interfaces. These target interfaces can be used as target interfaces that meet the preset conditions, and their native interface links are added to the page links of the target pages and fed back to the client, so that the client can cache the interface resources in advance through the native interface. The present application does not need to analyze the target interfaces that meet the preset conditions for a fixed page, which enables the server to obtain a larger number of target interfaces that meet the preset conditions through big data processing, and these target interfaces can be used in multiple pages, which solves the problem that the target interfaces that meet the preset conditions cannot achieve compatibility in other web pages, and improves the versatility of the target interfaces.
[0120] In the embodiment of the present application, the loading strategy issuing device can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0121] The loading strategy issuing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0122] The loading strategy issuing device provided in the embodiment of the present application can achieve Figure 1 to Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0123] Optional, such as Figure 4 As shown, an embodiment of the present application also provides an electronic device 700, including a processor 701, a memory 702, and a program or instruction stored in the memory 702 and executable on the processor 701. When the program or instruction is executed by the processor 701, each process of the above-mentioned loading strategy delivery method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0124] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0125] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0126] The electronic device 800 includes but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 810.
[0127] Those skilled in the art will appreciate that the electronic device 800 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 810 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0128] Among them, for the method of issuing the loading strategy, the network module 802 is used to receive the first historical loading time of the target interface of the target page sent by M clients, and send the page link of the target page
[0129] Processor 810, configured to add the native interface link of the target interface to the page link of the target page if the M first historical loading durations meet a preset condition;
[0130] Optionally, the M first historical loading durations satisfy a preset condition, specifically including:
[0131] At least N of the M first historical loading durations are greater than a first threshold, or the target historical loading duration is greater than a second threshold;
[0132] Among them, the target historical loading duration is determined according to the M first historical loading durations.
[0133] Optionally, the network module 802 is used to receive a first historical loading time of a target interface of a target page sent by M clients located in a first location area; and send a page link of the target page to the clients located in the first location area.
[0134] Optionally, the network module 802 is configured to receive second historical loading durations sent by X clients located in a second location area, and determine a third threshold value according to the X second historical loading durations. At least N of the M first historical loading durations are greater than the third threshold value, or the target historical loading duration is greater than the third threshold value;
[0135] Among them, the target historical loading duration is determined according to the M first historical loading durations.
[0136] Optionally, the page link includes: a page body link, and a processor 810 is used to encode the native interface link of the target interface according to a preset encoding rule to obtain a link code; and to concatenate the link code with the page body link to obtain the page link.
[0137] In an embodiment of the present application, the server can analyze the loading time of the interfaces used in the massive web pages fed back by various clients, so as to determine the target interfaces that need to be replaced by the native interfaces. These target interfaces can be used as target interfaces that meet the preset conditions, and their native interface links are added to the page links of the target pages and fed back to the clients, so that the clients can cache the interface resources in advance through the native interfaces. The present application does not need to analyze the target interfaces that meet the preset conditions for a fixed page, which enables the server to obtain a larger number of target interfaces that meet the preset conditions through big data processing, and these target interfaces can be used in multiple pages, which solves the problem that the target interfaces that meet the preset conditions cannot achieve compatibility in other web pages, and improves the versatility of the target interfaces.
[0138] It should be understood that in the embodiment of the present application, the input unit 804 may include a graphics processor (GPU) 8041 and a microphone 8042, and the graphics processor 8041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 806 may include a display panel 8061, and the display panel 8061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 807 includes a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include two parts: a touch detection device and a touch controller. Other input devices 8072 may include but are not limited to a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 809 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 810 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, the user interface, and the application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 810.
[0139] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned loading strategy delivery method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0140] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a disk or
[0141] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned loading strategy delivery method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0142] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0143] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0145] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A link delivery method, It is characterized in that The method comprises: Receive the first historical loading duration of the target interface of the target page sent by M clients; If the M first historical loading durations meet a preset condition, adding the native interface link of the target interface to the page link of the target page; Sending a page link of the target page; If the M first historical loading durations meet a preset condition, then adding the native interface link of the target interface before the page link of the target page, the method further includes: receiving second historical loading durations sent by X clients located in a second location area, and determining a third threshold according to the X second historical loading durations; The M first historical loading durations meet a preset condition, specifically including: At least N of the M first historical loading durations are greater than the third threshold, or the target historical loading duration is greater than the third threshold; The target historical loading duration is determined according to the first historical loading duration of the target interface of the target page sent by the M clients located in the first location area; The receiving of the first historical loading duration of the target interface of the target page sent by the M clients specifically includes: Receive a first historical loading duration of a target interface of a target page sent by M clients located in a first location area; The sending of the page link of the target page specifically includes: Sending a page link of the target page to a client located in the first location area.
2. The method according to claim 1, It is characterized in that The M first historical loading durations meet a preset condition, specifically including: At least N of the M first historical loading durations are greater than a first threshold, or the target historical loading duration is greater than a second threshold; Among them, the target historical loading duration is determined according to the M first historical loading durations.
3. The method according to claim 1, It is characterized in that The page link includes: a page body link, and the page link of adding the native interface link of the target interface to the target page includes: Encoding the native interface link of the target interface according to a preset encoding rule to obtain a link code; The link code is concatenated with the page body link to obtain the page link.
4. A loading strategy issuing device, applied to a server, It is characterized in that The device comprises: A first receiving module is used to receive a first historical loading time of a target interface of a target page sent by M clients; An adding module, configured to add the native interface link of the target interface to the page link of the target page if the M first historical loading durations meet a preset condition; A sending module, used for sending a page link of the target page; A second receiving module is configured to receive second historical loading durations sent by X clients located in a second location area, and determine a third threshold value according to the X second historical loading durations; The M first historical loading durations meet a preset condition, specifically including: At least N of the M first historical loading durations are greater than the third threshold, or the target historical loading duration is greater than the third threshold; The target historical loading duration is determined according to the first historical loading duration of the target interface of the target page sent by the M clients located in the first location area; The first receiving module specifically includes: A receiving submodule, configured to receive a first historical loading duration of a target interface of a target page sent by M clients located in a first location area; The sending module specifically includes: The sending submodule is used to send the page link of the target page to the client located in the first location area.
5. The device according to claim 4, It is characterized in that The M first historical loading durations meet a preset condition, specifically including: At least N of the M first historical loading durations are greater than a first threshold, or the target historical loading duration is greater than a second threshold; Among them, the target historical loading duration is determined according to the M first historical loading durations.
6. The device according to claim 4, It is characterized in that The page link includes: a page main body link, and the adding module specifically includes: The encoding submodule is used to encode the native interface link of the target interface according to a preset encoding rule to obtain a link code; The splicing submodule is used to splice the link code with the page body link to obtain the page link.
