CN112672187B - Page generation method and device, computer equipment and readable storage medium - Google Patents
Page generation method and device, computer equipment and readable storage medium Download PDFInfo
- Publication number
- CN112672187B CN112672187B CN202011502493.0A CN202011502493A CN112672187B CN 112672187 B CN112672187 B CN 112672187B CN 202011502493 A CN202011502493 A CN 202011502493A CN 112672187 B CN112672187 B CN 112672187B
- Authority
- CN
- China
- Prior art keywords
- page
- data
- server
- client
- request
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the invention relates to the technical field of UI design, and provides a page generation method, which comprises the following steps: the method comprises the steps that a first server receives a page loading request sent by a client and sends the page data loading request to a second server through a preset data interface; the first server judges whether page data returned by the data interface is received within a preset time period or not; if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client so that the client displays the partial page; and the client sends a page data loading request to the second server through the data interface responding to the timeout so as to request the page data which is not returned in response to the timeout to render the partial page to form a complete page. The embodiment of the invention can accelerate the page rendering speed.
Description
Technical Field
The embodiment of the invention relates to the technical field of UI (user interface) design, in particular to a page generation method and device and computer equipment.
Background
Currently, a user often browses a web page through a client, and when the user browses the web page, the client needs to acquire page data of the web page from a server and then render the web page according to the acquired page data. Due to the fact that the data interface is abnormal/overtime, the loading time of the page is longer, long-time white screen experience is achieved, and user experience is affected badly. At present, the problem of slow page loading is solved through Server Side Render (SSR) in the industry, but the problem of slow page loading caused by the performance problem of the back-end interface cannot be solved. Due to the fact that the interface is overtime or the interface return time is long, the rendering of the page is slowed, the progress bar for loading the page is slow, and the waiting time of the user is too long.
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a page generation method, a page generation apparatus, a computer device, and a computer readable storage medium, which are used to overcome the problem of slow rendering speed of existing web pages.
In order to achieve the above object, an embodiment of the present invention provides a page generation method, including:
the method comprises the steps that a first server receives a page loading request sent by a client and sends the page data loading request to a second server through a preset data interface;
the first server judges whether page data returned by the data interface is received within a preset time period or not;
if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, so that the client displays the partial page;
and the client sends a page data loading request to the second server through a data interface responding to the timeout so as to request the page data which is not returned in response to the timeout to render the partial page to form a complete page.
Optionally, the page generation method further includes:
and the client sends the page loading request to the first server through a preset protocol, wherein the preset protocol is any one of an HTTP (hyper text transport protocol), a TCP/IP (transmission control protocol/internet protocol), a UDP (user datagram protocol) and an HTTPS (hypertext transfer protocol secure protocol).
Optionally, before the step of determining whether the page data returned by the data interface is received within a preset time period, the first server further includes:
and the second server receives the page data loading request, and feeds back the page data to the first server through the data interface in response to the page data loading request.
Optionally, before the step of sending, by the client, a page data loading request to the second server through a data interface responding to timeout to request that the partial page be rendered in response to page data not returned after the timeout to form a complete page, the method further includes:
the first server transmits a request record and a request result of a page data loading request to the client;
the client stores the received request record and request result to a local cache;
and the client searches the request record information stored in the local cache to determine that the request result is a data interface and page data loading request with overtime response.
Optionally, the step of requesting that the partial page be rendered to form a complete page in response to page data not returned after timeout includes:
and when the client receives the page data which is returned by the second server and responds to the overtime, performing page rendering based on the currently received page data and the page data stored in the local cache to output a complete page.
Optionally, the first server is a front-end server, and the second server is a back-end server.
Optionally, the page generation method further includes:
and if the page data returned by each data interface is received in the preset time period, the first server generates a complete page according to the received page data returned by each data interface and returns the complete page to the client.
In order to achieve the above object, an embodiment of the present invention further provides a page generating apparatus, where the page generating apparatus includes:
the system comprises a sending module, a data processing module and a data processing module, wherein the sending module is used for controlling a first server to send a page data loading request to a second server through a preset data interface when the first server receives the page loading request sent by a client;
the judging module is used for controlling the first server to judge whether page data returned by the data interface is received within a preset time period;
the first control module is used for controlling the first server to generate a partial page according to the received page data returned by the partial data interface and return the partial page to the client when at least one data interface response time-out does not return the page data, so that the client displays the partial page;
and the second control module is used for controlling the client to send a page data loading request to the second server through a data interface responding to timeout so as to request that the partial pages are rendered by responding to page data which is not returned after timeout so as to form a complete page.
To achieve the above object, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, where the computer program is executable by at least one processor to cause the at least one processor to execute the steps of the page generation method described above.
According to the page generation method, the page generation device, the computer equipment and the computer readable storage medium provided by the embodiment of the invention, the page loading request sent by the client is received through the first server, and the page data loading request 1 is sent to the second server through the preset data interface; the first server judges whether page data returned by the data interface is received within a preset time period or not; if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, so that the client displays the partial page; the client sends a page data loading request to the second server through the data interface responding to timeout to request the page data not returned in response to timeout to render the partial page to form a complete page, so that when at least one data interface does not return page data in the preset time period, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, the client displays the partial page, and then the client sends a page data loading request to the second server through the data interface responding to timeout to request the page data not returned in response to timeout to render the partial page to form a complete page, so that the web page rendering speed is increased, and the rendering speed of the page can be slowed down without being returned by the abnormal interface.
Drawings
Fig. 1 is a schematic step flow diagram of an embodiment of a page generation method according to the present invention.
Fig. 2 is a schematic diagram of program modules of a page generation apparatus according to an embodiment of the present invention.
Fig. 3 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The advantages of the invention are further illustrated in the following description of specific embodiments in conjunction with the accompanying drawings.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present disclosure. The word "if" as used herein may be interpreted as "at" \8230; "or" when 8230; \8230; "or" in response to a determination ", depending on the context.
In the description of the present invention, it should be understood that the numerical references before the steps do not identify the order of performing the steps, but merely serve to facilitate the description of the present invention and to distinguish each step, and thus should not be construed as limiting the present invention.
Referring to fig. 1, a flowchart of a page generation method according to a first embodiment of the invention is shown. It is to be understood that the flow charts in the embodiments of the present method are not intended to limit the order in which the steps are performed. The following description will exemplarily refer to a page generation apparatus (hereinafter, referred to as "generation apparatus") as an execution subject, and the generation apparatus may be applied to a computer device, which may be a mobile phone, a tablet personal computer (tablet personal computer), a laptop computer (laptop computer), a server, or other devices having a data transmission function. The method comprises the following specific steps:
and step S10, the first server receives a page loading request sent by the client and sends a page data loading request to the second server through a preset data interface.
In one embodiment, the client may be a client device such as a mobile phone or a computer. A data interface can correspond to a page data loading request so as to respectively request data of different page parts in a page. The first server may be a front-end server and the second server may be a back-end server. The first server may be deployed in a Nodejs service in docker, and the second server may be deployed in a java service of an entity server. The page load requests may include a home page load request and a non-home page load request. The page loading request may carry a page address, a page name, and the like. The page loading request may be generated based on a user performing a browsing operation within a browser. For example, a user may click a link of a web page in a browser, or input a URL (Uniform Resource Locator) address of the web page, and may generate a corresponding page loading request.
In an embodiment, the client may send the page loading request to the first server through a preset protocol. When the first server receives a page loading request sent by a client, the first server can send a plurality of page data loading requests to the second server through a plurality of preset data interfaces, wherein the preset protocol is any one of an HTTP (hyper text transport protocol), a TCP/IP (transmission control protocol/internet protocol), a UDP (user datagram protocol) and an HTTPS (hypertext transfer protocol secure) protocol. For example, when a user enters the web page of the client through a browser, the client may send the page loading request to the first server through the HTTP protocol, and after the first server receives the page loading request, the first server may send a plurality of page data loading requests to the second server through a plurality of preset data interfaces. For example, the page depends on data of three preset data interfaces, and when a page loading request sent by the client is received, the first server may send three page data loading requests to the second server through the three preset data interfaces.
Step S11, the first server determines whether page data returned by the data interface is received within a preset time period.
In an embodiment, the preset time period may refer to a longest waiting time requested by the first server, and the preset time period may be set according to an actual requirement, and may also be dynamically adjusted according to factors such as page content, target people, browsing time, and user preference. For example, if the target population is young, the preset time period may be set to be shorter in consideration of the lack of patience of young people. The preset time period may be 2s, 5s, etc.
Specifically, when the second server receives the page data loading request, the second server may respond to the page data loading request and feed back the page data to the first server through the data interface. The first server may determine whether page data returned by the data interface is received within a preset time period, so as to determine whether a response timeout condition occurs in the data interface. Because a complete webpage needs to be rendered by relying on data of a plurality of preset data interfaces, after the first server sends a plurality of page data loading requests to the second server through the plurality of preset data interfaces, the first server can judge whether page data returned by each data interface is received within the preset time period, so as to determine whether partial page rendering or complete page rendering is performed.
Step S12, if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, so that the client displays the partial page.
In an embodiment, if at least one data interface response timeout unreturned page data exists, which indicates that the first server does not receive all page data, the first server may be controlled to generate a partial page according to the received page data returned by the partial data interface and return the partial page to the client, so that the client displays the partial page, the page generation speed is increased, it is ensured that a user can see the partial page in advance, the user waiting time is reduced, and the user browsing experience is improved.
For example, the page depends on data of three preset data interfaces, if it is determined that the first server only receives the first page data returned by two preset data interfaces within the preset time period, there is one data interface that does not return the first page data in response to timeout, that is, the first server does not receive the page data returned by each data interface within the preset time period, and the first server generates a partial page according to the received page data returned by the two preset data interfaces and returns the partial page to the client, so that the client displays the partial page.
In an embodiment, if the page data returned by each data interface is received within the preset time period, the first server may generate a complete page according to the received page data returned by each data interface, and return the complete page to the client.
Specifically, if the page data returned by each data interface is received in the preset time period, it indicates that the first server has received all the page data, and the first server may generate a complete page according to the received page data returned by each data interface and return the complete page to the client, so that the client displays the complete page, and the user experience of browsing is ensured.
Step S13, the client sends a page data loading request to the second server through the data interface responding to the overtime so as to request the page data not returned in response to the overtime to render the partial page to form a complete page.
In an embodiment, after the first server sends the page data loading request to the second server through the plurality of preset data interfaces, that is, after the second server obtains all the page data loading requests, the first server may transmit the request record and the request result of the page data loading request to the client, and the client may store the received request record and the received request result in a local cache, so that the client may subsequently search the request record information stored in the local cache to determine that the request result is a data interface and page data loading request with response timeout. After the first server returns a part of pages to the client, the client sends a page data loading request to the second server through a data interface responding to timeout so as to request the page data which is not returned in response to timeout to render the part of pages to form a complete page, and therefore the final display effect of the whole page is not influenced.
In one embodiment, the request record information may include the request record and the request result. The client saves the request record and the request result to a local cache, so that the access cost can be reduced, the accuracy of data can be ensured, and meanwhile, when at least one data interface does not return page data within the preset time, the client can directly search the request record information saved in the local cache to determine the request result as a data interface responding to timeout and a page data loading request, thereby realizing timeout compensation and accelerating the page generation speed.
In an embodiment, if at least one of the data interfaces does not return page data in response to timeout, the first server may generate a partial page according to the received page data returned by the partial data interface, and when the first server processes the page data returned by the data interface, there is at least one error that requests for timeout.
In an embodiment, when the client receives page data returned by the second server and not returned when the response time out, the client may perform page rendering based on the currently received page data and the page data saved by the local cache to output a complete page. For example, when the client receives page data returned by the second server and not returned after the response timeout, the page data currently returned by the second server and the page data stored in the local cache may be subjected to page rendering by using JS (JavaScript) of the client, so as to output a complete page.
For example, the page depends on data of three preset data interfaces, and if the first server only receives the first page data returned by two preset data interfaces within the preset time period, the first server generates a partial page according to the received page data returned by the two data interfaces. After receiving a partial page returned by the first server, the client may search request record information stored in the local cache to determine that a request result is a data interface and a page data loading request which respond overtime, and then the client sends the page data loading request to the second server through the data interface which responds overtime, so that the client directly replaces the first server to request the page data which does not return after responding overtime to render the partial page to form a complete page.
The method comprises the steps that a first server receives a page loading request sent by a client, and sends the page data loading request to a second server through a preset data interface; the first server judges whether page data returned by the data interface is received within a preset time period or not; if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, so that the client displays the partial page; the client sends a page data loading request to the second server through the data interface responding to timeout to request the page data not returned in response to timeout to render the partial page to form a complete page, so that when at least one data interface does not return page data in the preset time period, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, the client displays the partial page, then the client sends a page data loading request to the second server through the data interface responding to timeout to request the page data not returned in response to timeout to render the partial page to form the complete page, the web page rendering speed is increased, and the rendering speed of the page can be slowed down without being returned by the abnormal interface.
Referring to fig. 2, a schematic diagram of program modules of a page generation apparatus 300 (hereinafter referred to as "generation apparatus" 300) according to an embodiment of the invention is shown. The generating apparatus 300 may be applied to a computer device, which may be a mobile phone, a tablet personal computer (tablet personal computer), a laptop computer (laptop computer), a server, or other devices having a data transmission function. In this embodiment, the generating apparatus 300 may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to implement the present invention and implement the above-mentioned page generating method. The program module referred to in the embodiments of the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable for describing the execution process of the page generation method in the storage medium than the program itself. In this embodiment, the page generating apparatus 300 includes a sending module 301, a determining module 302, a first control module 303, and a second control module 304. The following description will specifically describe the functions of the program modules of the present embodiment:
the sending module 301 is configured to control a first server to send a page data loading request to a second server through a preset data interface when the first server receives the page loading request sent by a client.
In one embodiment, the client may be a client device such as a mobile phone or a computer. A data interface can correspond to a page data loading request so as to respectively request data of different page parts in a page. The first server may be a front-end server and the second server may be a back-end server. The first server may be deployed in a Nodejs service in docker, and the second server may be deployed in a java service of an entity server. The page load request may include a home page load request and a non-home page load request. The page loading request may carry a page address, a page name, and the like. The page loading request may be generated based on a user performing a browsing operation within a browser. For example, a user may click a link of a web page in a browser, or input a URL (Uniform Resource Locator) address of the web page, and may generate a corresponding page loading request.
In an embodiment, the client may send the page loading request to the first server through a preset protocol. When receiving a page loading request sent by a client, the sending module 301 may control the first server to send multiple page data loading requests to the second server through multiple preset data interfaces, where the preset protocol is any one of an HTTP protocol, a TCP/IP protocol, a UDP protocol, and an HTTPs protocol. For example, when a user enters the web page of the client through a browser, the client may send the page loading request to the first server through the HTTP protocol, and after the first server receives the page loading request, the sending module 301 may control the first server to send a plurality of page data loading requests to the second server through a plurality of preset data interfaces. For example, the page depends on data of three preset data interfaces, and when receiving a page loading request sent by the client, the sending module 301 may control the first server to send three page data loading requests to the second server through the three preset data interfaces.
The determining module 302 is configured to control the first server to determine whether to receive the page data returned by the data interface within a preset time period.
In an embodiment, the preset time period may refer to a longest waiting time requested by the first server, and the preset time period may be set according to an actual requirement, and may be dynamically adjusted according to factors such as page content, target people, browsing time, and user preference. For example, if the target population is young, the preset time period may be set to be shorter in consideration of the lack of patience of young people. The preset time period may be 2s, 5s, etc.
Specifically, when the second server receives the page data loading request, the second server may respond to the page data loading request and feed back the page data to the first server through the data interface. The determining module 302 may control the first server to determine whether page data returned by the data interface is received within a preset time period, so as to determine whether a response timeout occurs in the data interface. Since a complete webpage needs to be rendered by relying on data of multiple preset data interfaces, after the sending module 301 controls the first server to send multiple page data loading requests to the second server through multiple preset data interfaces, the determining module 302 may further control the first server to determine whether to receive page data returned by each data interface within the preset time period, so as to determine whether to perform partial page rendering or complete page rendering.
A first control module 303, configured to control, when there is at least one data interface that does not return page data when the response time is out, the first server to generate a partial page according to the received page data returned by the partial data interface, and return the partial page to the client, so that the client displays the partial page.
In an embodiment, if at least one data interface response timeout does not return page data, which indicates that the first server does not receive all page data, the first control module 303 may control the first server to generate a partial page according to the received page data returned by the partial data interface, and return the partial page to the client, so that the client displays the partial page, thereby increasing a page generation speed, ensuring that a user can see the partial page in advance, reducing user waiting time, and improving user browsing experience.
For example, the page depends on data of three preset data interfaces, if the determining module 302 determines that the first server only receives the first page data returned by two preset data interfaces within the preset time period, there is one data interface that does not return the first page data in response to timeout, that is, the first server does not receive the page data returned by each data interface within the preset time period, and the first control module 303 may control the first server to generate a partial page according to the received page data returned by the two data interfaces, and return the partial page to the client, so that the client displays the partial page.
In an embodiment, if the page data returned by each data interface is received within the preset time period, the first control module 303 may control the first server to generate a complete page according to the received page data returned by each data interface, and return the complete page to the client.
Specifically, if the page data returned by each data interface is received within the preset time period, it indicates that the first server has received all the page data, and the first control module 303 may control the first server to generate a complete page according to the received page data returned by each data interface, and return the complete page to the client, so that the client displays the complete page, and the user experience of browsing is ensured.
A second control module 304, configured to control the client to send a page data loading request to the second server through the data interface responding to the timeout, so as to request that the partial page is rendered in response to the page data that is not returned in response to the timeout to form a complete page.
In an embodiment, after the sending module 301 controls the first server to send the page data loading request to the second server through the multiple preset data interfaces, that is, after the second server obtains all the page data loading requests, the first server may transmit the request record and the request result of the page data loading request to the client, and the client may store the received request record and the received request result in a local cache, so that the client may subsequently search the request record information stored in the local cache to determine that the request result is a data interface and a page data loading request with response timeout. After the first server returns a partial page to the client, the second control module 304 may control the client to send a page data loading request to the second server through the data interface responding to the timeout, so as to request that the partial page is rendered to form a complete page in response to the page data not returned after the timeout, so as not to affect the final display effect of the whole page.
In one embodiment, the request record information may include the request record and the request result. The request records and the request results are stored in a local cache of the client, so that the access cost can be reduced, the accuracy of data can be ensured, and meanwhile, when at least one data interface does not return page data in the preset time, the client can be controlled to directly search the request record information stored in the local cache, so that the request results are determined to be response overtime data interfaces and page data loading requests, overtime compensation is realized, and the page generation speed is increased.
In an embodiment, if at least one of the data interfaces does not return page data in response to timeout, the first control module 303 may control the first server to generate a partial page according to the received page data returned by the partial data interface, and meanwhile, when the first server processes the page data returned by the data interface, there is at least one error that requests timeout, and for the errors that requests timeout, the second control module 304 may control the client to send a page data request to the second server through the data interface that responds to timeout, so as to implement timeout compensation.
In an embodiment, when the client receives page data returned by the second server in response to timeout and not returned, the second control module 304 may control the client to perform page rendering based on the currently received page data and the page data stored in the local cache, so as to output a complete page. For example, when the client receives page data returned by the second server and not returned after the response timeout, the page data currently returned by the second server and the page data stored in the local cache may be subjected to page rendering by using JS (JavaScript) of the client, so as to output a complete page.
For example, the page depends on data of three preset data interfaces, and if the determining module 302 determines that the first server only receives the first page data returned by two preset data interfaces within the preset time period, the first control module 303 controls the first server to generate a partial page according to the received page data returned by two data interfaces. After receiving a partial page returned by the first server, the client may search the request record information stored in the local cache to determine that the request result is a data interface and a page data loading request that respond to the timeout, and then the second control module 304 controls the client to send the page data loading request to the second server through the data interface that responds to the timeout, so as to directly replace, by the client, the page data that is preset in response to the timeout to request the first server to render the partial page to form a complete page.
The method comprises the steps that a first server receives a page loading request sent by a client, and sends the page data loading request to a second server through a preset data interface; the first server judges whether page data returned by the data interface is received within a preset time period or not; if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, so that the client displays the partial page; the client sends a page data loading request to the second server through the data interface responding to timeout to request the page data not returned in response to timeout to render the partial page to form a complete page, so that when at least one data interface responding to timeout and not returned page data exists, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, the client displays the partial page, then the client sends a page data loading request to the second server through the data interface responding to timeout to request the page data not returned in response to timeout to render the partial page to form the complete page, the web page rendering speed is increased, and the rendering speed of the page can be slowed down without being returned by the abnormal interface.
Fig. 3 is a schematic diagram of a hardware architecture of a computer device 400 according to an embodiment of the present invention. In the present embodiment, the computer device 400 is a device capable of automatically performing numerical calculation and/or information processing according to an instruction set or stored in advance. As shown, the computer apparatus 400 includes, but is not limited to, at least a memory 401, a processor 402, and a network interface 403, which may be communicatively coupled to each other via a device bus. Wherein:
in this embodiment, the memory 401 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 401 may be an internal storage unit of the computer device 400, such as a hard disk or a memory of the computer device 400. In other embodiments, the memory 401 may also be an external storage device of the computer device 400, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 400. Of course, the memory 401 may also include both internal and external storage units for the computer device 400. In this embodiment, the memory 401 is generally used for storing an operating device installed in the computer device 400 and various application software, such as a program code of the page generating device 300. Further, the memory 401 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 402 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 402 is generally used to control the overall operation of the computer device 400. In this embodiment, the processor 402 is configured to run program codes stored in the memory 401 or process data, for example, run the page generating apparatus 300, so as to implement the page generating method in each of the above embodiments.
The network interface 403 may include a wireless network interface or a wired network interface, and the network interface 403 is generally used for establishing a communication connection between the computer apparatus 400 and other electronic devices. For example, the network interface 403 is used to connect the computer device 400 to an external terminal through a network, establish a data transmission channel and a communication connection between the computer device 400 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, bluetooth (Bluetooth), wi-Fi, and the like.
It is noted that fig. 3 only shows a computer device 400 having components 401-403, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the page generating apparatus 300 stored in the memory 401 may be further divided into one or more program modules, and the one or more program modules are stored in the memory 401 and executed by one or more processors (in this embodiment, the processor 402) to complete the page generating method of the present invention.
The present embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, which when executed by a processor implements corresponding functions. The computer readable storage medium of the embodiment is used for storing the page generating apparatus 300, so that when being executed by a processor, the page generating method of the invention is realized.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (9)
1. A page generation method is characterized by comprising the following steps:
the method comprises the steps that a first server receives a page loading request sent by a client and sends the page data loading request to a second server through a preset data interface;
the first server judges whether page data returned by the data interface is received within a preset time period, wherein the preset time period is dynamically adjusted along with page content, target crowd, browsing time and user preference;
if at least one data interface response time-out does not return page data, the first server generates a partial page according to the received page data returned by the partial data interface and returns the partial page to the client, so that the client displays the partial page;
the first server transmits a request record and a request result of a page data loading request to the client;
the client stores the received request record and request result to a local cache;
the client searches for the request record information stored in the local cache to determine that the request result is a data interface and page data loading request with overtime response;
and the client sends a page data loading request to the second server through a data interface responding to the timeout so as to request the page data which is not returned in response to the timeout to render the partial page to form a complete page.
2. The page generation method of claim 1, wherein the page generation method further comprises:
and the client sends the page loading request to the first server through a preset protocol, wherein the preset protocol is any one of an HTTP (hyper text transport protocol), a TCP/IP (transmission control protocol/internet protocol), a UDP (user datagram protocol) and an HTTPS (hypertext transfer protocol secure) protocol.
3. The page generating method according to claim 1, wherein before the step of determining whether the page data returned by the data interface is received within a preset time period, the first server further comprises:
and the second server receives the page data loading request, and feeds back the page data to the first server through the data interface in response to the page data loading request.
4. The page generating method as claimed in claim 1, wherein said step of requesting rendering of said partial page to form a complete page in response to page data not returned after a timeout comprises:
and the client receives the page data which is returned by the second server and responds to the overtime, and performs page rendering based on the currently received page data and the page data stored in the local cache to output a complete page.
5. The page generating method of claim 1, wherein the first server is a front-end server and the second server is a back-end server.
6. The page generation method of claim 1, wherein the page generation method further comprises:
and if the page data returned by each data interface is received in the preset time period, the first server generates a complete page according to the received page data returned by each data interface and returns the complete page to the client.
7. A page generating apparatus, characterized in that the page generating apparatus comprises:
the system comprises a sending module, a data processing module and a data processing module, wherein the sending module is used for controlling a first server to send a page data loading request to a second server through a preset data interface when the first server receives the page loading request sent by a client;
the judging module is used for controlling the first server to judge whether page data returned by the data interface is received within a preset time period, wherein the preset time period is dynamically adjusted along with page content, target groups, browsing time and user preference;
the first control module is used for controlling the first server to generate a partial page according to the received page data returned by the partial data interface and return the partial page to the client when at least one data interface response time-out page data is not returned, so that the client displays the partial page, and the first server transmits a request record and a request result of a page data loading request to the client; the client stores the received request record and request result to a local cache; the client searches for the request record information stored in the local cache to determine that the request result is a data interface and page data loading request with overtime response;
and the second control module is used for controlling the client to send a page data loading request to the second server through a data interface responding to timeout so as to request that the partial pages are rendered by responding to page data which is not returned after timeout so as to form a complete page.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the page generation method of any of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, in which a computer program is stored which is executable by at least one processor for causing the at least one processor to carry out the steps of the page generation method as claimed in any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011502493.0A CN112672187B (en) | 2020-12-18 | 2020-12-18 | Page generation method and device, computer equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011502493.0A CN112672187B (en) | 2020-12-18 | 2020-12-18 | Page generation method and device, computer equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112672187A CN112672187A (en) | 2021-04-16 |
CN112672187B true CN112672187B (en) | 2023-03-21 |
Family
ID=75406361
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011502493.0A Active CN112672187B (en) | 2020-12-18 | 2020-12-18 | Page generation method and device, computer equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112672187B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114138397B (en) * | 2021-12-10 | 2024-06-07 | 北京百度网讯科技有限公司 | Page display method and device, electronic equipment and storage medium |
CN114510283B (en) * | 2021-12-23 | 2024-08-06 | 贝壳找房(北京)科技有限公司 | Page loading method and device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005292886A (en) * | 2004-03-31 | 2005-10-20 | Namco Ltd | Image display device, method and program |
CN107391664A (en) * | 2017-07-19 | 2017-11-24 | 广州华多网络科技有限公司 | Page data processing method and system based on WEB |
CN109684586A (en) * | 2018-11-21 | 2019-04-26 | 平安科技(深圳)有限公司 | Page layout optimization display methods, device, computer equipment and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020184507A1 (en) * | 2001-05-31 | 2002-12-05 | Proact Technologies Corp. | Centralized single sign-on method and system for a client-server environment |
CN103761317B (en) * | 2014-01-27 | 2017-08-29 | 北京京东尚科信息技术有限公司 | A kind of asynchronous rendering system of multithreading and method |
CN106095506A (en) * | 2016-06-14 | 2016-11-09 | 乐视控股(北京)有限公司 | A kind of page loading method and device |
CN109740081B (en) * | 2018-12-27 | 2021-03-09 | 新华三技术有限公司合肥分公司 | Page loading method and device |
CN111859077B (en) * | 2019-04-24 | 2024-09-20 | 北京沃东天骏信息技术有限公司 | Data processing method, device, system and computer readable storage medium |
CN111966938B (en) * | 2020-09-11 | 2022-06-14 | 苏州浪潮智能科技有限公司 | Configuration method and system for realizing loading speed improvement of front-end page of cloud platform |
-
2020
- 2020-12-18 CN CN202011502493.0A patent/CN112672187B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005292886A (en) * | 2004-03-31 | 2005-10-20 | Namco Ltd | Image display device, method and program |
CN107391664A (en) * | 2017-07-19 | 2017-11-24 | 广州华多网络科技有限公司 | Page data processing method and system based on WEB |
CN109684586A (en) * | 2018-11-21 | 2019-04-26 | 平安科技(深圳)有限公司 | Page layout optimization display methods, device, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
一种基于历史连接的网络拥塞控制算法及其性能分析;陈晶等;《计算机研究与发展》;20031030(第10期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112672187A (en) | 2021-04-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110020367B (en) | Page rendering method and device | |
CN104572843B (en) | The loading method and device of a kind of page | |
US11184465B2 (en) | Network communication for establishing a QUIC connection | |
CN108874922B (en) | Client device, webpage rendering method based on single page application and storage medium | |
CN105472035A (en) | File transmission method and device | |
CN112672187B (en) | Page generation method and device, computer equipment and readable storage medium | |
US10158691B2 (en) | Method and apparatus for providing network resources at intermediary server | |
CN111079048B (en) | Page loading method and device | |
CN112579948B (en) | Webpage screenshot method and device, storage medium and electronic equipment | |
CN112818270B (en) | Data cross-domain transfer method and device and computer equipment | |
EP3528474B1 (en) | Webpage advertisement anti-shielding methods and content distribution network | |
CN109495553B (en) | Webpage display control method and system and reverse proxy server | |
CN113411404A (en) | File downloading method, device, server and storage medium | |
CN112612982A (en) | Webpage preloading method and device and computer equipment | |
US8972968B1 (en) | Alternate service for applications | |
CN111783005B (en) | Method, device and system for displaying web page, computer system and medium | |
CN111431767B (en) | Multi-browser resource synchronization method and device, computer equipment and storage medium | |
US10719573B2 (en) | Systems and methods for retrieving web data | |
US10095791B2 (en) | Information search method and apparatus | |
CN109951549B (en) | Network page access method and device and computer readable storage medium | |
CN109698832B (en) | Method for rapidly providing Portal authentication and rapidly popping Portal authentication page and related equipment | |
CN111273964A (en) | Data loading method and device | |
CN113934954A (en) | Webpage first screen rendering method and device in application program | |
US20140237133A1 (en) | Page download control method, system and program for ie core browser | |
CN111756744B (en) | H5 user identification method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |