Page rendering method and device, computer equipment and storage medium

By allocating page rendering tasks between multiple servers and selecting the appropriate server according to the page type, the problem of long loading time on the first screen and unfriendly SEO under client rendering mode is solved, and faster page rendering and better user experience is achieved.

CN119690558APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411692621.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the prior art, the client rendering method causes problems such as long loading time on the first screen and unfriendly to SEO, and the server-side rendering and static site generation methods each have the disadvantages of high pressure, high development difficulty and long page construction time.

Method used

By setting up multiple servers, the target server is determined according to the page type, so as to realize page rendering, avoid the client executing JavaScript scripts, reduce user waiting time, and realize independent rendering of different page types.

Benefits of technology

It reduces user waiting time, improves user experience, and makes up for the shortcomings of a single rendering method through independent rendering methods, achieving faster page rendering data acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690558A_ABST
    Figure CN119690558A_ABST
Patent Text Reader

Abstract

The invention discloses a page rendering method and device, computer equipment and a storage medium, and the method comprises the steps: responding to a rendering request for a target page, and determining the page type of the target page according to the rendering request; determining a target server matched with the page type from a plurality of servers; sending a rendering request to a target server; and in response to rendering data corresponding to the rendering request, sending the rendering data. The page rendering is executed by setting the server, so that the waiting time of a user can be shortened, and the user experience is improved; moreover, a plurality of servers are arranged, the target server matched with the page type is selected from the plurality of servers to obtain the rendering data of the target page according to different page types requested to be rendered, and an adaptive page rendering mode can be selected for each page type, so that the defect of a single page rendering mode is overcome, and the rendering efficiency of the target page is improved. The rendering data of the target page can be obtained more quickly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a page rendering method, apparatus, computer equipment and storage medium (computer-readable storage medium). Background Art

[0002] With the rapid development of Internet technology, presenting rich page content to users through web pages has become a common technology. At present, there are various clients with browser functions that can provide users with web browsing functions. When a user initiates a page viewing request through a client, the client can load the necessary JavaScript script from the server and execute the JavaScript script to render the page requested by the user, and then the client displays the page in response to the user's viewing request. Summary of the invention

[0003] Embodiments of the present application provide a page rendering method, apparatus, computer equipment, and storage medium.

[0004] In a first aspect, an embodiment of the present application provides a page rendering method, the method comprising:

[0005] In response to a rendering request for a target page, determining a page type of the target page according to the rendering request;

[0006] Determine a target server matching the page type from among multiple servers;

[0007] Sending the rendering request to the target server;

[0008] In response to rendering data corresponding to the rendering request, the rendering data is sent.

[0009] In a second aspect, an embodiment of the present application provides a page rendering device, the device comprising:

[0010] A first determining unit, configured to, in response to a rendering request for a target page, determine a page type of the target page according to the rendering request;

[0011] A second determining unit is used to determine a target server matching the page type from a plurality of servers;

[0012] A first sending unit, configured to send the rendering request to the target server;

[0013] The second sending unit is used to send the rendering data in response to the rendering data corresponding to the rendering request.

[0014] In a third aspect, an embodiment of the present application further provides a page rendering system, the page rendering system comprising a client, a gateway server and a plurality of servers; wherein:

[0015] The client is used to: send a rendering request for a target page to the gateway server;

[0016] The gateway server is used to: determine the page type of the target page according to the rendering request; determine a target server matching the page type from the multiple servers; and send the rendering request to the target server;

[0017] The target server is used to: obtain rendering data of the target page according to the rendering request; and send the rendering data to the gateway server;

[0018] The gateway server is further used to: send the rendering data to the client;

[0019] The client is further configured to display the target page according to the rendered data.

[0020] In a fourth aspect, an embodiment of the present application further provides a computer device, including a memory storing multiple instructions; a processor loads instructions from the memory to execute the steps of any page rendering method provided in the embodiment of the present application.

[0021] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps of any page rendering method provided in an embodiment of the present application.

[0022] In a sixth aspect, an embodiment of the present application further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of any page rendering method provided in an embodiment of the present application.

[0023] By adopting the solution of the embodiment of the present application, by setting up a server to perform page rendering, there is no need for the client to execute JavaScript scripts, which can reduce user waiting time and improve user experience. In addition, by setting up multiple servers, according to the different types of pages requested for rendering, a target server matching the page type is selected from multiple servers to obtain the rendering data of the target page, so that page rendering of different page types can be independent of each other, and an adaptive page rendering method can be selected for each page type to make up for the defects of a single page rendering method, so as to obtain the rendering data of the target page faster. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 It is a flow chart of a server-side rendering method;

[0026] Figure 2 It is a flowchart of a static site generation method;

[0027] Figure 3 is a schematic diagram of a page rendering system provided in an embodiment of the present application;

[0028] Figure 4 is a schematic diagram of a page rendering method provided in an embodiment of the present application;

[0029] Figure 5 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0030] Figure 6 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0031] Figure 7 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0032] Figure 8 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0033] Fig. 9 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0034] Fig.10 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0035] Fig.11 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0036] Fig.12 is a schematic diagram of another page rendering method provided in an embodiment of the present application;

[0037] Fig.13 It is a structural schematic diagram of a page rendering device provided in an embodiment of the present application;

[0038] Fig.14 It is a structural schematic diagram of another page rendering device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0040] With the rapid development of Internet technology, presenting rich page content to users through web pages has become a common technology. At present, there are various clients with browser functions that can provide users with web browsing functions. When a user initiates a page viewing request through the client, the client can load the necessary JavaScript script from the server and execute the JavaScript script to render the page requested by the user, and then the client displays the page in response to the user's viewing request. The above rendering adopts the client-side rendering (CSR) method. At present, most clients use client-side rendering. Although client-side rendering has fast response speed, strong dynamics, and simple deployment, it also has the following obvious disadvantages.

[0041] First, the first screen loading time of client-side rendering is long: For complex single-page applications (SPA), the first screen loading time may be long due to the need to load JavaScript scripts, and users need to wait for a while before they can see the content. During the loading and execution of JavaScript scripts, users may see a blank page, which is the so-called "white screen time".

[0042] Second, client-side rendering is not SEO (Search Engine Optimization) friendly: search engine crawlers may not be able to parse page content dynamically generated by JavaScript scripts well, resulting in poor SEO results.

[0043] In order to solve the problem of client-side rendering, some clients use server-side rendering (SSR) or static site generation (SSG) to build websites, which is more common in multi-page applications (MPA). However, each method has its own disadvantages.

[0044] like Figure 1 FIG. 1 is a flow chart of a server-side rendering (SSR) method. The server-side rendering method mainly includes the following steps:

[0045] Step 110: Generate a file package that can be executed in the Nodejs environment by using the build tool; Figure 1 The code shown builds packaging and generates Nodejs code file packages; Nodejs is an open source and cross-platform JavaScript runtime environment;

[0046] Step 120: Deploy the file package to the Nodejs application server and restart the service;

[0047] Step 130: The user uses the client to access the website and generate an HTTP request;

[0048] Step 140: The HTTP request arrives at a gateway server such as Nginx;

[0049] Step 150: Nginx and other gateway servers forward the HTTP request to the Nodejs application server;

[0050] Step 160: The Nodejs application server processes the request and renders the template and data to generate a HyperText Markup Language (HTML) file;

[0051] Step 170: The Nodejs application server returns the HTML file to the client in the original path.

[0052] For server-side rendering (SSR): First, the server is under too much pressure. When the number of user requests is large, high concurrency will cause excessive pressure on the server; second, development is more difficult because developers need to consider the running status of components on both the server and the client at the same time.

[0053] like Figure 2 FIG. 1 is a flow chart of a static site generation (SSG) method. The static site generation method mainly includes the following steps:

[0054] Step 210: Use the template file and data interface to generate static file packages such as HTML through the construction tool, and upload these files to the WEB application server; that is, Figure 2 The code shown in the build package, generate HTML and other static file packages, and upload files to the WEB application server;

[0055] Step 220: The user uses the client to access the website and generates an HTTP request;

[0056] Step 230: The HTTP request arrives at a gateway server such as Nginx;

[0057] Step 240: Nginx and other gateway servers forward the HTTP request to the WEB application server;

[0058] Step 250: The WEB application server processes the request and returns the HTML file to the client in the original path.

[0059] For static site generation (SSG): First, the page construction time is long, especially for large sites, the page construction time may be longer; second, it is not suitable for frequent data updates, because for pages that need to update data frequently, each update requires rebuilding the page.

[0060] In view of this, the embodiments of the present application provide a page rendering method, device, computer equipment and storage medium, which can solve the above technical problems. The following is a detailed description with reference to the accompanying drawings. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the drawings.

[0061] Please refer to Figure 3 , Figure 3 Schematic diagram of a page rendering system provided by an embodiment of the present application. Figure 3 As shown, the page rendering system includes a client 310 , a gateway server 320 , and multiple servers 330 .

[0062] The client 310 has a browser function and can provide users with a web page browsing function. The embodiment of the present application does not limit the specific content of the client 310. Optionally, the client 310 is implemented as a web application, that is, an application that only has a browser function; or, the client 310 can also be implemented as a shopping application, a takeaway application, a game application, an instant messaging application, a navigation application, a social application, an office application, a health application or an education application, etc., which have other functions in addition to the browser function. In addition, the client 310 can be installed in a computer device 340, which can be a terminal or a server and other devices, and the terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC, Personal Computer), a personal digital assistant (PDA, Personal Digital Assistant) and the like.

[0063] The gateway server 320 has functions such as request routing and reverse proxy, and is set between the client 310 and multiple servers 330. It can be used as a proxy server between the client 310 and the server 330 to establish communication between the client 310 and the server 330. The embodiment of the present application does not limit the specific type of the gateway server 320. Optionally, the gateway server 320 can be implemented as Nginx, APISIX, Tengine, Quarkus, Envoy or Traefik.

[0064] The server 330 is used to provide background services, such as rendering services, for the client 310. Optionally, the server 330 can only provide rendering services for the client 310, or it can provide other services for the client 310 while providing rendering services, such as user data storage, identity authentication or security assurance. The embodiment of the present application sets a plurality of servers 330 for the client 310, that is, two or more servers 330 are set. Among them, the plurality of servers 330 are used to render pages of different page types, that is, pages of different page types are rendered by different servers 330; pages of the same page type can be rendered by one server 330 or by multiple servers 330. Of course, in the embodiment of the present application, although corresponding servers 330 are set for pages of different page types, when the rendering traffic of a server 330 is too large, other servers 330 can also temporarily act as the function of the server 330 to relieve the rendering traffic pressure of the server 330. The embodiment of the present application does not limit the specific type of the server 330. Optionally, the server 330 can be implemented as an application server such as WEB or Nodejs.

[0065] based on Figure 3 The page rendering system shown, where:

[0066] The client is used to: send a rendering request for a target page to the gateway server;

[0067] The gateway server is used to: determine the page type of the target page according to the rendering request; determine the target server matching the page type of the target page from multiple servers; and send the rendering request to the target server;

[0068] The target server is used to: obtain the rendering data of the target page according to the rendering request; and send the rendering data of the target page to the gateway server;

[0069] The gateway server is also used to: send the rendering data of the target page to the client;

[0070] The client is further used to: display the target page according to the rendered data of the target page.

[0071] In some embodiments, the gateway server is further used to:

[0072] According to the rendering request, determine the page type of the target page in the configuration file;

[0073] The configuration file includes page types of multiple pages.

[0074] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; and the gateway server is further used to:

[0075] If the target page is a static page, the first server is determined as the target server;

[0076] If the target page is a dynamic page, the second server is determined as the target server.

[0077] In some embodiments, the target server is a first server; the target server is further configured to:

[0078] The rendering data of the static page matching the rendering request is selected from the rendering data of the plurality of pre-rendered static pages as the rendering data of the target page.

[0079] In some embodiments, the target server is a second server; the target server is further configured to:

[0080] Get the page data and template files that match the rendering request;

[0081] Rendering is performed according to the page data and template file to obtain the rendering data of the target page.

[0082] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; and the gateway server is further used to:

[0083] Monitoring a first rendering traffic of a first server;

[0084] If the first rendering traffic is greater than the first preset traffic, the second server is used as the target server;

[0085] If the first rendering traffic is less than the first preset traffic, the page type of the target page is determined according to the rendering request; and a target server matching the page type of the target page is determined from a plurality of servers.

[0086] In some embodiments, the second server is further configured to:

[0087] The rendering data of the pre-rendered static page is obtained from the first server, and the obtained rendering data of the static page is stored.

[0088] In some embodiments,

[0089] The second server is also used for:

[0090] Sending second indication information to the gateway server, where the second indication information is used to indicate a static page corresponding to the rendering data stored in the second server;

[0091] Gateway server, also used for:

[0092] If the first rendering traffic is greater than the first preset traffic, and the target page is a static page, the target server is determined from the multiple servers according to the second indication information; wherein, if the static pages indicated by the second indication information include the target page, the second server is used as the target server; if the static pages indicated by the second indication information do not include the target page, the first server is used as the target server;

[0093] If the first rendering traffic is greater than the first preset traffic and the target page is a dynamic page, the second server is used as the target server.

[0094] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; and the gateway server is further used to:

[0095] Monitoring the second rendering traffic of the second server;

[0096] If the second rendering traffic is greater than the second preset traffic, the first server is used as the target server;

[0097] If the second rendering traffic is less than the second preset traffic, the page type of the target page is determined according to the rendering request; and a target server matching the page type of the target page is determined from a plurality of servers.

[0098] In some embodiments, the first server is further configured to:

[0099] The rendering data of the dynamic page rendered by the second server is obtained from the second server, and the obtained rendering data of the dynamic page is stored.

[0100] In some embodiments,

[0101] The first server is also used for:

[0102] Sending first indication information to the gateway server, where the first indication information is used to indicate a dynamic page corresponding to the rendering data stored in the first server;

[0103] Gateway server, also used for:

[0104] If the second rendering traffic is greater than the second preset traffic, and the target page is a static page, the first server is used as the target server;

[0105] If the second rendering traffic is greater than the second preset traffic and the target page is a dynamic page, the target server is determined from multiple servers according to the first indication information; if the dynamic page indicated by the first indication information includes the target page, the first server is used as the target server; if the dynamic page indicated by the first indication information does not include the target page, the second server is used as the target server.

[0106] In some embodiments, the first server is further configured to:

[0107] The preconfigured page data and template file are obtained from the second server, and the page data and template file are stored.

[0108] For ease of description, the following is an introduction to the embodiment of the present application from the perspective of the page rendering method. The functions of the various functional entities included in the above-mentioned page rendering system, the steps performed to implement the page rendering method, and the beneficial effects achieved, etc., please refer to the introduction of the following page rendering method embodiment, which will not be repeated here.

[0109] Please refer to Figure 4 , Figure 4 4 is a flow chart of a page rendering method provided by an embodiment of the present application. The specific process of the page rendering method may include the following steps 410 to 480.

[0110] Step 410: The client sends a rendering request for the target page to the gateway server.

[0111] When the user needs to view the target page, a request to view the target page can be initiated through the client. For example, the user enters the URL of the target page in the client, or clicks a link of the target page in the client, so that the client can receive the user's request to view the target page. Of course, the request to view the target page can also be triggered by other methods, which is not limited in the embodiment of the present application. For example, when the client displays multiple consecutive pages, the current page display reaches a preset time length, which automatically triggers a request to view the next page (such as the target page).

[0112] In response to the viewing request for the target page, the client may send a rendering request for the target page to the gateway server, where the rendering request is used to request the target page to be rendered. The present application embodiment does not limit the specific content of the rendering request, and optionally, the rendering request includes but is not limited to: the identifier of the device where the client is located, the identifier of the target page, etc.

[0113] Step 420: The gateway server determines the page type of the target page according to the rendering request.

[0114] In an embodiment of the present application, the rendering request may directly include the page type of the target page, so that the gateway server can obtain the page type of the target page by parsing the rendering request. Alternatively, the rendering request may include the identifier of the target page, so that the gateway server further determines the page type of the target page according to a pre-configured configuration file.

[0115] Based on this, in some embodiments, the above step 420 includes: the gateway server determines the page type of the target page according to the configuration file and the rendering request. Among them, a configuration file is pre-configured in the gateway server, and the configuration file is used to indicate the page types of multiple pages. Among them, these multiple pages are the pages that can be provided by the client, and the configuration file can be used to indicate the page type of each page that can be provided by the client, so that the gateway server can determine the page type of any page. Thus, whenever there is a page update on the client, such as adding, deleting or modifying a page, or every preset time, such as every week, half a month or a month, the configuration file stored in the gateway server can be updated once.

[0116] In response to a rendering request from a client for a target page, the gateway server determines the page type of the target page based on the configuration file and the rendering request. The rendering request may include an identifier of the target page, and the configuration file is used to indicate the page types of multiple pages, such as the configuration file includes a mapping relationship between the identifier of each page and the page type, so that the gateway server can locate the page type of the target page in the configuration file. Optionally, if the target page is not included in the multiple pages indicated by the configuration file, such as the configuration file does not include the identifier of the target page, the gateway server can determine the page type of the target page as a default type or any page type indicated by the configuration file; or, the gateway server can return a rendering failure indication to the client to indicate to the user that the target page cannot be rendered or the target page cannot be queried, etc.

[0117] The embodiments of the present application do not limit the specific classification of page types. Optionally, the page types include static pages or dynamic pages; or, the page types include single-page pages or multi-page pages; or, the page types include news pages, product pages, login pages, chat pages, payment pages, navigation pages, etc.; in actual applications, the specific page types can be divided according to needs.

[0118] Step 430: The gateway server determines a target server that matches the page type of the target page from among multiple servers.

[0119] The gateway server selects a target server from multiple servers according to the page type of the target page, and the target server matches the page type of the target page. The target server matches the page type of the target page, which means that the target server is used to render pages of the page type. For example, if the target page is a static page, the determined target server is used to render the static page; if the target page is a dynamic page, the determined target server is used to render the dynamic page.

[0120] To select the target server, the gateway server may be pre-configured with a mapping relationship between the identifier of each server and the page type. For example, the configuration file pre-configured in the gateway server is also used to indicate the page types rendered by multiple servers. Of course, the page types of multiple pages provided by the client and the page types rendered by multiple servers may be indicated by one configuration file or by different configuration files.

[0121] In some embodiments, the multiple servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; the above step 430 includes: if the target page is a static page, the gateway server determines the first server as the target server; if the target page is a dynamic page, the gateway server determines the second server as the target server.

[0122] Among them, static pages refer to pages with infrequent data changes, that is, pages that present static content; dynamic pages refer to pages with frequent data changes, that is, pages that present dynamic content. For example, static pages include product introduction pages or article pages, and dynamic pages include search result pages, news pages, user comment pages, etc. Usually, static pages include fixed content that will not change with user interaction; dynamic pages include dynamic content that will change with user interaction, real-time data or query results, etc.

[0123] Take the example of a server including a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; if the target page requested by the client is a static page, the gateway server uses the first server as the target server; if the target page requested by the client is a dynamic page, the gateway server uses the second server as the target server. The first server can be one server or multiple servers, that is, multiple servers are used to render static pages; similarly, the second server can be one server or multiple servers, that is, multiple servers are used to render dynamic pages; in actual applications, the number of servers included in the first server and the second server can be flexibly set according to needs.

[0124] Step 440: The gateway server sends a rendering request to the target server.

[0125] After the gateway server determines the target server from multiple servers, it sends a rendering request to the target server. The rendering request may be an Http request. Optionally, the rendering request for the target page sent by the client to the gateway server and the rendering request for the target page sent by the gateway server to the target server are both used to request the rendered target page, but the specific content and data format of the two rendering requests may be different. For example, the rendering request sent by the client includes the identifier of the device where the client is located (such as the IP address of the device) and the identifier of the target page, but the rendering request sent by the gateway server includes the identifier of the gateway server (such as the IP address of the gateway server) and the identifier of the target page; or, the rendering request sent by the client and the rendering request sent by the gateway server are encrypted using different encryption methods.

[0126] Step 450: The target server obtains rendering data of the target page according to the rendering request.

[0127] The target server responds to the rendering request for the target page and obtains the rendering data of the target page according to the rendering request. Optionally, the target server stores the rendering data of multiple pre-rendered pages, so that the target server obtains the rendering data of the target page according to the rendering request, which means that the target server directly obtains the rendering data of the target page from the rendering data of multiple pre-rendered pages; or, the target server stores codes, etc., so that the target server obtains the rendering data of the target page according to the rendering request, which means that the target server performs rendering of the target page according to the codes, etc. to generate the rendering data of the target page in real time.

[0128] In some embodiments, the multiple servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; if the target page is a static page, the gateway server determines the first server as the target server; thus, the above step 450 includes: the target server (i.e., the first server) selects the rendering data of the static page that matches the rendering request of the target page from the rendering data of the pre-rendered multiple static pages as the rendering data of the target page. The first server includes the rendering data of the pre-rendered multiple static pages, and the rendering data of the pre-rendered multiple static pages can be pre-configured, that is, pre-rendered by other devices and then pre-configured to the first server; or the rendering data of the pre-rendered multiple static pages can also be pre-rendered by the first server itself.

[0129] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; if the target page is a dynamic page, the gateway server determines the second server as the target server; thus, the above step 450 includes: the target server (i.e., the second server) obtains page data and template files that match the rendering request of the target page; and performs rendering according to the obtained page data and template files to obtain the rendering data of the target page. Wherein, the second server includes preconfigured template files and page data, the second server obtains the template files that match the rendering request from the preconfigured template files, and the second server obtains the page data that matches the rendering request from the preconfigured page data, and / or obtains the page data that matches the rendering request from other databases; then the second server performs rendering according to the template files and page data that match the rendering request, and fills the obtained page data into the obtained template files to generate the rendering data of the target page.

[0130] It should be understood that the rendering process performed by the first server for rendering static pages can refer to static site generation (SSG), and the rendering process performed by the second server for rendering dynamic pages can refer to server-side rendering (SSR), and the embodiments of the present application are not described in detail here. In addition, the rendering data of the target page obtained by the target server can be an HTML file, which contains the complete HTML structure of the target page.

[0131] Step 460: The target server sends rendering data of the target page to the gateway server.

[0132] After obtaining the rendering data of the target page, the target server sends the rendering data of the target page to the gateway server in response to the rendering request sent by the gateway server. The rendering request sent by the gateway server may include the identifier of the gateway server (such as the IP address of the gateway server), so that the target server sends the rendering data of the target page to the gateway server according to the identifier of the gateway server.

[0133] Step 470: The gateway server sends rendering data of the target page to the client.

[0134] The gateway server responds to the rendering data of the target page from the target server by sending the rendering data of the target page to the client in response to the rendering request sent by the client. The rendering request sent by the client may include the identifier of the device where the client is located (such as the IP address of the device), so that the gateway server sends the rendering data of the target page to the client according to the identifier of the device where the client is located.

[0135] One point that needs to be explained is that, in the embodiment of the present application, after the target server obtains the rendering data of the target page, it forwards the rendering data of the target page to the client through the gateway server, that is, the rendering data of the target page is returned along the original path, which can ensure the data security of the target server, etc. In the actual application process, after determining the rendering data of the target page, the target server can also directly send the rendering data of the target page to the client without having to forward it through the gateway server. For example, the rendering request sent by the client includes the identifier of the device where the client is located (such as the IP address of the device), and the gateway server forwards the rendering request to the target server, and then after the target server obtains the rendering data of the target page, it sends the rendering data of the target page to the client according to the identifier of the device where the client is located.

[0136] Step 480: The client displays the target page according to the rendered data of the target page.

[0137] In response to receiving the rendering data of the target page, the client can parse the rendering data of the target page and then display the target page in response to the user's viewing request for the target page. In the embodiment of the present application, the rendering of the target page is completed by the target server. For example, the rendering data of the target page is an HTML file containing a complete HTML structure. Therefore, after receiving the rendering data of the target page, the client does not need to execute a JavaScript script, but directly parses the rendering data of the target page and displays the target page.

[0138] In summary, the page rendering method provided by the embodiment of the present application is performed by a page rendering system, which includes a client, a gateway server and multiple servers. Among them, the gateway server responds to the rendering request of the client for the target page, determines the page type of the target page, and then determines the target server matching the page type of the target page from multiple servers, and sends a rendering request to the target server; the target server obtains the rendering data of the target page according to the rendering request, and then returns the rendering data of the target page to the client in the original path, so that the client displays the target page. First, the embodiment of the present application performs page rendering by setting a server, without the need for the client to execute JavaScript scripts, which can reduce user waiting time and improve user experience. In addition, the embodiment of the present application sets multiple servers, and selects a target server matching the page type from multiple servers according to the different page types requested for rendering to obtain the rendering data of the target page, so that the page rendering of different page types can be realized to be independent of each other, and each page type can select an adapted page rendering method to make up for the defects of a single page rendering method, so as to obtain the rendering data of the target page faster.

[0139] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages. Figure 5 , Figure 5 501 to 510 are steps 502 to 511.

[0140] Step 501: The client sends a rendering request for a target page to the gateway server.

[0141] Step 502: The gateway server monitors the first rendering traffic of the first server.

[0142] In an embodiment of the present application, the gateway server can monitor the rendering traffic of the first server, that is, the first rendering traffic. Among them, the first rendering traffic is used to indicate the data processing pressure of the first server. The embodiment of the present application does not limit the specific definition of the first rendering traffic. In actual applications, it can be flexibly set in combination with demand. For example, the first rendering traffic can refer to the number of rendering requests received by the first server in history, or the number of rendering requests received by the first server within a preset time period, or the number of rendering requests currently received by the first server, or the number of rendering requests currently being processed by the first server, or the number of rendering requests processed by the first server within a preset time period. The embodiment of the present application does not limit the specific definition of the first rendering traffic. In actual applications, it can be flexibly set in combination with demand.

[0143] Optionally, the gateway server may continuously monitor the first rendering traffic, or may monitor the first rendering traffic upon receiving a rendering request. That is, step 502 in the embodiment of the present application may be executed after step 501; or may be irrelevant to the execution of step 501, that is, the execution of step 502 is not based on step 501 as a prerequisite. Figure 5 For the sake of ease of description, it is taken as an example that step 502 is performed after step 501. It should be understood that this does not constitute a limitation on the embodiments of the present application.

[0144] During the execution of step 502, or after step 502, the gateway server compares the first rendering traffic with the first preset traffic to determine whether the first rendering traffic is greater than the first preset traffic. Among them, the first preset traffic is a preconfigured traffic threshold. The embodiment of the present application does not limit the specific value of the first preset traffic. In actual applications, it can be flexibly set according to needs. If the first rendering traffic is greater than the first preset traffic, execute the following step 503; if the first rendering traffic is less than the first preset traffic, execute the following step 504. In addition, if the first rendering traffic is equal to the first preset traffic, you can execute the following step 503 or the following step 504.

[0145] Step 503: If the first rendering traffic is greater than the first preset traffic, the gateway server uses the second server as the target server.

[0146] If the first rendering traffic is greater than the first preset traffic, the current data processing pressure of the first server is relatively large, and the gateway server can directly use the second server as the target server to disperse the page rendering pressure.

[0147] Step 504: If the first rendering traffic is less than the first preset traffic, the gateway server determines the page type of the target page according to the rendering request.

[0148] Step 505: The gateway server determines a target server that matches the page type of the target page from among multiple servers.

[0149] Step 506: The gateway server sends a rendering request to the target server.

[0150] Step 507: The target server obtains rendering data of the target page according to the rendering request.

[0151] Step 508: The target server sends rendering data of the target page to the gateway server.

[0152] Step 509: The gateway server sends the rendering data of the target page to the client.

[0153] Step 510: The client displays the target page according to the rendered data of the target page.

[0154] For the description of the above step 501 and steps 504 to 510, please refer to the above steps 410 to 480. Their implementation principles are the same and will not be described in detail in the present embodiment. Figure 5 In the embodiment, after executing step 503, execution starts from step 506, that is, step 503 and steps 504 to 505 are optional execution steps. If step 503 is executed, steps 504 to 505 do not need to be executed; if steps 504 to 505 are executed, step 503 does not need to be executed.

[0155] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages. Figure 6 , Figure 6 601 to 613 are steps 602 to 614.

[0156] Step 601: The second server obtains rendering data of a pre-rendered static page from the first server, and stores the obtained rendering data of the static page.

[0157] In an embodiment of the present application, in order to facilitate the second server to disperse the page rendering pressure when the data processing pressure of the first server is large, the second server can obtain the rendering data of the pre-rendered static page from the first server, and store the obtained rendering data of the static page for subsequent use. The embodiment of the present application does not limit the specific method for the second server to obtain the rendering data of the pre-rendered static page. In actual application, it can be flexibly set in combination with demand. For example, the second server can obtain the rendering data of the pre-rendered static page from the first server at preset intervals to follow the update of the rendering data of the static page in the first server; or, the first server can actively push the rendering data of the pre-rendered static page to the second server when the rendering data of the pre-rendered static page stored in it is updated. In addition, the embodiment of the present application does not limit the number of rendering data of the static page obtained by the second server. For example, the second server can obtain the rendering data of all pre-rendered static pages stored in the first server, or the second server can obtain the rendering data of some pre-rendered static pages stored in the first server.

