A page loading method, system, terminal device and readable storage medium
By using the preload engine to obtain and push the next hop page data during the page loading process, the response time extension caused by the interface request is solved, and the page loading efficiency is improved.
Patent Information
- Application Number
- CN202210193629.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-02-28
AI Technical Summary
In the existing page loading technology, the interface requests of the first page and the next hop page are not decoupled, resulting in a longer response time of the first page and an increase in data transmission time.
While returning page data to the client through the first page server, the preload engine is used to obtain and push the next hop page data of the first page to achieve decoupling of interface requests and avoid affecting the main thread request.
The response time of the first page is shortened, and the problem of unavailability of the main interface caused by the unavailability of the next hop page interface is avoided, which improves the page loading efficiency.
Smart Images

Figure CN114637936B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of page loading technology, and in particular to a page loading method, device, terminal equipment and readable storage medium. Background Art
[0002] When users load a page, the response time of the page loading will be long due to problems such as poor local network and long request link, which affects the user experience.
[0003] In the related art, a preloading method is used to shorten the response time of loading the next hop page of the first page, but its preloading method is that when the user requests the first page, the data of the first page and the data of the next hop page of the first page are returned to the client at the same time. At this time, since the interface request of the first page and the interface request of the next hop page of the first page are not decoupled, that is, the interface of the first page and the interface of the next hop page of the first page are requested at the same time using the same thread, when the interface of the next hop page of the first page is unavailable, the interface of the first page will also be unavailable, resulting in the inability to return the data of the first page and the data of the next hop page of the first page to the client at the same time, and the response time will be increased to the response time of the first page plus the response time of the next hop page of the first page, resulting in a longer response time of the first page, and the amount of data returned is the sum of the data of the first page and the data of the next hop page of the first page, which will increase the data transmission time and cause the response time of the first page to be longer. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a page loading method, system, terminal device and readable storage medium, which returns the page data of the first page to the client through the first page server, and obtains the page data of the next hop page of the first page through the preloading engine and pushes it to the client, thereby realizing the decoupling of the interface request of the first page and the interface request of the next hop page of the first page. The specific technical solution is as follows:
[0005] In a first aspect of an embodiment of the present invention, a page loading method is first provided, the method comprising:
[0006] The first page server returns the page data of the first page to the client in response to the first page loading request sent by the client, and sends a preloading request carrying the identifier of the first page to the preloading engine, wherein the preloading request is used to request the page data of the next hop page of the first page;
[0007] The preloading engine receives the preloading request and parses the identifier of the first page from the preloading request;
[0008] The preloading engine obtains page data of a next-hop page of the first page according to the identifier of the first page;
[0009] The preloading engine pushes page data of a next-hop page of the first page to the client.
[0010] Optionally, the preloading engine acquires page data of a next-hop page of the first page according to the identifier of the first page, including:
[0011] The preloading engine acquires the interface information of the next hop page of the first page according to the identifier of the first page;
[0012] The preloading engine obtains the page data of the next hop page of the first page from the page server corresponding to the interface information of the next hop page of the first page.
[0013] Optionally, the preloading engine acquires interface information of a next hop page of the first page according to the identifier of the first page, including:
[0014] The preloading engine obtains the preloading flow, where the preloading flow is the amount of preloading page data pushed per unit time;
[0015] The preloading engine compares the preloading flow with a first threshold;
[0016] When the preloading traffic is less than the first threshold, the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page.
[0017] Optionally, the method further comprises:
[0018] When the preloading flow is not less than the first threshold, the preloading engine determines the preloading priority corresponding to the first page according to the identifier of the first page;
[0019] When the preloading priority corresponding to the first page is higher than the preset priority, the preloading engine obtains interface information of at least one next-hop page of the first page according to the first page identifier.
[0020] Optionally, the method further comprises:
[0021] When the preload flow is not less than a first threshold, the preload engine randomly obtains a preset parameter from a preset interval, where the preset interval is divided into a loading interval and a non-loading interval;
[0022] When the preset parameter belongs to the loading interval, the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page.
[0023] Optionally, after the preloading engine receives the preloading request, the method further includes:
[0024] The preloading engine obtains the page data flow of the first page server, where the page data flow is the amount of page data returned by the first page server to the client within a unit time;
[0025] When the page data flow of the first page server is greater than a second threshold, the preloading engine refuses to respond to the preloading request;
[0026] The preloading engine receives the preloading request and parses the identifier of the first page from the preloading request, including:
[0027] When the page data flow of the first page server is not greater than the second threshold, the preloading engine receives the preloading request and parses the identifier of the first page from the preloading request.
[0028] Optionally, before the preloading engine pushes page data of the next hop page of the first page to the client, the method further includes:
[0029] The client searches for cache page data of the next hop page of the first page from a cache database in response to a user's loading request operation for the next hop page of the first page;
[0030] When the cached page data of the next hop page of the first page exists in the cache database, the client loads the next hop page of the first page according to the cached page data of the next hop page of the first page;
[0031] After the preloading engine pushes the page data of the next hop page of the first page to the client, the method further includes:
[0032] The client updates the cache page data of the next hop page of the first page in the cache database according to the page data of the next hop page of the first page.
[0033] Optionally, the client loading the next hop page of the first page according to cached page data of the next hop page of the first page includes:
[0034] The client obtains the storage duration of the cache page data of the next hop page of the first page in the cache database, where the storage duration is the time length from the moment when the cache page data is stored in the cache database to the current moment;
[0035] When the storage time length is less than the preset time length, the client loads the next hop page corresponding to the first page according to the cached page data of the next hop page corresponding to the first page.
[0036] Optionally, before the first page server responds to the first page loading request sent by the client, the method further includes:
[0037] The preloading engine obtains switch configuration information, wherein the switch configuration information includes an association relationship between each preloading switch and a corresponding page, and the preloading switch is used to control the start or stop of a preloading task of a next hop page of the corresponding page;
[0038] The preloading engine acquires interface information of a next hop page of the first page according to the first page identifier, including:
[0039] When the preloading switch corresponding to the first page is turned on, the preloading engine obtains the interface information of the next hop page of the first page according to the first page identifier.
[0040] Optionally, the method further comprises:
[0041] The preloading engine establishes an initially empty message queue and sends a first preloading program to the first page server so that the first page server runs the first preloading program;
[0042] The preloading engine sends a second preloading program to a page server corresponding to the interface information of at least one next-hop page of the first page, so that the corresponding page server runs the second preloading program;
[0043] The first page server executes the steps according to the first preloading program: generating the preloading request before returning the page data of the first page to the client; acquiring the interface information of the next hop page of the first page according to the identifier of the first page; adding the preloading request and the interface information of the next hop page of the first page to the message queue;
[0044] The page server corresponding to the interface information of the next hop page of the first page performs the following steps according to the second preloading program:
[0045] Monitor whether the message queue contains the preload request and whether the interface information of the next hop page of the first page is the interface information corresponding to the first page;
[0046] When the preloading request is monitored from the message queue and the interface information of the next hop page of the first page is the interface information corresponding to itself, the page data of the next hop page of the first page provided by itself is pushed to the client.
[0047] In a second aspect of an embodiment of the present invention, a page loading system is further provided, the system comprising at least:
[0048] A first page server and a preloading engine; the first page server is used to respond to a first page loading request sent by a client, return page data of the first page to the client, and send a preloading request carrying an identifier of the first page to the preloading engine, wherein the preloading request is used to request page data of a next-hop page of the first page;
[0049] The preloading engine is configured to receive the preloading request and parse the identifier of the first page from the preloading request;
[0050] The preloading engine is further used to obtain page data of a next-hop page of the first page according to the identifier of the first page;
[0051] The preloading engine is further used to push page data of the next hop page of the first page to the client.
[0052] Optionally, the preloading engine is further used to obtain interface information of a next hop page of the first page according to the identifier of the first page;
[0053] The preloading engine is further used to obtain the page data of the next hop page of the first page from the page server corresponding to the interface information of the next hop page of the first page.
[0054] Optionally, the preloading engine is further used to obtain preloading traffic, where the preloading traffic is the amount of preloading page data pushed per unit time;
[0055] The preloading engine is further used to compare the preloading flow with a first threshold;
[0056] The preloading engine is further configured to obtain, when the preloading traffic is less than the first threshold, interface information of a next hop page of the first page according to an identifier of the first page.
[0057] Optionally, the preloading engine is further configured to determine a preloading priority corresponding to the first page according to an identifier of the first page when the preloading flow is not less than the first threshold;
[0058] The preloading engine is further configured to obtain interface information of at least one next-hop page of the first page according to the first page identifier when the preloading priority corresponding to the first page is higher than a preset priority.
[0059] Optionally, the preloading engine is further configured to randomly obtain a preset parameter from a preset interval when the preloading flow is not less than a first threshold, wherein the preset interval is divided into a loading interval and a non-loading interval;
[0060] The preloading engine is further configured to obtain interface information of a next hop page of the first page according to an identifier of the first page when the preset parameter belongs to the loading interval.
[0061] Optionally, the preloading engine is further used to obtain the page data flow of the first page server, where the page data flow is the amount of page data returned by the first page server to the client in a unit time;
[0062] The preloading engine is further configured to refuse to respond to the preloading request when the page data flow of the first page server is greater than a second threshold;
[0063] The preloading engine is further used to receive the preloading request and parse the identifier of the first page from the preloading request when the page data flow of the first page server is not greater than the second threshold.
[0064] Optionally, the system further includes a client,
[0065] The client is used to search the cache page data of the next hop page of the first page from the cache database in response to the user's loading request operation for the next hop page of the first page;
[0066] The client is further configured to load the next hop page of the first page according to the cached page data of the next hop page of the first page when the cached page data of the next hop page of the first page exists in the cache database;
[0067] The client is further configured to update the cache page data of the next hop page of the first page in the cache database according to the page data of the next hop page of the first page.
[0068] Optionally, the client is further used to obtain the storage duration of the cache page data of the next hop page of the first page in the cache database, where the storage duration is the time length from the moment when the cache page data is stored in the cache database to the current moment;
[0069] The client is further configured to load a next hop page corresponding to the first page according to cached page data of the next hop page corresponding to the first page when the storage duration is less than a preset duration.
[0070] Optionally, the preloading engine is further used to obtain switch configuration information, wherein the switch configuration information includes an association relationship between each preloading switch and a corresponding page, and the preloading switch is used to control the start or end of the preloading task of the next hop page of the corresponding page;
[0071] The preloading engine is further configured to obtain interface information of a next hop page of the first page according to the first page identifier when the preloading switch corresponding to the first page is turned on.
[0072] Optionally, the system further comprises: a page server corresponding to the interface information of at least one next hop page of the first page;
[0073] The preloading engine is further used to establish an initially empty message queue and send a first preloading program to the first page server so that the first page server runs the first preloading program;
[0074] The preloading engine is further used to send a second preloading program to a page server corresponding to the interface information of at least one next-hop page of the first page, so that the corresponding page server runs the second preloading program;
[0075] The first page server is further configured to execute the following steps according to the first preloading program: generating the preloading request before returning the page data of the first page to the client; acquiring the interface information of the next hop page of the first page according to the identifier of the first page; and adding the preloading request and the interface information of the next hop page of the first page to the message queue;
[0076] The page server corresponding to the interface information of the next hop page of the first page is used to perform the following steps according to the second preloading program:
[0077] Monitor whether the message queue contains the preload request and whether the interface information of the next hop page of the first page is the interface information corresponding to the first page;
[0078] When the preloading request is monitored from the message queue and the interface information of the next hop page of the first page is the interface information corresponding to itself, the page data of the next hop page of the first page provided by itself is pushed to the client.
[0079] In a third aspect of an embodiment of the present invention, a terminal device is further provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0080] Memory, used to store computer programs;
[0081] The processor is used to implement any of the above-mentioned page loading methods when executing the program stored in the memory.
[0082] In another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned page loading methods is implemented.
[0083] The embodiment of the present invention provides a page loading method, system, terminal device and readable storage medium. First, the first page server responds to the first page loading request sent by the client, returns the page data of the first page to the client, and sends a preloading request carrying the identifier of the first page to the preloading engine. The preloading request is used to request the page data of the next hop page of the first page. Then, the preloading engine receives the preloading request, parses the identifier of the first page from the preloading request, and then, the preloading engine obtains the page data of the next hop page of the first page according to the identifier of the first page. Finally, the preloading engine pushes the page data of the next hop page of the first page to the client. The method has the following technical effects:
[0084] The first page server responds to the first page loading request sent by the client and returns the page data of the first page to the client. At the same time, before the first page server returns the page data of the first page corresponding to the first page identifier to the client, the first page server sends a preloading request carrying the identifier of the first page to the preloading engine, so that after the preloading engine receives the preloading request carrying the first page identifier sent by the first page server, it obtains the page data of at least one next-hop page of the first page according to the preloading request and pushes it to the client, thereby separating the request for the page data of the first page from the request for the page data of the next-hop page of the first page, and achieving the interface request for the first page and the next-hop page request through the message push of the preloading engine. The purpose of decoupling the interface request of the next hop page of a page is to avoid affecting the request of the main thread (the loading thread of the first page) by adding a preloading thread (the thread that returns the data of the next hop page of the first page), so as to avoid the problem that the interface of the first page is also unavailable due to the unavailability of the interface of the next hop page of the first page. Moreover, the first page server can directly return the page data of the first page to the client and load it, without the need to further obtain the page data of the next hop page of the first page after the first page server obtains the page data of the first page, and then return the page data of the first page and the page data of the next hop page of the first page to the client for loading at the same time, so the response time of the first page can be shortened. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0086] Figure 1 This is a flow chart of the steps of a page loading method shown in an embodiment of the present application;
[0087] Figure 2 It is a flowchart of the steps of a preloading engine obtaining page data of a next jump page of a first page shown in an embodiment of the present application;
[0088] Figure 3 is a structural block diagram of a page loading system shown in an embodiment of the present application;
[0089] Figure 4 It is a structural diagram of a terminal device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0090] The technical solution in the embodiment of the present invention will be described below in conjunction with the accompanying drawings in the embodiment of the present invention. In order to solve the problem that the interface request of the first page and the interface request of the next hop page of the first page are not decoupled in the related art, the present application provides a technical concept: while returning the page data of the first page to the client through the first page server, the page data of the next hop page of the first page is obtained and pushed to the client through the preloading engine, thereby achieving the decoupling of the interface request of the first page and the interface request of the next hop page of the first page, avoiding the problem that the interface of the first page is unavailable due to the unavailability of the interface of the next hop page of the first page, and shortening the response time of the first page.
[0091] The page loading method of this application will be described in detail below.
[0092] Figure 1 is a flow chart of the steps of a page loading method shown in an embodiment of the present application. Figure 1 As shown, the method includes:
[0093] Step S101: The first page server responds to the first page loading request sent by the client, returns the page data of the first page to the client, and sends a preloading request carrying the identifier of the first page to the preloading engine, wherein the preloading request is used to request the page data of the next hop page of the first page.
[0094] In this embodiment, when the user logs in to the client, the first page loading request can be sent to the first page server through the client, wherein the client can be a video player software, a shopping software, a news software, etc., and the first page can be a loading page including multiple next-hop page information such as a home page, an advertising page, or a personal details page. The next-hop page of the first page is the page to which the jump information of the next-hop page on the first page is jumped after clicking. After the first page server receives the first page loading request sent by the client, it can respond to the first page loading request through the main thread, obtain the page data corresponding to the first page and send it to the client. At the same time, before the first page server sends the page data corresponding to the first page to the client, the first page server generates a preloading request corresponding to the first page, and the preloading thread sends the preloading request to the preloading engine in a oneway manner, that is, the first page server only initiates a request to call the preloading engine without waiting for the preloading engine to return data to the first page server, wherein the preloading request at least carries the identifier of the first page, and the preloading request is used to request to preload at least one next-hop page of the first page, and the preloading engine receives the preloading request so as to return the page data of at least one next-hop page of the first page to the client.
[0095] Step S102: the preloading engine receives the preloading request, and parses the identifier of the first page from the preloading request.
[0096] In this embodiment, the preloading request includes the identifier of the first page. After receiving the preloading request, the preloading engine parses the preloading request to obtain the identifier of the first page included in the preloading request.
[0097] Step S103: the preloading engine obtains page data of the next hop page of the first page according to the identifier of the first page.
[0098] In this embodiment, the first page can jump to multiple next-hop pages. For example, if the first page is a video playback homepage of a video playback software, multiple specific video names are displayed in the video playback homepage. By clicking one of the video names, you can jump to a specific video playback page, which is one of the next-hop pages of the video playback homepage. According to the identifier of the first page, the corresponding page data can be obtained from the server corresponding to the next-hop page of the first page.
[0099] Step S104: the preloading engine pushes page data of the next hop page of the first page to the client.
[0100] In this embodiment, after the preloading engine obtains the page data of at least one next hop page of the first page, the page data of at least one next hop page of the first page can be directly pushed to the client so that when the user clicks on the displayed content of the next hop page of the first page, he can quickly jump to the next hop page.
[0101] In the present application, a first page server responds to a first page loading request sent by a client and returns page data of a first page to a client. At the same time, before the first page server returns page data of the first page corresponding to a first page identifier to the client, the first page server sends a preloading request carrying an identifier of the first page to a preloading engine, so that after the preloading engine receives the preloading request carrying the first page identifier sent by the first page server, it obtains page data of at least one next-hop page of the first page according to the preloading request and pushes it to the client, thereby separating the request for page data of the first page and the request for page data of the next-hop page of the first page, and achieving the interface request and request for the first page by means of message push of the preloading engine. The purpose of decoupling the interface request of the next hop page of the first page is to avoid affecting the request of the main thread (the loading thread of the first page) by adding a preloading thread (the thread that returns the data of the next hop page of the first page), so as to avoid the problem that the interface of the first page is also unavailable due to the unavailability of the interface of the next hop page of the first page. Moreover, the first page server can directly return the page data of the first page to the client and load it, without the need for the first page server to further obtain the page data of the next hop page of the first page after obtaining the page data of the first page, and then return the page data of the first page and the page data of the next hop page of the first page to the client for loading at the same time, so the response time of the first page can be shortened.
[0102] like Figure 2 As shown, Figure 2 The flowchart of the steps of the preloading engine obtaining the page data of the next hop page of the first page shown in an embodiment of the present application, in a feasible implementation manner, the specific method of the preloading engine obtaining the page data of the next hop page of the first page according to the identifier of the first page may include the following steps:
[0103] Step S201: the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page;
[0104] Step S202: the preloading engine obtains the page data of the next hop page of the first page from the page server corresponding to the interface information of the next hop page of the first page.
[0105] In this embodiment, the interface information includes interface request parameters and an interface request address. A configuration module and a mapping module are provided in the preloading engine, wherein the mapping module stores a mapping relationship between all next-hop pages in the first page and their corresponding interface request addresses, and the mapping relationship can be configured through the configuration module. After receiving the preloading request, the preloading engine can respond to the preloading request, obtain the mapping relationship between all next-hop pages in the first page and their corresponding interface request addresses according to the first page identifier carried in the preloading request, and obtain the interface information of at least one next-hop page of the first page according to the mapping relationship, wherein the preloading request includes the interface request parameters of at least one next-hop page of the first page, and the interface information of at least one next-hop page of the first page can be obtained according to the obtained interface request parameters and interface request address of at least one next-hop page of the first page. Then, based on the interface information of at least one next hop page of the first page, the page data of the next hop page of the first page is obtained from the page server corresponding to the interface information. Specifically, after obtaining the interface information of at least one next hop page of the first page, the preloading engine can request the server of the corresponding next hop page according to the interface information of each next hop page, so as to obtain the page data of the corresponding next hop page. The preloading engine packages the page data of all the next hop pages obtained and compresses them to reduce network overhead and speed up data transmission rate.
[0106] In a feasible implementation, a switch may be set for each preloading task, so as to determine whether a preloading request needs to be responded to according to the state of the switch of each preloading task. The specific method is as follows:
[0107] The preloading engine obtains switch configuration information, wherein the switch configuration information includes an association relationship between each preloading switch and a corresponding page, and the preloading switch is used to control the start or stop of a preloading task of a next hop page of the corresponding page;
[0108] When the preloading switch corresponding to the first page is turned on, the preloading engine obtains the interface information of the next hop page of the first page according to the first page identifier.
[0109] In this embodiment, the preloading engine can access multiple preloading tasks, wherein the preloading of the next hop page of a first page is a preloading task, for example, the preloading of the next hop page of the homepage of a video playback software is a preloading task, and the preloading of the next hop page of the advertisement page of the video playback software is another preloading task. Each preloading task can be set with a switch to manage the multiple preloading tasks that are connected. When the preloading engine receives a preloading request, it needs to obtain the switch configuration information of the preloading task corresponding to the first page according to the identifier of the first page, and determine whether the switch of the preloading service is turned on, and only respond to the preloading request when it is turned on.
[0110] In a feasible implementation, the preloading traffic may be monitored so as to control the number of preloading tasks according to the size of the preloading traffic, thereby avoiding excessive preloading traffic resulting in a long preloading data transmission time or preloading data transmission failure, so as to improve the preloading success rate. The specific method is as follows:
[0111] After receiving the preloading request carrying the first page identifier sent by the first page server, the preloading engine may further perform the following steps:
[0112] The preloading engine obtains the preloading flow, where the preloading flow is the amount of preloading page data pushed per unit time;
[0113] The preloading engine compares the preloading flow with a first threshold;
[0114] When the preloading traffic is less than the first threshold, the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page.
[0115] In this embodiment, the first threshold is a traffic threshold corresponding to ensuring that the preloaded data can be transmitted smoothly and quickly to the client. When the preloaded traffic is less than the first threshold, the data transmission pressure of the preloaded engine is relatively small, and there is no need to restrict the preloaded service. The interface information of at least one next-hop page of the first page is directly obtained to push the page data of at least one next-hop page of the first page to the client.
[0116] In a feasible implementation, the execution of the preloading task with a higher priority can also be ensured by setting the priority, and the specific method is as follows:
[0117] When the preloading flow is not less than the first threshold, the preloading engine determines the preloading priority corresponding to the first page according to the identifier of the first page;
[0118] When the preloading priority corresponding to the first page is higher than the preset priority, the preloading engine obtains interface information of at least one next-hop page of the first page according to the first page identifier.
[0119] In this embodiment, the priority of each preloading task can be preset, that is, the priority of the preloading task corresponding to each first page can be set. For example, the priority of the preloading task corresponding to the advertisement page can be higher than the priority of the home page.
[0120] The preloading engine can monitor and obtain the preloading traffic, and obtain the preloading priority corresponding to the first page according to the current first page identifier. When the preloading traffic is not less than the first threshold and when the preloading priority corresponding to the first page is lower than the preset priority, at this time, the data transmission pressure of the preloading engine is relatively large, and the preloading traffic needs to be reduced. At this time, since the preloading priority corresponding to the first page is lower than the preset priority, it is necessary to ensure the push of the page data of the preloading task with a higher priority. At this time, the preloading task corresponding to the first page can be closed, that is, the preloading request carrying the first page identifier is not responded to. When the preloading traffic is not less than the first threshold and when the preloading priority corresponding to the first page is not lower than the preset priority, the preloading request can be responded to normally, so that when the data transmission pressure of the preloading engine is relatively large, the preloading task with a higher priority can be given priority.
[0121] In another feasible implementation, the preloading traffic may be monitored so as to control the number of preloading tasks according to another method, thereby avoiding excessive preloading traffic resulting in a long preloading data transmission time or preloading data transmission failure, so as to improve the preloading success rate. The specific method is as follows:
[0122] When the preload flow is not less than a first threshold, the preload engine randomly obtains a preset parameter from a preset interval, where the preset interval is divided into a loading interval and a non-loading interval;
[0123] When the preset parameter belongs to the loading interval, the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page.
[0124] In this embodiment, the preloading engine can monitor and obtain the amount of preloading page data pushed per unit time. When the preloading flow is not less than the first threshold, the data processing and data transmission pressure of the preloading engine is relatively large, and the number of preloading tasks needs to be controlled. Specifically, a preset interval is pre-set. For example, the value of the preset interval can be a positive integer between 1 and 9. A preset parameter is randomly obtained from the preset interval. The preset interval is divided into a loading interval and a non-loading interval. For example, the loading interval can be 3 to 9, and the non-loading interval can be 0 to 2. For example, when the preloading flow is less than the first threshold, and when the preset parameter belongs to the loading interval, according to the first page identifier, there is no need to restrict the preloading task, and the interface information of at least one next hop page of the first page can be obtained. When the preset parameter belongs to the non-loading interval, the preloading request is rejected. For example, if the preset parameter is 2, the preloading request is rejected. In this way, as in the above example, the number of responded preloading tasks can be controlled to be about 70% of the number of requested preloading tasks, thereby reducing the number of preloading tasks.
[0125] In a feasible implementation, the preloading engine may also monitor the page data flow of the first page server, and control the corresponding preloading task according to the page data flow of the first page server to ensure smooth loading of the first page. The specific method is as follows:
[0126] The preloading engine obtains the page data flow of the first page server, where the page data flow is the amount of page data returned by the first page server to the client within a unit time;
[0127] When the page data flow of the first page server is greater than a second threshold, the preloading engine refuses to respond to the preloading request;
[0128] When the page data flow of the first page server is not greater than the second threshold, the preloading engine receives the preloading request and parses the identifier of the first page from the preloading request.
[0129] In this embodiment, the preloading engine can obtain the page data traffic of the first page server. The second threshold is the page data traffic threshold that ensures that the first page can be loaded normally. When the page data traffic of the first page server is greater than the second threshold, the first page loading response time is longer, that is, it exceeds the preset response time. The preset response time can be set according to actual conditions and is not specifically limited here. At this time, the preloading request may not be responded to, so that the page data of the next hop page of the first page will no longer be pushed to the client, thereby avoiding the influence of the preloading data on the loading response time of the first page.
[0130] In a feasible implementation manner, before the preloading engine pushes the page data of the next hop page of the first page to the client, the client may pre-determine whether there is page data of the next hop page of the first page in the cache database, so as to speed up the preloading speed, and the specific method is:
[0131] The client searches for cache page data of the next hop page of the first page from a cache database in response to a user's loading request operation for the next hop page of the first page;
[0132] When the cached page data of the next hop page of the first page exists in the cache database, the client loads the next hop page of the first page according to the cached page data of the next hop page of the first page;
[0133] After the preloading engine pushes the page data of the next hop page of the first page to the client, the method further includes:
[0134] The client updates the cache page data of the next hop page of the first page in the cache database according to the page data of the next hop page of the first page.
[0135] In this embodiment, after receiving the page data of the next hop page of the first page, the client can save it in the cache database and establish an association relationship between the requested page in the preloading request and the preloading data. For example, the client can save the page data of at least one next hop page of the first page to the cache database, and establish an association relationship between the page data of at least one next hop page of the first page and the first page. When the client detects the user's loading request operation for the next hop page of the first page, the cache page data of the next hop page corresponding to the first page can be searched from the cache database according to the first page identifier. When the cache page data of the next hop page corresponding to the first page exists in the cache database, the cache page data of the next hop page corresponding to the first page can be directly obtained and loaded, thereby speeding up the response speed. In order to make the loaded page more accurate, the preloading engine can continue to obtain the page data of the next hop page of the first page and push it to the client. The client can update the cache page data of the next hop page of the first page in the cache database according to the page data of the next hop page of the first page.
[0136] In a feasible implementation, considering that the page data of at least one next-hop page of the first page may be updated, when the cache page data of the next-hop page corresponding to the first page exists in the cache database, the storage duration of the cache page data of the next-hop page corresponding to the first page in the cache database can also be obtained, wherein the storage duration is the length of time from the moment of storage in the cache database to the current moment. When the storage duration is less than the preset duration, the client directly loads. The preset duration can be set according to actual conditions and is not specifically limited here. When the storage duration is greater than the preset duration, it is considered that the cache page data of the next-hop page corresponding to the first page in the cache database is expired and unavailable, and needs to be re-acquired, and the cache page data of the next-hop page corresponding to the first page in the current cache database is deleted.
[0137] When the cached page data of the next hop page corresponding to the first page does not exist in the cached database, or when the cached page data of the next hop page corresponding to the first page exists in the cached database and the storage time is longer than the preset time, step S103 is executed again.
[0138] In a feasible implementation, as the preloading business undertaken by the preloading engine increases, the traffic pressure borne by the preloading engine also increases, increasing the operating cost and potential availability risk of the preloading engine. At this time, the traffic pressure of the preloading engine can be reduced by the following methods:
[0139] The preloading engine maintains the preloading program, that is, it maintains and updates the preloading program, and establishes a message queue through the preloading engine to distribute the functions undertaken by the preloading engine to each page server.
[0140] Specifically, the preloading engine can send a first preloading program to the first page server so that the first page server runs the first preloading program, so that the first page server generates a preloading request carrying the first page identifier before returning the page data of the first page corresponding to the first page identifier to the client, wherein the first preloading program contains an association relationship between the first page and the interface information of the next hop page of the first page, so that the first page server obtains the interface information of at least one next hop page of the first page according to the first page identifier, and then the first page server sends the preloading request and the interface information of at least one next hop page of the first page and adds them to the message queue in the preloading engine.
[0141] The preloading engine can send a second preloading program to the page server corresponding to the interface information of at least one next-hop page of the first page, so that the corresponding page server runs the second preloading program, so that the page server corresponding to the interface information of at least one next-hop page of the first page can monitor the message queue in the preloading engine in real time, and when it monitors the preloading request and its own corresponding interface information from the message queue, it pushes the page data of the next-hop page provided by itself to the client, wherein the preloading request can also carry a client identifier, so that the page server corresponding to the interface information of at least one next-hop page of the first page can smoothly push the page data to the corresponding client.
[0142] Since the preloading program in the preloading engine can be continuously updated, the first preloading program can be sent to the first page server through the preloading engine at preset time intervals so that the first page server updates the first preloading program, and the second preloading program can be sent to the page server corresponding to the interface information of at least one next-hop page of the first page so that the corresponding page server updates the second preloading program.
[0143] Through the above method, the preloading engine only needs to maintain and update the preloading program and message queue, and distribute the functions undertaken by the preloading engine to each page server for execution, thereby reducing the traffic pressure and data processing pressure of the preloading engine.
[0144] Based on the same inventive concept, an embodiment of the present invention provides a page preloading system. Figure 3 , Figure 3 1 is a structural block diagram of a page loading system shown in an embodiment of the present application. Figure 3 As shown, the system at least includes:
[0145] A first page server 302 and a preloading engine 303; the first page server is used to respond to a first page loading request sent by a client, return page data of the first page to the client, and send a preloading request carrying an identifier of the first page to the preloading engine, wherein the preloading request is used to request page data of a next-hop page of the first page;
[0146] The preloading engine is configured to receive the preloading request and parse the identifier of the first page from the preloading request;
[0147] The preloading engine is further used to obtain page data of a next-hop page of the first page according to the identifier of the first page;
[0148] The preloading engine is further used to push page data of the next hop page of the first page to the client.
[0149] Optionally, the preloading engine is further used to obtain interface information of a next hop page of the first page according to the identifier of the first page;
[0150] The preloading engine is further used to obtain the page data of the next hop page of the first page from the page server corresponding to the interface information of the next hop page of the first page.
[0151] Optionally, the preloading engine is further used to obtain preloading traffic, where the preloading traffic is the amount of preloading page data pushed per unit time;
[0152] The preloading engine is further used to compare the preloading flow with a first threshold;
[0153] The preloading engine is further configured to obtain, when the preloading traffic is less than the first threshold, interface information of a next hop page of the first page according to an identifier of the first page.
[0154] Optionally, the preloading engine is further configured to determine a preloading priority corresponding to the first page according to an identifier of the first page when the preloading flow is not less than the first threshold;
[0155] The preloading engine is further configured to obtain interface information of at least one next-hop page of the first page according to the first page identifier when the preloading priority corresponding to the first page is higher than a preset priority.
[0156] Optionally, the preloading engine is further configured to randomly obtain a preset parameter from a preset interval when the preloading flow is not less than a first threshold, wherein the preset interval is divided into a loading interval and a non-loading interval;
[0157] The preloading engine is further configured to obtain interface information of a next hop page of the first page according to an identifier of the first page when the preset parameter belongs to the loading interval.
[0158] Optionally, the preloading engine is further used to obtain the page data flow of the first page server, where the page data flow is the amount of page data returned by the first page server to the client in a unit time;
[0159] The preloading engine is further configured to refuse to respond to the preloading request when the page data flow of the first page server is greater than a second threshold;
[0160] The preloading engine is further used to receive the preloading request and parse the identifier of the first page from the preloading request when the page data flow of the first page server is not greater than the second threshold.
[0161] Optionally, the system further includes a client 301,
[0162] The client is used to search the cache page data of the next hop page of the first page from the cache database in response to the user's loading request operation for the next hop page of the first page;
[0163] The client is further configured to load the next hop page of the first page according to the cached page data of the next hop page of the first page when the cached page data of the next hop page of the first page exists in the cache database;
[0164] The client is further configured to update the cache page data of the next hop page of the first page in the cache database according to the page data of the next hop page of the first page.
[0165] Optionally, the client is further used to obtain the storage duration of the cache page data of the next hop page of the first page in the cache database, where the storage duration is the time length from the moment when the cache page data is stored in the cache database to the current moment;
[0166] The client is further configured to load a next hop page corresponding to the first page according to cached page data of the next hop page corresponding to the first page when the storage duration is less than a preset duration.
[0167] Optionally, the preloading engine is further used to obtain switch configuration information, wherein the switch configuration information includes an association relationship between each preloading switch and a corresponding page, and the preloading switch is used to control the start or end of the preloading task of the next hop page of the corresponding page;
[0168] The preloading engine is further configured to obtain interface information of a next hop page of the first page according to the first page identifier when the preloading switch corresponding to the first page is turned on.
[0169] Optionally, the system further includes: a page server 304 corresponding to the interface information of the next hop page of the first page;
[0170] The preloading engine is further used to establish an initially empty message queue and send a first preloading program to the first page server so that the first page server runs the first preloading program;
[0171] The preloading engine is further used to send a second preloading program to a page server corresponding to the interface information of the next hop page of the first page, so that the corresponding page server runs the second preloading program;
[0172] The first page server is further configured to execute the following steps according to the first preloading program: generating the preloading request before returning the page data of the first page to the client; acquiring the interface information of the next hop page of the first page according to the identifier of the first page; and adding the preloading request and the interface information of the next hop page of the first page to the message queue;
[0173] The page server corresponding to the interface information of the next hop page of the first page is used to perform the following steps according to the second preloading program:
[0174] Monitor whether the message queue contains the preload request and whether the interface information of the next hop page of the first page is the interface information corresponding to the first page;
[0175] When the preloading request is monitored from the message queue and the interface information of the next hop page of the first page is the interface information corresponding to itself, the page data of the next hop page of the first page provided by itself is pushed to the client.
[0176] The embodiment of the present invention also provides a terminal device, such as Figure 4 shown. Figure 4 is a schematic diagram of the structure of a terminal device shown in an embodiment of the present application. Figure 4 The terminal device includes a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42, and the memory 43 communicate with each other via the communication bus 44;
[0177] A memory 43, for storing computer programs;
[0178] The processor 41 is used to implement the page loading method as described in any of the above embodiments when executing the program stored in the memory 43.
[0179] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0180] The communication interface is used for communication between the above terminal and other devices.
[0181] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0182] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0183] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the page loading method described in any one of the above embodiments.
[0184] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the page loading method described in any one of the above embodiments.
[0185] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0186] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also 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 a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0187] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0188] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A page loading method, characterized in that: The method comprises: The first page server returns the page data of the first page to the client in response to the first page loading request sent by the client, and sends a preloading request carrying the identifier of the first page to the preloading engine, wherein the preloading request is used to request the page data of the next hop page of the first page; The preloading engine receives the preloading request and parses the identifier of the first page from the preloading request; The preloading engine obtains page data of the next hop page of the first page according to the identifier of the first page; The preloading engine pushes page data of the next hop page of the first page to the client; The method further comprises: The first page server performs the following steps according to the first preloading program: Before returning the page data of the first page to the client, generating the preloading request; According to the identifier of the first page, acquiring the interface information of the next hop page of the first page; Adding the preloading request and the interface information of the next hop page of the first page to the message queue in the preloading engine; The page server corresponding to the interface information of the next hop page of the first page performs the following steps according to the second preloading program: Monitor whether the message queue contains the preload request and whether the interface information of the next hop page of the first page is the interface information corresponding to the first page; When the preloading request is monitored from the message queue and the interface information of the next hop page of the first page is the interface information corresponding to itself, the page data of the next hop page of the first page provided by itself is pushed to the client; The first preloading program and the second preloading program are page servers corresponding to the interface information of the first page server and the next hop page of the first page, which are respectively sent in advance by the preloading engine.
2. The method according to claim 1, characterized in that The preloading engine obtains page data of a next-hop page of the first page according to the identifier of the first page, including: The preloading engine acquires the interface information of the next hop page of the first page according to the identifier of the first page; The preloading engine obtains the page data of the next hop page of the first page from the page server corresponding to the interface information of the next hop page of the first page.
3. The method according to claim 2, characterized in that The preloading engine obtains interface information of a next hop page of the first page according to the identifier of the first page, including: The preloading engine obtains the preloading traffic, where the preloading traffic is the amount of preloading page data pushed per unit time; The preloading engine compares the preloading flow with a first threshold; When the preloading traffic is less than the first threshold, the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page.
4. The method according to claim 3, characterized in that The method further comprises: When the preloading flow is not less than the first threshold, the preloading engine determines the preloading priority corresponding to the first page according to the identifier of the first page; When the preloading priority corresponding to the first page is higher than the preset priority, the preloading engine obtains interface information of at least one next-hop page of the first page according to the first page identifier.
5. The method according to claim 3, characterized in that: The method further comprises: When the preload flow is not less than a first threshold, the preload engine randomly obtains a preset parameter from a preset interval, where the preset interval is divided into a loading interval and a non-loading interval; When the preset parameter belongs to the loading interval, the preloading engine obtains the interface information of the next hop page of the first page according to the identifier of the first page.
6. The method according to claim 1, characterized in that After the preloading engine receives the preloading request, the method further includes: The preloading engine obtains the page data flow of the first page server, where the page data flow is the amount of page data returned by the first page server to the client within a unit time; When the page data flow of the first page server is greater than a second threshold, the preloading engine refuses to respond to the preloading request; The preloading engine receives the preloading request and parses the identifier of the first page from the preloading request, including: When the page data flow of the first page server is not greater than the second threshold, the preloading engine receives the preloading request and parses the identifier of the first page from the preloading request.
7. The method according to claim 1, characterized in that Before the preloading engine pushes page data of the next hop page of the first page to the client, the method further includes: The client searches for cache page data of the next hop page of the first page from a cache database in response to a user's loading request operation for the next hop page of the first page; When the cached page data of the next hop page of the first page exists in the cache database, the client loads the next hop page of the first page according to the cached page data of the next hop page of the first page; After the preloading engine pushes the page data of the next hop page of the first page to the client, the method further includes: The client updates the cache page data of the next hop page of the first page in the cache database according to the page data of the next hop page of the first page.
8. The method according to claim 7, characterized in that The client loads the next hop page of the first page according to the cached page data of the next hop page of the first page, including: The client obtains the storage duration of the cache page data of the next hop page of the first page in the cache database, where the storage duration is the time length from the moment when the cache page data is stored in the cache database to the current moment; When the storage time length is less than the preset time length, the client loads the next hop page corresponding to the first page according to the cached page data of the next hop page corresponding to the first page.
9. The method according to claim 2, characterized in that: Before the first page server responds to the first page loading request sent by the client, the method further includes: The preloading engine obtains switch configuration information, wherein the switch configuration information includes an association relationship between each preloading switch and a corresponding page, and the preloading switch is used to control the start or stop of a preloading task of a next hop page of the corresponding page; The preloading engine acquires interface information of a next hop page of the first page according to the first page identifier, including: When the preloading switch corresponding to the first page is turned on, the preloading engine obtains the interface information of the next hop page of the first page according to the first page identifier.
10. The method according to claim 1, characterized in that The method further comprises: The preloading engine establishes an initially empty message queue and sends a first preloading program to the first page server so that the first page server runs the first preloading program; The preloading engine sends a second preloading program to a page server corresponding to the interface information of at least one next-hop page of the first page, so that the corresponding page server runs the second preloading program.
11. A page loading system, characterized in that: The system at least includes: a first page server and a preloading engine; the first page server is used to respond to a first page loading request sent by a client, return page data of the first page to the client, and send a preloading request carrying an identifier of the first page to the preloading engine, wherein the preloading request is used to request page data of a next-hop page of the first page; The preloading engine is configured to receive the preloading request and parse the identifier of the first page from the preloading request; The preloading engine is also used to obtain page data of the next hop page of the first page according to the identifier of the first page; The preloading engine is further used to push page data of the next hop page of the first page to the client; The first page server is further configured to perform the following steps according to the first preloading program: before returning the page data of the first page to the client, generate the preloading request; according to the identifier of the first page, obtain the interface information of the next hop page of the first page; add the preloading request and the interface information of the next hop page of the first page to the message queue in the preloading engine; The page server corresponding to the interface information of the next hop page of the first page is further used to perform the following steps according to the second preloading program: monitor whether the message queue contains the preloading request and whether the interface information of the next hop page of the first page is the interface information corresponding to itself; when the preloading request is monitored from the message queue and the interface information of the next hop page of the first page is the interface information corresponding to itself, push the page data of the next hop page of the first page provided by itself to the client; The first preloading program and the second preloading program are page servers corresponding to the interface information of the first page server and the next hop page of the first page, which are respectively sent in advance by the preloading engine.
12. A terminal device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps in the page loading method as described in any one of claims 1 to 10 when executing the program stored in the memory.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the page loading method as described in any one of claims 1 to 10 are implemented.
