Page rendering method and device, electronic device and storage medium
By monitoring the performance of the client and server side in real time and dynamically selecting the rendering method, the problems of slow loading speed in client rendering mode and server pressure in server rendering mode are solved, efficient switching of page rendering is achieved, and the overall user experience is improved .
Patent Information
- Application Number
- CN202110042847.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-13
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-01-13
AI Technical Summary
In the prior art, the client rendering mode causes slow loading of the whole page and long waiting time for white screens, and server rendering increases the pressure of server access, making it impossible to effectively utilize the browser rendering capabilities, resulting in slow page switching.
By monitoring the performance of the client and server in real time, dynamically selecting the server-side rendering method or client-side rendering method, setting the rendering switch according to the historical rendering duration, interface delay and server pressure indicators to ensure the optimal efficiency of page rendering.
It takes into account the full page loading efficiency and page switching speed, reduces the overhead of static resource transmission, reduces server pressure, and improves user experience.
Smart Images

Figure CN112749358B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page rendering method and device, an electronic device, and a storage medium. Background Art
[0002] With the rapid development of the Internet, the transmission speed has greatly increased, the user experience has become more important, the front-end page logic has become more and more complex, and the corresponding professional requirements for front-end development have become higher and higher. The front-end and back-end separation mode can effectively achieve the decoupling of the front-end and back-end, making the front-end development independent from the back-end engineering, and the front-end personnel can focus on the implementation of the page. With the rapid development of front-end engineering, the three major front-end frameworks Vue / React / Angular have been widely used. These frameworks all use the client-side rendering mode, that is, the page is rendered on the browser side.
[0003] In client rendering mode, when accessing a page, you need to wait for the browser to download the framework file, business code and static resources and complete the loading before starting the page rendering work. There are problems such as slow loading of the entire page and long waiting time for the white screen. At the same time, the client rendering efficiency is seriously dependent on the client and browser performance. In some devices or browsers with poor performance, the rendering efficiency will be greatly reduced.
[0004] In order to solve the performance bottleneck of page access and improve user experience, the industry generally adopts server-side rendering to solve these problems. Each time a page is requested, the page is rendered on the server side and the rendered page is sent back to the browser for display. This solution can indeed solve the performance overhead problem caused by waiting for resource transmission and realize the decoupling of client and browser performance. However, it increases the server access pressure, and the browser rendering capability cannot be effectively used when switching routes, resulting in slow page switching. Summary of the invention
[0005] In view of the problems in the prior art, the present invention provides a page rendering method and device, an electronic device and a storage medium, which can at least partially solve the problems in the prior art.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] In a first aspect, a page rendering method is provided, comprising:
[0008] Get the page loading request sent by the client;
[0009] Select server-side rendering or client-side rendering based on the real-time monitoring results of client performance and server performance;
[0010] If the server-side rendering mode is selected, the page loading request and the rendering mode identifier or the server-side rendering instruction are sent to the server;
[0011] If the client rendering mode is selected, the page loading request and the rendering mode identifier are sent to the server, and the rendering mode identifier or the client rendering instruction is sent to the client.
[0012] Furthermore, the real-time monitoring result of the client performance is the historical page rendering time within a preset period; the real-time monitoring result of the server performance includes: the historical interface delay and the historical server pressure within the preset period.
[0013] Furthermore, the historical server pressure is obtained based on the CPU index, memory index and IO index within a preset time period.
[0014] Furthermore, the historical server pressure is obtained by weighted average of the CPU occupancy rate, memory occupancy rate, and IO read and write speed within a preset time period.
[0015] Further, the server-side rendering mode or the client-side rendering mode is selected according to the client-side performance real-time monitoring result and the server-side performance real-time monitoring result, including:
[0016] Get the average rendering time based on the historical page rendering time within a preset period;
[0017] The average interface delay is obtained according to the historical interface delay in a preset period;
[0018] Determine whether the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time;
[0019] When the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time, the server-side rendering method is selected;
[0020] When the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is not less than the average rendering time, the client rendering mode is selected.
[0021] Furthermore, the preset coefficient is obtained according to the number of rendering strokes of the server and the total number of rendering strokes.
[0022] Furthermore, the page rendering method also includes:
[0023] Monitor client performance and server performance in real time.
[0024] In a second aspect, a page rendering device is provided, comprising:
[0025] The page loading request acquisition module acquires the page loading request sent by the client;
[0026] A rendering mode selection module selects server-side rendering mode or client-side rendering mode according to the real-time monitoring results of client performance and server performance;
[0027] A first sending module, if the server rendering mode is selected, sends the page loading request and the rendering mode identifier or the server rendering instruction to the server;
[0028] The second sending module sends the page loading request and the rendering mode identifier to the server if the client rendering is selected, and sends the rendering mode identifier or the client rendering instruction to the client.
[0029] According to a third aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned page rendering method when executing the program.
[0030] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned page rendering method are implemented.
[0031] The present invention provides a page rendering method and device, an electronic device and a storage medium, which are applicable to the financial field. The method includes: obtaining a page loading request sent by a client; selecting a server-side rendering mode or a client-side rendering mode according to the real-time monitoring results of the client performance and the real-time monitoring results of the server performance; if the server-side rendering mode is selected, the page loading request and the rendering mode identifier or the server-side rendering instruction are sent to the server; if the client-side rendering mode is selected, the page loading request and the rendering mode identifier are sent to the server, and the rendering mode identifier or the client-side rendering instruction is sent to the client. Among them, by real-time monitoring of the client performance and the server performance, the rendering end is dynamically selected according to the client performance and the server performance, which can take into account the server access pressure, page switching speed and rendering efficiency.
[0032] In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0034] Figure 1 The application scenario architecture of the embodiment of the present invention is shown in FIG. Figure 1 ;
[0035] Figure 2 The application scenario architecture of the embodiment of the present invention is shown in FIG. Figure 2 ;
[0036] Figure 3 is a flow chart of a page rendering method in an embodiment of the present invention;
[0037] Figure 4 It is a schematic diagram of the internal structure of a rendering device on a client for implementing page rendering;
[0038] Figure 5 It is a schematic diagram of the internal structure of a rendering device 2 on the server side for implementing page rendering;
[0039] Figure 6 is a schematic diagram of the internal structure of the response detection device 4;
[0040] Figure 7 is a schematic diagram of the internal structure of the pressure monitoring device 5;
[0041] Figure 8 The specific steps of step S200 in the embodiment of the present invention are shown;
[0042] Fig. 9 The processing flow of a page loading request in an embodiment of the present invention is shown;
[0043] Fig.10 is a structural block diagram of a page rendering device in an embodiment of the present invention;
[0044] Fig.11 A structural block diagram of a rendering mode selection module in an embodiment of the present invention is shown;
[0045] Fig.12 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0047] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0048] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatuses.
[0049] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0050] Figure 1 The application scenario architecture of the embodiment of the present invention is shown in FIG. Figure 1 , see Figure 1 , the server S1 can be connected to at least one client device B1 in communication, the client device B1 can send a page loading request to the server S1, and the server S1 can receive the page loading request online. The server S1 can pre-process the obtained page loading request online or offline, and select the server rendering mode or the client rendering mode according to the real-time monitoring results of the client B1 performance and the server device S2 performance; if the server rendering mode is selected, the page loading request and the rendering mode identifier or the server rendering instruction are sent to the server device S2; if the client rendering mode is selected, the page loading request and the rendering mode identifier are sent to the server device S2, and the rendering mode identifier or the client rendering instruction is sent to the client device B1.
[0051] Also, see Figure 2 , the server S1 and the server device S2 can be implemented by the same server, namely the server device S.
[0052] It is understandable that the client device B1 may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.
[0053] The service-side device, the server and the client device may communicate using any suitable network protocol, including network protocols that have not yet been developed on the date of filing this application. The network protocols may include, for example, TCP / IP protocol, UDP / IP protocol, HTTP protocol, HTTPS protocol, etc. Of course, the network protocols may also include, for example, RPC protocol (Remote Procedure Call Protocol) and REST protocol (Representational State Transfer) used on top of the above protocols.
[0054] Figure 3 is a flow chart of a page rendering method in an embodiment of the present invention; Figure 3 As shown, the page rendering method may include the following contents:
[0055] Step S100: Obtaining a page loading request sent by a client;
[0056] Step S200: selecting a server-side rendering mode or a client-side rendering mode according to the client-side performance real-time monitoring result and the server-side performance real-time monitoring result;
[0057] If the server-side rendering method is selected, execute step S300; if the client-side rendering method is selected, execute step S400.
[0058] Specifically, by pre-setting monitoring programs on the client and the server, the performance is monitored in real time. Specifically, the monitored performance includes: the historical rendering speed of the client, the historical interface transmission delay of the server, and the server pressure index, etc.
[0059] Step S300: if the server-side rendering mode is selected, the page loading request and the rendering mode identifier or the server-side rendering instruction are sent to the server;
[0060] Specifically, when the server-side rendering mode is selected, when the page loading request is sent to the server, the rendering mode identifier or server-side rendering instruction is also sent to the server so that the server knows that it will render the page, and then obtains static resources according to the page loading request, renders it, and finally sends the rendered page to the client, and the client's browser directly loads the rendered page.
[0061] Step S400: If the client rendering mode is selected, the page loading request and the rendering mode identifier are sent to the server, and the rendering mode identifier or the client rendering instruction is sent to the client.
[0062] Specifically, when the client rendering mode is selected, when the page loading request is sent to the server, the rendering mode identifier is also sent to the server so that the server knows that the page is rendered by the client, and then sends the corresponding static resources to the client according to the page loading request, and the client renders according to the received data.
[0063] By adopting the above technical solution, the efficiency of whole page loading and page switching can be taken into account. According to the client rendering speed and server pressure index, the server rendering switch can be set, and the rendering mode can be dynamically adjusted to switch page rendering between the client and the server to ensure optimal efficiency.
[0064] In the specific implementation, through framework transformation, a set of compatibility processing modules are built into the server and client to ensure code isomorphism, so that a set of source code can run on both the client and the server.
[0065] The page rendering method provided in the embodiment of the present invention solves the problems of long resource downloading time caused by client-side rendering, serious dependence on browser processing speed, and high service access pressure caused by server-side rendering. Based on isomorphic technology, it supports running the original front-end page code on the server side, and dynamically switches the rendering mode according to the client's historical rendering speed, historical interface transmission delay and server pressure index, so that page rendering can be switched between the client and the server to ensure optimal efficiency.
[0066] A NODE.JS server cloud node can be added to the deployment architecture to execute the dynamic rendering technology provided by the embodiment of the present invention, and a page isomorphic rendering program can be added to the server side, so that the front-end code originally rendered in the browser can be rendered on the server side. Secondly, when the client's processing performance decreases due to device or browser reasons, the rendering step is switched to the server side to complete, which can effectively reduce the overhead caused by static resource transmission and loading, and improve the page display rate; when the server is under too much pressure due to too many requests and the return page delay increases significantly, the page rendering is switched to the browser to complete, and the page is partially replaced and rendered to improve access efficiency.
[0067] In an optional embodiment, when the server renders a page, it generates a unique instance for the user's page loading request to avoid data pollution and state pollution caused by concurrent access by multiple users. At the same time, it parses and loads the front-end page code and renders the framework code, page code and style code into HTML.
[0068] In an optional embodiment, when the client renders the page, the framework code is rendered as html, the Vue instance is mounted on the specified html tag, the static string is activated as a dynamic DOM, and the static resources are injected into the DOM tree to complete the page display.
[0069] Figure 4 It is a schematic diagram of the internal structure of the rendering device on the client for implementing page rendering, such as Figure 4 As shown, the client rendering device 1 includes: a framework code parsing unit 11, an instance mounting unit 12 and a static resource injection unit 13, wherein:
[0070] Framework code parsing unit 11: parses the framework code and business logic, and converts the framework and business code into HTML;
[0071] Example Mounting Unit 12: Mounting HTML into the browser's DOM tree
[0072] Static resource injection unit 13: Load the style, merge it with the DOM tree, and display it on the page.
[0073] Figure 5 is a schematic diagram of the internal structure of a rendering device 2 on the server side for implementing page rendering, such as Figure 5 As shown, the server-side rendering device 2 includes: an instance creation unit 21, a data pre-fetching unit 22 and a framework code parsing unit 23, wherein:
[0074] Instance creation unit 21: creates an instance for each request and performs state isolation.
[0075] Data pre-fetching unit 22: in case of large amount of data, pre-fetches data from the application server and injects it into the page.
[0076] Framework code parsing unit 23: parse the framework code and business logic, and render the code into HTML
[0077] In an optional embodiment, the page rendering method may further include: real-time monitoring of client performance and server performance.
[0078] In an optional embodiment, the client performance real-time monitoring result is the historical page rendering time within a preset time period; the server performance real-time monitoring result includes: historical interface delay and historical server pressure within the preset time period.
[0079] It is worth noting that the server pressure is obtained based on the CPU index, memory index and IO index within the preset time period.
[0080] Specifically, the response detection device can be used to track and record the time from the browser downloading static resources to the completion of page loading in the client, and the page return interface after rendering on the server can be tracked and detected to record its return delay. The performance indicators of the server can be monitored through the pressure monitoring device.
[0081] Figure 6is a schematic diagram of the internal structure of the response detection device 4, such as Figure 6 As shown, the response detection device 4 includes a loading duration recording unit 41 and an interface duration recording unit 42, wherein:
[0082] The loading duration recording unit 41 is used to record the loading duration of the client page rendering, including the overall time from the download of static resources to the display of the page, that is, the page rendering duration.
[0083] The interface duration recording unit 42 is used to record the delay of the server returning the page, namely the interface delay.
[0084] Figure 7 is a schematic diagram of the internal structure of the pressure monitoring device 5, such as Figure 7 As shown, the dynamic decision device 2 includes a CPU monitoring unit 51, a memory monitoring unit 52, and a disk IO monitoring unit 53, wherein:
[0085] CPU monitoring unit 51: monitors server CPU indicators.
[0086] Memory monitoring unit 52: monitors server memory indicators.
[0087] Disk IO monitoring unit 53: monitors server IO indicators.
[0088] It is worth noting that the CPU indicator can be the CPU usage; the memory indicator can be the memory usage; and the IO indicator can be the read and write speed.
[0089] The server pressure can be obtained by weightedly averaging the CPU usage, memory usage, and IO read and write speeds within a preset period of time.
[0090] In an alternative embodiment, see Figure 8 , the step S200 may include the following contents:
[0091] Step S210: obtaining an average rendering time according to the historical page rendering time within a preset period;
[0092] Among them, since the monitoring is continuous, the monitoring results are data within a period of time. The rendering time of each page is averaged to obtain the average rendering time.
[0093] Step S220: Obtaining an average interface delay according to historical interface delays within a preset period of time;
[0094] Since the monitoring is continuous, the monitoring result is the data within a period of time. The average of the delays of various interfaces is calculated to obtain the average interface delay.
[0095] Step S230: Determine whether the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time;
[0096] Specifically, average rendering time = sum of the last 10 rendering times / 10;
[0097] Average delay = sum of the most recent 10 interface delays / 10;
[0098] The judgment formula is as follows: average rendering time > average interface delay + preset coefficient × server pressure.
[0099] It is worth noting that the initial value of the preset coefficient can be 0.5, and can be flexibly adjusted by the operation and maintenance personnel according to the specific actual conditions and needs such as the number of server renderings and the total number of renderings. For example, it can be adjusted to 0.3-0.8, such as 0.7, 0.6, 0.4, or even to 0.2 or 0.9 in special circumstances. The embodiment of the present invention does not limit this.
[0100] If the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time, execute step S240; if the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is not less than the average rendering time, execute step S250.
[0101] Step S240: Select a server-side rendering mode;
[0102] Step S250: Select a client rendering method.
[0103] Fig. 9 The processing flow of a page loading request in an embodiment of the present invention is shown in FIG. Fig. 9 , including the following:
[0104] First, the client initiates a page request; then, the dynamic decision-making device of the server that executes the page rendering method provided by the embodiment of the present invention determines which rendering mode to use. If server-side rendering is used, the server-side rendering device is started and page rendering begins; if client-side rendering is used, the client-side rendering device is started and page rendering begins, thereby completing the page display. After the server-side rendering is completed or the client-side rendering is completed, the response detection device performs detection, and the detection result is fed back to the dynamic decision-making device, wherein the pressure monitoring device detects the server-side pressure in real time and feeds back the result to the server-side rendering device. If server-side rendering is used, the server-side rendering device starts page rendering. The response detection device detects and records the latency indicator and feeds back.
[0105] It is worth noting that the pressure monitoring device and the response detection device can be part of the page rendering device provided in the embodiment of the present invention.
[0106] To sum up, the technology provided by the embodiment of the present invention solves the problem that the existing page rendering modes cannot be effectively combined to achieve the optimal rendering efficiency. By monitoring the client rendering speed, interface transmission delay and server pressure indicators, the rendering mode is dynamically switched, and the page rendering is switched between the client and the server to ensure the optimal display efficiency of the page.
[0107] 1. Multi-user concurrency has high performance and security. By instantiating the factory on the server, data pollution and state pollution caused by concurrent access by multiple users can be prevented.
[0108] 2. Ensure the smooth operation of the server, monitor the server performance pressure in real time, and promptly relieve the problem of excessive server pressure caused by high traffic.
[0109] 3. Maximize page access efficiency, eliminate the performance impact of devices and browsers, and reduce delays caused by network waiting.
[0110] Based on the same inventive concept, the embodiments of the present application also provide a page rendering device, which can be used to implement the method described in the above embodiments, as described in the following embodiments. Since the principle of solving the problem by the page rendering device is similar to that of the above method, the implementation of the page rendering device can refer to the implementation of the above method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements predetermined functions. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0111] Fig.10 is a structural block diagram of a page rendering device in an embodiment of the present invention. Fig.10 As shown, the page rendering device specifically includes: a page loading request acquisition module 10, a rendering mode selection module 20, a first sending module 30 and a second sending module 40.
[0112] The page loading request acquisition module 10 acquires the page loading request sent by the client;
[0113] The rendering mode selection module 20 selects a server-side rendering mode or a client-side rendering mode according to the real-time monitoring results of the client performance and the real-time monitoring results of the server performance;
[0114] A first sending module 30, if the server rendering mode is selected, sends the page loading request and the rendering mode identifier or the server rendering instruction to the server;
[0115] The second sending module 40 sends the page loading request and the rendering mode identifier to the server if the client rendering is selected, and sends the rendering mode identifier or the client rendering instruction to the client.
[0116] The page rendering device provided in the embodiment of the present invention solves the problems of long resource downloading time caused by client-side rendering, serious dependence on browser processing speed, and high service access pressure caused by server-side rendering. Based on isomorphic technology, it supports running the original front-end page code on the server side, and dynamically switches the rendering mode according to the client rendering speed, interface transmission delay and server pressure index, so that page rendering can be switched between the client and the server to ensure optimal efficiency.
[0117] In an optional embodiment, the real-time monitoring result of the client performance is the page rendering time; the real-time monitoring result of the server performance includes: interface delay and server pressure.
[0118] In an alternative embodiment, see Fig.11 The rendering mode selection module includes: a first mean value calculation unit 20a, a second mean value calculation unit 20b, a judgment unit 20c and a rendering mode selection unit 20d.
[0119] A first mean value calculation unit 20a, which obtains an average rendering time according to the page rendering time;
[0120] A second mean value calculation unit 20b, which obtains an average interface delay according to the interface delay;
[0121] A judging unit 20c, judging whether the sum of the server pressure multiplied by a preset coefficient and the average interface duration is less than the average rendering duration;
[0122] The rendering mode selection unit 20d selects the server-side rendering mode if the judgment is yes, and selects the client-side rendering mode otherwise.
[0123] The devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is an electronic device, and the electronic device may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0124] In a typical example, the electronic device specifically includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the above page rendering steps when executing the program.
[0125] Reference below Fig.12 , which shows a schematic structural diagram of an electronic device 600 suitable for implementing an embodiment of the present application.
[0126] like Fig.12 As shown, electronic device 600 includes a central processing unit (CPU) 601, which can perform various appropriate operations and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. In RAM 603, various programs and data required for the operation of system 600 are also stored. CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to bus 604.
[0127] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed as needed as the storage section 608.
[0128] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned page rendering steps when executed by a processor.
[0129] In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 609 , and / or installed from the removable medium 611 .
[0130] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0131] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0132] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0133] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0135] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0136] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0137] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0138] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0139] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A page rendering method, It is characterized in that include: Get the page loading request sent by the client; Select server-side rendering or client-side rendering based on the real-time monitoring results of client performance and server performance; If the server-side rendering mode is selected, the page loading request and the rendering mode identifier or the server-side rendering instruction are sent to the server; If the client rendering mode is selected, the page loading request and the rendering mode identifier are sent to the server, and the rendering mode identifier or the client rendering instruction is sent to the client; Wherein, selecting the server-side rendering mode or the client-side rendering mode according to the real-time monitoring result of the client performance and the real-time monitoring result of the server performance further includes: The historical page rendering time within a preset period is obtained according to the loading time recording unit built into the client to obtain the average rendering time; Obtain the historical interface delay within a preset period of time according to the built-in interface duration recording unit of the server to obtain the average interface delay; and obtain the historical server pressure according to the built-in pressure monitoring device of the server; Determine whether the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time; When the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time, the server-side rendering mode is selected; When the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is not less than the average rendering duration, the client rendering mode is selected.
2. The page rendering method according to claim 1, It is characterized in that The historical server pressure is obtained based on the CPU index, memory index and IO index within a preset time period.
3. The page rendering method according to claim 1, It is characterized in that The historical server pressure is obtained by weighted average of the CPU occupancy rate, memory occupancy rate and IO read and write speed within a preset time period.
4. The page rendering method according to claim 1, It is characterized in that The preset coefficient is obtained according to the number of rendering strokes on the server and the total number of rendering strokes.
5. The page rendering method according to claim 1, It is characterized in that Also includes: Monitor client performance and server performance in real time.
6. A page rendering device, It is characterized in that include: The page loading request acquisition module acquires the page loading request sent by the client; A rendering mode selection module selects server-side rendering mode or client-side rendering mode according to the real-time monitoring results of client performance and server performance; A first sending module, which sends the page loading request and the rendering mode identifier or the server-side rendering instruction to the server if the server-side rendering mode is selected; A second sending module, if client rendering is selected, sends the page loading request and the rendering mode identifier to the server, and sends the rendering mode identifier or the client rendering instruction to the client; The rendering mode selection module is further used to obtain the historical page rendering time within a preset period according to the loading time recording unit built into the client to obtain the average rendering time; The historical interface delay within a preset period is obtained according to the interface duration recording unit built into the server to obtain the average interface delay; Obtain historical server pressure according to a pressure monitoring device built into the server; determine whether the sum of the historical server pressure multiplied by a preset coefficient and the average interface delay is less than the average rendering time; When the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is less than the average rendering time, the server-side rendering mode is selected; when the sum of the historical server pressure multiplied by the preset coefficient and the average interface delay is not less than the average rendering time, the client-side rendering mode is selected.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps of the page rendering method described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the page rendering method described in any one of claims 1 to 5 are implemented.