[0158] Step 602: The second server sends second indication information to the gateway server, where the second indication information is used to indicate a static page corresponding to the rendering data stored in the second server.

[0159] After obtaining the rendering data of the static page pre-rendered in the first server, the second server can send a second indication message to the gateway server to indicate the rendering data of the static page stored in the second server, so that the gateway server can subsequently distribute rendering requests. Optionally, the second indication message includes an identifier of the static page corresponding to each rendering data stored in the second server.

[0160] Step 603: The client sends a rendering request for the target page to the gateway server.

[0161] Step 604: The gateway server determines the page type of the target page according to the rendering request.

[0162] Step 605: The gateway server monitors the first rendering traffic of the first server.

[0163] Step 606: If the first rendering traffic is greater than the first preset traffic, and the target page is a static page, the gateway server determines the target server from the multiple servers according to the second indication information.

[0164] If the first rendering traffic is greater than the first preset traffic, the current data processing pressure of the first server is relatively large. At this time, if the target page requested for rendering by the client is a static page, it is necessary to determine whether the target page is determined by the first server based on the second indication information. If the static page indicated by the second indication information includes the target page, the pre-rendered static page stored in the second server includes the target page, and the gateway server uses the second server as the target server; if the static page indicated by the second indication information does not include the target page, the pre-rendered static page stored in the second server does not include the target page, and the gateway server uses the first server as the target server.

[0165] Step 607: If the first rendering traffic is greater than the first preset traffic, and the target page is a dynamic page, the gateway server uses the second server as the target server.

[0166] If the first rendering traffic is greater than the first preset traffic, the current data processing pressure of the first server is relatively large. At this time, if the target page requested for rendering by the client is a dynamic page, the gateway server directly uses the second server as the target server.

[0167] Step 608: If the first rendering traffic is less than the first preset traffic, the gateway server determines a target server that matches the page type of the target page from the multiple servers.

[0168] Step 609: The gateway server sends a rendering request to the target server.

[0169] Step 610: The target server obtains rendering data of the target page according to the rendering request.

[0170] Step 611: The target server sends rendering data of the target page to the gateway server.

[0171] Step 612: The gateway server sends rendering data of the target page to the client.

[0172] Step 613: The client displays the target page according to the rendered data of the target page.

[0173] For the description of steps 603 to 605 and steps 608 to 613, please refer to the above steps 501 to 510. Their implementation principles are the same and will not be described in detail in this embodiment of the present application. Figure 6 Steps 609 to 613 are omitted.

[0174] In summary, the page rendering method provided in the embodiment of the present application is executed by a page rendering system, which includes a client, a gateway server and multiple servers. Among them, the multiple servers include a first server for rendering static pages, and a second server for rendering dynamic pages. The second server can pull the rendering data of the pre-rendered static page from the first server, and the gateway server monitors the first rendering traffic of the first server. Since the rendering data of the pre-rendered static page is also stored in the second server, when the first rendering traffic is large, the gateway server uses the second server as the target server to disperse the data processing pressure of the first server, improve the overall performance of the page rendering system, and ensure a quick response to the client's rendering request.

[0175] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages. Figure 7 , Figure 7 701 to 710 are steps 702 to 711.

[0176] Step 701: The client sends a rendering request for a target page to the gateway server.

[0177] Step 702: The gateway server monitors the second rendering traffic of the second server.

[0178] In an embodiment of the present application, the gateway server can monitor the rendering traffic of the second server, that is, the second rendering traffic. Among them, the second rendering traffic is used to indicate the data processing pressure of the second server. The embodiment of the present application does not limit the specific definition of the second rendering traffic. In actual applications, it can be flexibly set in combination with demand. For example, the second rendering traffic can refer to the number of rendering requests received by the second server in history, or the number of rendering requests received by the second server within a preset time period, or the number of rendering requests currently received by the second server, or the number of rendering requests currently being processed by the second server, or the number of rendering requests processed by the second server within a preset time period. The embodiment of the present application does not limit the specific definition of the second rendering traffic, and it can be flexibly set in combination with demand in actual applications.

[0179] Optionally, the gateway server may continuously monitor the second rendering traffic, or monitor the second rendering traffic upon receiving a rendering request. That is, step 702 in the embodiment of the present application may be executed after step 701; or may be irrelevant to the execution of step 701, that is, the execution of step 702 is not based on step 701 as a prerequisite. Figure 7For the sake of ease of description, it is taken as an example that step 702 is performed after step 701. It should be understood that this does not constitute a limitation on the embodiments of the present application.

[0180] During the execution of step 702, or after step 702, the gateway server compares the second rendering traffic with the second preset traffic to determine whether the second rendering traffic is greater than the second preset traffic. Among them, the second preset traffic is a preconfigured traffic threshold. The embodiment of the present application does not limit the specific value of the second preset traffic. In actual applications, it can be flexibly set according to needs. If the second rendering traffic is greater than the second preset traffic, execute the following step 703; if the second rendering traffic is less than the second preset traffic, execute the following step 704. In addition, if the second rendering traffic is equal to the second preset traffic, you can execute the following step 703 or the following step 704.

[0181] One point that needs to be explained is that the first preset traffic and the second preset traffic can be the same traffic threshold or different traffic thresholds. In actual applications, they can be flexibly set according to needs. For example, the first preset traffic is specifically set in combination with the equipment performance of the first server, and the second preset traffic is specifically set in combination with the equipment performance of the second server. If the equipment performance of the first server and the second server is the same, the first preset traffic and the second preset traffic are set the same. For another example, the preset traffic is specifically set in combination with the type of page processed by the server. The first server used to render static pages can be set with a larger first preset traffic, and the second server used to render dynamic pages can be set with a smaller second preset traffic.

[0182] Step 703: If the second rendering traffic is greater than the second preset traffic, the gateway server uses the first server as the target server.

[0183] If the second rendering traffic is greater than the second preset traffic, the current data processing pressure of the second server is relatively large, and the gateway server can directly use the first server as the target server to disperse the page rendering pressure.

[0184] Step 704: If the second rendering traffic is less than the second preset traffic, the gateway server determines the page type of the target page according to the rendering request.

[0185] Step 705: The gateway server determines a target server that matches the page type of the target page from among multiple servers.

[0186] Step 706: The gateway server sends a rendering request to the target server.

[0187] Step 707: The target server obtains rendering data of the target page according to the rendering request.

[0188] Step 708: The target server sends rendering data of the target page to the gateway server.

[0189] Step 709: The gateway server sends the rendering data of the target page to the client.

[0190] Step 710: The client displays the target page according to the rendered data of the target page.

[0191] For the description of the above step 701 and steps 704 to 710, please refer to the above steps 410 to 480. Their implementation principles are the same and will not be described in detail in the present embodiment. Figure 7 In the embodiment, after executing step 703, execution starts from step 706, that is, step 703 and steps 704 to 705 are optional execution steps. If step 703 is executed, steps 704 to 705 do not need to be executed; if steps 704 to 705 are executed, step 703 does not need to be executed.

[0192] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages. Figure 8 , Figure 8 801 to 813 are steps 802 to 814.

[0193] Step 801: The first server obtains, from the second server, rendering data of a dynamic page rendered by the second server, and stores the obtained rendering data of the dynamic page.

[0194] In an embodiment of the present application, after rendering the dynamic page, the second server can store the rendering data of the dynamic page. In order to facilitate the first server to disperse the page rendering pressure when the data processing pressure of the second server is large, the first server can obtain the rendering data of the dynamic page rendered by the second server from the second server, and store the obtained rendering data of the dynamic page for subsequent use. The embodiment of the present application does not limit the specific method for the first server to obtain the rendering data of the rendered dynamic page. In actual application, it can be flexibly set according to the needs. For example, the first server can obtain the rendering data of the rendered dynamic page from the second server at preset intervals to follow the rendering update of the second server; or, the second server can actively push the rendering data of the rendered dynamic page to the first server when it renders a new dynamic page. In addition, the embodiment of the present application does not limit the number of rendering data of the dynamic page obtained by the first server. For example, the first server can obtain the rendering data of all rendered dynamic pages of the second server, or the first server can obtain the rendering data of some rendered dynamic pages of the second server.

[0195] Step 802: The first server sends first indication information to the gateway server, where the first indication information is used to indicate a dynamic page corresponding to the rendering data stored in the first server.

[0196] After obtaining the rendering data of the dynamic page rendered by the second server, the first server can send a first indication message to the gateway server to indicate the rendering data of the dynamic page stored in the first server, so that the gateway server can subsequently allocate rendering requests. Optionally, the first indication message includes an identifier of the dynamic page corresponding to each rendering data stored in the first server.

[0197] Step 803: The client sends a rendering request for the target page to the gateway server.

[0198] Step 804: The gateway server determines the page type of the target page according to the rendering request.

[0199] Step 805: The gateway server monitors the second rendering traffic of the second server.

[0200] Step 806: If the second rendering traffic is greater than the second preset traffic, and the target page is a static page, the gateway server uses the first server as the target server.

[0201] If the second rendering traffic is greater than the second preset traffic, the current data processing pressure of the second server is relatively large. At this time, if the target page requested for rendering by the client is a static page, the gateway server directly uses the first server as the target server.

[0202] Step 807: If the second rendering traffic is less than the second preset traffic, and the target page is a dynamic page, the gateway server determines the target server from the multiple servers according to the first indication information.

[0203] If the second rendering traffic is greater than the second preset traffic, the current data processing pressure of the second server is relatively large. At this time, if the target page requested for rendering by the client is a dynamic page, it is necessary to determine whether the target page is determined by the second server based on the first indication information. If the dynamic page indicated by the first indication information includes the target page, the rendered dynamic page stored in the first server includes the target page, and the gateway server uses the first server as the target server; if the dynamic page indicated by the first indication information does not include the target page, the rendered dynamic page stored in the first server does not include the target page, and the gateway server uses the second server as the target server.

[0204] Step 808: If the second rendering traffic is less than the second preset traffic, the gateway server determines a target server that matches the page type of the target page from the multiple servers.

[0205] Step 809: The gateway server sends a rendering request to the target server.

[0206] Step 810: The target server obtains rendering data of the target page according to the rendering request.

[0207] Step 811: The target server sends rendering data of the target page to the gateway server.

[0208] Step 812: The gateway server sends rendering data of the target page to the client.

[0209] Step 813: The client displays the target page according to the rendered data of the target page.

[0210] For the description of the above steps 803 to 805 and steps 808 to 813, please refer to the above steps 701 to 710. The implementation principles of these steps are the same, and the embodiments of the present application will not be described in detail here for the sake of ease of description. Figure 8 Steps 809 to 813 are omitted.

[0211] In some embodiments, the plurality of servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages. Fig. 9 , Fig. 9 901 to 913 are steps 902 to 914.

[0212] Step 901: The first server obtains pre-configured page data and template files from the second server, and stores the page data and template files.

[0213] In the embodiment of the present application, the second server is pre-configured with page data and template files to facilitate the rendering of dynamic pages. In order to facilitate the dispersion of page rendering pressure by the first server when the data processing pressure of the second server is large, the first server can obtain the pre-configured page data and template files from the second server, and store the obtained page data and template files for subsequent use. The embodiment of the present application does not limit the specific way in which the first server obtains page data and template files. In actual applications, it can be flexibly set in combination with demand. For example, the first server can obtain page data and template files from the second server at preset intervals to follow the rendering update of the second server; or, the second server can actively push new or all page data and template files to the first server when it updates the page data and template files. In addition, the embodiment of the present application does not limit the number of page data and template files obtained by the first server. For example, the first server can obtain all page data and template files pre-configured in the second server, or the first server can obtain part of the page data and template files pre-configured in the second server.

[0214] Step 902: The first server sends third indication information to the gateway server, where the third indication information is used to indicate the dynamic page corresponding to the page data and template file stored in the first server.

[0215] After obtaining the page data and template files pre-configured in the second server, the first server may send a third indication message to the gateway server to indicate the dynamic page corresponding to the page data and template files stored in the first server, so that the gateway server can subsequently allocate rendering requests. Optionally, the third indication message includes an identifier of each dynamic page corresponding to the page data and template files stored in the first server.

[0216] Step 903: The client sends a rendering request for the target page to the gateway server.

[0217] Step 904: The gateway server determines the page type of the target page according to the rendering request.

[0218] Step 905: The gateway server monitors the second rendering traffic of the second server.

[0219] Step 906: If the second rendering traffic is greater than the second preset traffic, and the target page is a static page, the gateway server uses the first server as the target server.

[0220] If the second rendering traffic is greater than the second preset traffic, the current data processing pressure of the second server is relatively large. At this time, if the target page requested for rendering by the client is a static page, the gateway server directly uses the first server as the target server.

[0221] Step 907: If the second rendering traffic is less than the second preset traffic, and the target page is a dynamic page, the gateway server determines the target server from the multiple servers according to the third indication information.

[0222] If the second rendering traffic is greater than the second preset traffic, the current data processing pressure of the second server is relatively large. At this time, if the target page requested for rendering by the client is a dynamic page, it is necessary to determine whether the target page is determined by the second server based on the third indication information. If the dynamic page indicated by the third indication information includes the target page, the page data stored in the first server and the dynamic page corresponding to the template file include the target page, and the gateway server uses the first server as the target server; if the dynamic page indicated by the third indication information does not include the target page, the page data stored in the first server and the dynamic page corresponding to the template file do not include the target page, and the gateway server uses the second server as the target server.

[0223] Step 908: If the second rendering traffic is less than the second preset traffic, the gateway server determines a target server that matches the page type of the target page from the multiple servers.

[0224] Step 909: The gateway server sends a rendering request to the target server.

[0225] Step 910: The target server obtains rendering data of the target page according to the rendering request.

[0226] Step 911: The target server sends rendering data of the target page to the gateway server.

[0227] Step 912: The gateway server sends rendering data of the target page to the client.

[0228] Step 913: The client displays the target page according to the rendered data of the target page.

[0229] For the description of the above steps 903 to 905 and steps 908 to 913, please refer to the above steps 701 to 710. The implementation principles of these steps are the same, and the embodiments of the present application will not be described in detail here for the sake of description. Fig. 9 Steps 909 to 913 are omitted.

[0230] In summary, the page rendering method provided in the embodiment of the present application is executed by a page rendering system, which includes a client, a gateway server and multiple servers. Among them, the multiple servers include a first server for rendering static pages, and a second server for rendering dynamic pages. The first server can pull the rendered dynamic page from the second server, or pull the pre-configured page data and template file from the second server. The gateway server monitors the second rendering traffic of the second server. Since the rendering data of the rendered dynamic page or the pre-configured page data and template file are stored in the first server, when the second rendering traffic is large, the gateway server uses the first server as the target server to disperse the data processing pressure of the second server, improve the overall performance of the page rendering system, and ensure a quick response to the client's rendering request.

[0231] It should be noted that the embodiments of the present application can be combined with the above Figures 5 and 6 Examples, and Figures 7 to 9 Embodiment, for example, combining the above Figure 5 Examples and Figure 7 Embodiment; or, in combination with the above Figure 6 Examples and Figure 8 Embodiment; or, in combination with the above Figure 6 Examples and Fig. 9 Example.

[0232] Below, an example is used to introduce and illustrate the page rendering method described in the embodiment of the present application.

[0233] Please refer to Fig.10 and Fig.11 , Fig.10 and Fig.11 They are respectively schematic diagrams of another page rendering method provided in an embodiment of the present application.

[0234] like Fig.10 As shown, when building the code, the developer of the client defines all the pages involved in the client, defines the pages with frequent data changes as dynamic pages, and defines the pages with infrequent data changes as static pages, and forms a configuration file. For all static pages, these static pages are pre-rendered, packaged to form a static file package, and the static file package includes the rendering data of the pre-rendered static pages. For all dynamic pages, pre-configured template files and page data are packaged to form a Nodejs code file package, and the Nodejs code file package includes pre-configured template files and page data. Then, the developer of the client deploys the static file package to the WEB application server and deploys the Nodejs code file package to the Nodejs application server. In addition, the developer of the client also stores the configuration file in the Nginx gateway server.

[0235] like Fig.11 As shown, the user initiates a rendering request for the target page through the client, and the rendering request is an Http request. After the Http request reaches the gateway server, the gateway server determines the server that performs the rendering based on the configuration file and the Http request. If the gateway server determines that the WEB application server performs the rendering, the Http request is forwarded to the WEB application server, and the WEB application server determines the rendering data of the target page based on the static file package, and returns the rendering data of the target page in the original path. If the gateway server determines that the Nodejs application server performs the rendering, the Http request is forwarded to the Nodejs application server, and the Nodejs application server renders the target page in real time based on the Nodejs code file package, and returns the rendering data of the target page in the original path. Among them, the rendering data of the target page is an HTML file.

[0236] It should be understood that, although each step in the flowcharts involved in the above-mentioned embodiments is displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0237] Another point that needs to be explained is that the above embodiment introduces and explains the page rendering method provided by the embodiment of the present application from the perspective of the client, the gateway server, and the interaction of multiple servers. In practical applications, the steps performed by the client in the above embodiment can be implemented separately as a page rendering method on the client side; the steps performed by the gateway server in the above embodiment can be implemented separately as a page rendering method on the gateway server side; the steps performed by the target server in the above embodiment can be implemented separately as a page rendering method on the target server side.

[0238] For example, taking the page rendering method applied to a gateway server as an example, the steps performed by the gateway server in the above embodiment can be implemented as a page rendering method on the gateway server side. Fig.12 As shown, the page rendering method provided in the embodiment of the present application may include the following steps:

[0239] Step 1210: In response to a rendering request for a target page, determine a page type of the target page according to the rendering request;

[0240] Step 1220: Determine a target server that matches the page type from multiple servers;

[0241] Step 1230: Send a rendering request to the target server;

[0242] Step 1240: In response to the rendering data corresponding to the rendering request, send the rendering data.

[0243] In some embodiments, the above step 1210 includes:

[0244] According to the rendering request, determine the page type of the target page in the configuration file;

[0245] The configuration file includes page types of multiple pages.

[0246] In some embodiments, the plurality of servers include a first server and a second server, the first server being used to render static pages, and the second server being used to render dynamic pages.

[0247] In some embodiments, the page rendering method further includes:

[0248] Monitoring a first rendering traffic of a first server;

[0249] If the first rendering traffic is greater than the first preset traffic, the second server is used as the target server;

[0250] If the first rendering traffic is less than the first preset traffic, the page type of the target page is determined according to the rendering request; and a target server matching the page type is determined from a plurality of servers.

[0251] In some embodiments, the page rendering method further includes:

[0252] receiving second indication information from the second server, where the second indication information is used to indicate a static page corresponding to the rendering data;

[0253] If the first rendering traffic is greater than the first preset traffic, and the target page is a static page, the target server is determined from the multiple servers according to the second indication information; wherein, if the static pages indicated by the second indication information include the target page, the second server is used as the target server; if the static pages indicated by the second indication information do not include the target page, the first server is used as the target server;

[0254] If the first rendering traffic is greater than the first preset traffic and the target page is a dynamic page, the second server is used as the target server.

[0255] In some embodiments, the page rendering method further includes:

[0256] Monitoring the second rendering traffic of the second server;

[0257] If the second rendering traffic is greater than the second preset traffic, the first server is used as the target server;

[0258] If the second rendering traffic is less than the second preset traffic, the page type of the target page is determined according to the rendering request; and a target server matching the page type is determined from a plurality of servers.

[0259] In some embodiments, the page rendering method further includes:

[0260] Receiving first indication information from a first server, where the first indication information is used to indicate a dynamic page corresponding to the rendering data;

[0261] If the second rendering traffic is greater than the second preset traffic, and the target page is a static page, the first server is used as the target server;

[0262] If the second rendering traffic is greater than the second preset traffic and the target page is a dynamic page, the target server is determined from multiple servers according to the first indication information; if the dynamic page indicated by the first indication information includes the target page, the first server is used as the target server; if the dynamic page indicated by the first indication information does not include the target page, the second server is used as the target server.

[0263] Based on the same inventive concept, the embodiment of the present application also provides a page rendering device for implementing the page rendering method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the embodiments of one or more page rendering devices provided below can refer to the limitations of the page rendering method above, and the specific limitations will not be repeated here.

[0264] This embodiment also provides a page rendering device, which can be integrated into a gateway server. Fig.13 As shown, the page rendering device may include:

[0265] A first determining unit 1310 is configured to, in response to a rendering request for a target page, determine a page type of the target page according to the rendering request;

[0266] The second determining unit 1320 is used to determine a target server matching the page type from multiple servers;

[0267] A first sending unit 1330 is configured to send the rendering request to the target server;

[0268] The second sending unit 1340 is configured to send the rendering data in response to the rendering data corresponding to the rendering request.

[0269] The above-mentioned page rendering device responds to the rendering request of the client for the target page, determines the page type of the target page, and then determines the target server that matches the page type of the target page from multiple servers, and sends a rendering request to the target server, so that the target server determines the rendering data of the target page according to the rendering request, and then returns the rendering data of the target page to the client in the original path, so that the client displays the target page. First, the embodiment of the present application performs page rendering by setting up a server, without the need for the client to execute JavaScript scripts, which can reduce user waiting time and improve user experience. In addition, the embodiment of the present application sets up multiple servers, and according to the different types of pages requested for rendering, the page rendering device selects a target server that matches the page type from multiple servers to obtain the rendering data of the target page, which can achieve independent page rendering of different page types, and can select an adaptive page rendering method for each page type, to make up for the defects of a single page rendering method, so as to obtain the rendering data of the target page faster.

[0270] In some embodiments, the first determining unit 1310 is further configured to:

[0271] In response to the rendering request of the client for the target page, determining the page type of the target page in a configuration file according to the rendering request;

[0272] The configuration file includes the page types of multiple pages.

[0273] In some embodiments, the multiple servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages; the second determination unit 1320 is also used to: if the target page is the static page, determine the first server as the target server; if the target page is the dynamic page, determine the second server as the target server.

[0274] In some embodiments, the plurality of servers include a first server and a second server, wherein the first server is used to render static pages, and the second server is used to render dynamic pages; Fig.14As shown, the page rendering device also includes a first monitoring unit 1350, which is used to: monitor the first rendering traffic of the first server; the second determination unit 1320 is also used to: if the first rendering traffic is greater than the first preset traffic, use the second server as the target server; if the first rendering traffic is less than the first preset traffic, determine the page type of the target page according to the rendering request; and determine the target server that matches the page type of the target page from the multiple servers.

[0275] In some embodiments, Fig.14 As shown, the page rendering device also includes a first receiving unit 1360, which is used to: receive second indication information from the second server, the second indication information is used to indicate the static page corresponding to the rendering data stored in the second server; the second determining unit 1320 is also used to: if the first rendering traffic is greater than the first preset traffic, and the target page is the static page, then according to the second indication information, determine the target server from the multiple servers; wherein, if the static page indicated by the second indication information includes the target page, the second server is used as the target server; if the static page indicated by the second indication information does not include the target page, the first server is used as the target server; if the first rendering traffic is greater than the first preset traffic, and the target page is the dynamic page, the second server is used as the target server.

[0276] In some embodiments, the plurality of servers include a first server and a second server, wherein the first server is used to render static pages, and the second server is used to render dynamic pages; Fig.14 As shown, the page rendering device also includes a second monitoring unit 1370, which is used to: monitor the second rendering traffic of the second server; the second determination unit 1320 is also used to: if the second rendering traffic is greater than the second preset traffic, use the first server as the target server; if the second rendering traffic is less than the second preset traffic, determine the page type of the target page according to the rendering request; and determine the target server that matches the page type of the target page from the multiple servers.

[0277] In some embodiments, Fig.14As shown, the page rendering device also includes a second receiving unit 1380, which is used to: receive first indication information from the first server, wherein the first indication information is used to indicate the dynamic page corresponding to the rendering data stored in the first server; the second determining unit 1320 is also used to: if the second rendering traffic is greater than the second preset traffic, and the target page is the static page, then the first server is used as the target server; if the second rendering traffic is greater than the second preset traffic, and the target page is the dynamic page, then according to the first indication information, the target server is determined from the multiple servers; wherein, if the dynamic page indicated by the first indication information includes the target page, the first server is used as the target server; if the dynamic page indicated by the first indication information does not include the target page, the second server is used as the target server.

[0278] Based on the same inventive concept, the embodiment of the present application further provides a computer device, which may be a server, and includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned page rendering method when executing the computer program. Thereby, various functions are realized, for example:

[0279] In response to a rendering request for a target page, determining a page type of the target page according to the rendering request;

[0280] Determining, from a plurality of servers, a target server that matches the page type of the target page;

[0281] Sending the rendering request to the target server;

[0282] In response to rendering data corresponding to the rendering request, the rendering data is sent.

[0283] The above-mentioned computer device responds to the rendering request of the target page by the client, determines the page type of the target page, and then determines the target server that matches the page type of the target page from multiple servers, and sends a rendering request to the target server, so that the target server obtains the rendering data of the target page according to the rendering request, and then returns the rendering data of the target page to the client in the original path, so that the client displays the target page. First, the embodiment of the present application performs page rendering by setting a server, without the need for the client to execute JavaScript scripts, which can reduce user waiting time and improve user experience. In addition, the embodiment of the present application sets multiple servers, and according to the different types of pages requested for rendering, the computer device selects a target server that matches the page type from multiple servers to obtain the rendering data of the target page, which can achieve independent page rendering of different page types, and can select an adapted page rendering method for each page type, to make up for the defects of a single page rendering method, so as to obtain the rendering data of the target page faster.

[0284] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0285] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0286] Since the computer program stored in the computer-readable storage medium can execute any one of the page rendering methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the page rendering methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0287] Based on the same inventive concept, the embodiment of the present application further provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations in the above embodiments.

[0288] It should be noted that the object data (including but not limited to user device information, user personal information, etc.) and conversation data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods.

[0289] Any reference to the memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (Re RAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0290] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0291] In the above-mentioned embodiments of the page rendering method, apparatus, computer device, and storage medium, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the above-mentioned page rendering method, apparatus, computer device, storage medium, and their corresponding units can refer to the description of the page rendering method in the above embodiment, and will not be repeated here.

[0292] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0293] The above is a detailed introduction to a page rendering method, device, computer equipment and storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A page rendering method, characterized in that: The method comprises: In response to a rendering request for a target page, determining a page type of the target page according to the rendering request; Determine a target server matching the page type from among multiple servers; Sending the rendering request to the target server; In response to rendering data corresponding to the rendering request, the rendering data is sent.

2. The method according to claim 1, characterized in that The step of responding to a rendering request for a target page and determining a page type of the target page according to the rendering request includes: According to the rendering request, determining the page type of the target page in a configuration file; The configuration file includes the page types of multiple pages.

3. The method according to claim 1, characterized in that The multiple servers include a first server and a second server, the first server is used to render static pages, and the second server is used to render dynamic pages.

4. The method according to claim 3, characterized in that The method further comprises: Monitoring a first rendering traffic of the first server; If the first rendering traffic is greater than the first preset traffic, taking the second server as the target server; If the first rendering traffic is less than the first preset traffic, determining the page type of the target page according to the rendering request; and determining the target server matching the page type from the multiple servers.

5. The method according to claim 4, characterized in that The method further comprises: receiving second indication information from the second server, where the second indication information is used to indicate the static page corresponding to the rendering data; If the first rendering traffic is greater than the first preset traffic, and the target page is the static page, determining the target server from the multiple servers according to the second indication information; wherein, if the static pages indicated by the second indication information include the target page, the second server is used as the target server; if the static pages indicated by the second indication information do not include the target page, the first server is used as the target server; If the first rendering traffic is greater than the first preset traffic, and the target page is the dynamic page, the second server is used as the target server.

6. The method according to claim 3, characterized in that The method further comprises: Monitoring the second rendering traffic of the second server; If the second rendering traffic is greater than a second preset traffic, taking the first server as the target server; If the second rendering traffic is less than the second preset traffic, determining the page type of the target page according to the rendering request; and determining the target server matching the page type from the multiple servers.

7. The method according to claim 6, characterized in that The method further comprises: receiving first indication information from the first server, where the first indication information is used to indicate the dynamic page corresponding to the rendering data; If the second rendering traffic is greater than the second preset traffic, and the target page is the static page, taking the first server as the target server; If the second rendering traffic is greater than the second preset traffic, and the target page is the dynamic page, the target server is determined from the multiple servers according to the first indication information; wherein, if the dynamic page indicated by the first indication information includes the target page, the first server is used as the target server; if the dynamic page indicated by the first indication information does not include the target page, the second server is used as the target server.

8. A page rendering device, characterized in that: The device comprises: A first determining unit, configured to, in response to a rendering request for a target page, determine a page type of the target page according to the rendering request; A second determining unit is used to determine a target server matching the page type from a plurality of servers; A first sending unit, configured to send the rendering request to the target server; The second sending unit is used to send the rendering data in response to the rendering data corresponding to the rendering request.

9. A computer device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the page rendering method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the page rendering method according to any one of claims 1 to 7.