CN112182445A - Method and device for optimizing client page performance - Google Patents

Method and device for optimizing client page performance Download PDF

Info

Publication number
CN112182445A
CN112182445A CN201910590236.8A CN201910590236A CN112182445A CN 112182445 A CN112182445 A CN 112182445A CN 201910590236 A CN201910590236 A CN 201910590236A CN 112182445 A CN112182445 A CN 112182445A
Authority
CN
China
Prior art keywords
request
client
server
returning
response data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910590236.8A
Other languages
Chinese (zh)
Inventor
张腾飞
江浩
董涛
刘保帅
李婉菁
任宇
贠鹏
孙同生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910590236.8A priority Critical patent/CN112182445A/en
Publication of CN112182445A publication Critical patent/CN112182445A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method and a device for optimizing client page performance, and relates to the technical field of computers. One embodiment of the method comprises: merging request items sent by a client in a set time period into a request, and then sending the merged request to a server, wherein the request items are interactive requests sent by interactive components on the same interface of the client; and returning the response data of the server to the corresponding client. The implementation mode reduces the number of times of communication interaction between the client and the server and the data volume, thereby reducing the cost of the interaction between the client and the server, effectively solving the problem of frequent data requests of the client and the server in a short time, improving the communication efficiency between the client and the server and optimizing the performance of a client page.

Description

Method and device for optimizing client page performance
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for optimizing client page performance.
Background
At present, in web (network) development or mobile development, communication between a client and a server is more and more complex, data interaction between the client and the server is more and more frequent, so that performance of a client page is reduced, and how to improve response speed of communication is a hot problem of current research.
At present, the more commonly used technical schemes for optimizing the performance of the client page mainly include the following:
1) and (3) construction optimization of codes: improving the rendering speed of the page to optimize the performance of the page of the client by the coding technique;
2) static resource optimization: static resources mainly refer to pictures, a plurality of pictures are put into one large picture by using a picture Sprite (CSS Sprite), and a part of the picture is displayed by a CSS (Cascading Style Sheets) to optimize the client page performance;
3) delivery and network request optimization: when data returned by a server is received, optimizing the performance of a client page through a loading mode such as asynchronous loading or lazy loading;
4) caching by the browser: when the client page requests the resources of the server, the access can be accelerated by reading the data temporarily stored in the browser, so that the performance of the client page is optimized.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
although there are many ways to optimize the client page at present, there are various defects:
1) and (3) construction optimization of codes: optimization of page rendering speed relies to a large extent on the programmer's personal programming quality, but this approach tends to be less effective when dealing with front-end and back-end data communication scenarios;
2) static resource optimization: the method mainly processes pictures, so the optimization mode has a limited use range;
3) delivery and network request optimization: the method only performs processing when the data of the server returns, such as asynchronous loading, lazy loading and the like, and the method has the effect of optimizing the page of the client to a certain extent, but the method only performs operation when the data of the server returns, and cannot essentially optimize the performance of the page of the client;
4) caching by the browser: the strategy of utilizing the browser cache can reduce the response speed of the client page in some cases, but the cache has no cleaning mechanism, the cached files can be permanently stored on the machine, when the previous web pages are not needed to be browsed, the files become invalid or useless files, the files only occupy space and are useless when being stored in the hard disk of a user, and the hard disk space is greatly wasted.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for optimizing a client page performance, which can reduce the number of times of communication interaction between a client and a server and data amount, thereby reducing the cost of the client and the server interaction, effectively solving the problem of frequent data requests by the client and the server in a short time, improving the communication efficiency between the client and the server, and optimizing the performance of the client page.
To achieve the above object, according to an aspect of an embodiment of the present invention, a method for optimizing performance of a client page is provided.
A method of optimizing client page performance, comprising: merging request items sent by a client in a set time period into a request, and then sending the merged request to a server, wherein the request items are interactive requests sent by interactive components on the same interface of the client; and returning the response data of the server to the corresponding client.
Optionally, merging the request items sent by the client in the set time period into one request includes: and carrying out deduplication on the request items sent by the client in the set time period, and combining the deduplicated request items into one request.
Optionally, before sending the merged request to the server, the method further includes: establishing an incidence relation between the client and the request item; and, returning the response data of the server to the corresponding client comprises: and returning the response data of the server to the corresponding client according to the incidence relation.
Optionally, before sending the merged request to the server, the method further includes: establishing an index for the request item sent by each client; and, returning the response data of the server to the corresponding client comprises: and returning the response data of the server to each client according to the index and a preset rule.
Optionally, request item merging is performed by establishing a request pool, and response data is returned to the corresponding client.
According to another aspect of the embodiments of the present invention, an apparatus for optimizing the performance of a client page is provided.
An apparatus for optimizing client page performance, comprising: the request merging module is used for merging request items sent by a client side in a set time period into a request and then sending the merged request to a server side, wherein the request items are interactive requests sent by interactive components under the same interface of the client side; and the response returning module is used for returning the response data of the server to the corresponding client.
Optionally, the request merging module is further configured to: and carrying out deduplication on the request items sent by the client in the set time period, and combining the deduplicated request items into one request.
Optionally, the method further includes an association establishing module, configured to: before sending the merged request to the server, establishing an association relationship between the client and the request item; and the response returning module is further used for: and returning the response data of the server to the corresponding client according to the incidence relation.
Optionally, the apparatus further includes an index establishing module, configured to: before sending the merged request to the server, establishing an index for the request item sent by each client; and the response returning module is further used for: and returning the response data of the server to each client according to the index and a preset rule.
Optionally, request item merging is performed by establishing a request pool, and response data is returned to the corresponding client.
According to another aspect of the embodiment of the invention, an electronic device for optimizing the performance of a client page is provided.
An electronic device that optimizes client page performance, comprising: one or more processors; the storage device is used for storing one or more programs which, when executed by the one or more processors, enable the one or more processors to implement the method for optimizing the performance of the client page provided by the embodiment of the invention.
According to yet another aspect of embodiments of the present invention, a computer-readable medium is provided.
A computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method for optimizing client page performance provided by an embodiment of the invention.
One embodiment of the above invention has the following advantages or benefits: merging request items sent by a client in a set time period into a request, and then sending the merged request to a server; the response data of the server is returned to the corresponding client, so that the times of communication interaction between the client and the server are reduced, the cost of interaction between the client and the server is reduced, and the problem of frequent data requests of the client and the server in a short time is effectively solved; by removing the duplicate of the request items sent by the client and combining the request items after the duplicate removal into one request, the total loading time of the client can be reduced, and the repeated requests are prevented from being added in the request queue, so that the data volume of the communication interaction between the client and the server is reduced, the communication efficiency between the client and the server is further improved, the page performance of the client is optimized, and the response capability of the server is improved; the reusability of the request pool is greatly improved by establishing the association relationship between the request items and the clients and the index of the request item corresponding to each client, and each component of the client page can directly use the request pool to improve the performance of the client page.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a method for optimizing the performance of a client page according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a conventional data request process between a client and a server;
FIG. 3 is a diagram illustrating a data request process of a client and a server based on Ajax pools according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an initialization process of Ajax pools, according to an embodiment of the invention;
FIG. 5 is a schematic diagram of request entry merging performed by the Ajax pool according to one embodiment of the present invention;
FIG. 6 is a schematic diagram of the main modules of an apparatus for optimizing client page performance according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The research shows that: the most satisfactory time to open a web page is 2-5 seconds, and if waiting more than 10 seconds, 99% of users will close the web page. A set of data is listed below to demonstrate: the Google website access speed can cause the user search request to drop by 0.59% every 400 ms; amazon websites will result in a 1% reduction in revenue per 100ms increase in website latency; yahoo would have a 400ms web site delay that would result in a 5-9% drop in traffic, and so on. Therefore, the loading speed of the website seriously influences the user experience and determines the life and death of the webpage.
However, in the prior art, when a web page is accessed, only 10% -20% of the request response time is spent on downloading html (hypertext Markup Language) documents of the web page, and the rest 80% -90% of the request response time is spent on all component data in the downloaded web page.
Aiming at the current situation, the invention researches and researches the commonly used technology for optimizing the page performance of the client, and the following four technologies are mainly adopted:
1) code build optimization
The code construction optimization measures are many, and the primary purpose is to reduce the time of the code analysis operation of the client, including: the method comprises the following steps of using a 'cutting-the-mustard (meeting a standard technology and proposed by a BBC News developer blog, a technology for detecting the support degree of the browser based on the characteristics of the browser and selecting which functions need to be loaded according to the support degree, outputting only core function codes for an old browser, outputting enhanced function codes for a modern browser), a' mode, reducing the cost of resolving JavaScript, limiting the use of third-party scripts, rendering at a server end and the like;
2) static resource optimization
Mainly reducing the loading time of static resources, mainly including html, css (Cascading Style Sheets), js (javascript) and picture files, the loading time of static resources is the bottleneck (especially picture files) of the maximum performance of the client, and the current optimization means is also abundant, and the following briefly lists several commonly used methods:
a) combining the cs files and the js files to reduce the times of http (Hypertext Transfer Protocol) requests and save network request time;
b) static resource cdn (Content Delivery Network) distribution: the client can load static resources through the optimal network link;
c) js and css file compression, picture compression and gzip (GNUzip is a file compression program of GNU free software. ) Compression, etc. to reduce the amount of data requested back;
d) look-up of weighing dns (Domain Name System ): the number of times of searching for the dns is reduced as much as possible, when the dns cache of the client is empty, the number of times of searching for the dns is equal to the number of unique host names in the web page, so that the number of times of searching for the dns can be reduced by reducing the number of unique host names;
3) delivery and network request optimization
The delivery optimization mainly comprises asynchronous loading and lazy loading, the network request optimization way is to reduce the http request times, combine and compress resources, set the http cache, and disperse the website content to a plurality of servers in different regional positions by using a content distribution network (cdn) to accelerate the downloading speed;
4) rational utilization of browser cache
The browser cache (Brower Caching) is that the browser stores the document which is requested by the user recently in a local disk, and when the visitor accesses the same page again, the browser can load the document from the local disk directly. That is, after receiving a request of a user, the browser will store the path of the request and the returned response result in the cache, and when sending the same request next time, the browser will take the data out of the cache, thereby improving the response speed of the page and the user experience.
From the above analysis, it can be seen that although there are many ways to optimize the performance of the client page in the prior art, none of them starts from how to reduce the communication time between the client page and the server, which is exactly the effective focus of the performance optimization of the client page. The invention provides a method and a device for optimizing the performance of a client page from the point of view.
In the invention, a network request design scheme based on an Ajax pool is introduced by taking a client page and server-side data communication in a read (website client development framework for erecting Instagram) development process as an example. Generally, a certain page of a website receives a plurality of requests at the same time, or a certain client initiates a plurality of requests through the client page of the website in a short time, an error may be reported in the background, and then the page and the newly requested page are blocked.
FIG. 1 is a schematic diagram of the main steps of a method for optimizing the performance of a client page according to an embodiment of the present invention. As shown in fig. 1, the method for optimizing the performance of the client page according to the embodiment of the present invention mainly includes the following steps S101 and S102.
Step S101: merging request items sent by a client in a set time period into a request, and then sending the merged request to a server, wherein the request items are interactive requests sent by interactive components on the same interface of the client;
step S102: and returning the response data of the server to the corresponding client.
The set time period may be a specific time or a delay time period (for example, 2 seconds). By combining a plurality of request items sent by the client into one request and sending the request to the server, the number of times of sending the request to the server can be reduced, so that the interaction cost of the client and the server is reduced, the interaction time of the client and the server can be saved, and the page performance of the client is optimized. The request item is an interactive request sent by an interactive component under the same interface of the client.
Fig. 2 is a schematic diagram of a conventional data request process between a client and a server. The invention is introduced by taking the communication between a client and a server in the development process of React as an example, the React is a modularized framework for creating a user interaction interface, a user can use each part of a React component development page, and finally a plurality of containers are combined to render the whole page. Some of these interactive components need to make some ajax, etc. network requests to load or update the data state. As shown in fig. 2, in a conventional data request process between a client and a server, when a user sends a request to the server through the client, each container (including a parent container and a child container) is responsible for executing a corresponding POST request or evaluate operation. Alternatively, using Redux (a client architecture), each container is responsible for dispatching an action that will then execute the request. After processing each promise, each container decides how to process evaluate.
In this example, the first time the page loads, the client page will issue at least 5 requests to the server at the same time. And, after these 5 requests return, React will render the client page 5 times. In certain circumstances, this manner of request may be sufficiently fast. However, if the client page of the client uses a large number of interactive components, this means that the client will make 20, 30 or more requests at the same time. However, there is a limit to how many requests are issued at the same time, so that the remaining requests are added to a queue that increases the total time.
As can be seen from fig. 2, the number of requests sent in the data request process of the conventional client and server is large, and the amount of request interaction data is large, so that performance defects are caused. The present invention can solve the technical problem well.
Fig. 3 is a schematic diagram of a data request process of a client and a server based on Ajax pool according to an embodiment of the present invention. As shown in fig. 3, the main idea of the present invention is to add a request item (referring to an element in a request queue sent by a client to a server, which includes parameters, request IDs, etc.) sent by interactive components in the same interface of the client at the same time or within a certain delay time to a request queue by initializing an Ajax pool (which is a kind of request pool, and may also be a switch pool, an Axis pool, etc.) and delete the repeated request item, and then merge the request item into a request and send the request to a server. And after the merged requests are processed by the service end, the Ajax pool distributes response data corresponding to all the requests to the corresponding client ends.
When the request items are combined, the incidence relation between each request item and the client is established so that response data can be returned to the corresponding client; and, an index is also established for the request item sent by each client, so that the response data can be returned to each client according to the set rule. The set rule can be flexibly set according to specific implementation requirements, and may be, for example: sequentially returning response data according to the time sequence of the plurality of request items; or to return the response data for each request item randomly, etc. When establishing an index for a request item sent by a client, a specific implementation manner is, for example: each request item is assigned a unique identification ID and an index is built based on the ID.
In this embodiment, initialization of the Ajax pool is performed by Evaluation Service, and each time the Evaluation method of this Service system is called, it first calls initPool to obtain the corresponding identifier "id" of the Ajax pool. This "id" is unique for each Ajax request. If there are multiple initial tasks executing in the Ajax pool at the same time, the same "id" should be used in all Ajax pools. The purpose of the Ajax pool is to resolve all promises of the Ajax pool with the same response, but using only one Ajax request.
FIG. 4 is a diagram illustrating an initialization process of Ajax pools according to an embodiment of the present invention. As shown in fig. 4, the present invention needs to establish an Evaluation Service system for initializing the Ajax pool, add a request item to a request queue, and then transfer the request item to the Ajax pool when the Ajax pool is initialized.
When an Ajax pool is initialized, an initialization method Initpool (), delay time DelayTime (which represents all Request items of 0-100 ms when DelayTime is 100ms, that is, all Request items within 0-100 ms are merged into one Request, and if DelayTime is 0, all Request items at a certain time are represented, a delete Request item method clearRrequest, an add Request item method AddQueue, a save Request item index variable and a server Request method Request (), and a data return method Response (), namely, an Ajax pool can be represented as:
AjaxPool=(Initpool,DelayTime,CleanRquest,AddQueue,Request,Response)。
in an embodiment of the present invention, the code for establishing Evaluation Service is, for example: evaluationservice ([ a, b ]). the n (res {// }); the code for initializing the Ajax pool by Evaluation Service is, for example: const id ═ pool.
FIG. 5 is a schematic diagram of request item merging performed by the Ajax pool according to an embodiment of the present invention. After receiving all the request items, the Ajax pool filters the repeated request items to perform request item deduplication, establishes an association relation between the request items and the client and an index of the request items, merges the request items after deduplication into a request, and then sends the merged request to the server. As shown in fig. 5, assuming that the request items received by the Ajax pool are "[ a, b ]", "[ a, c ]", "[ a, g ]", "[ f, b ]", … …, "[ c, f ]", respectively, the request merged by the Ajax pool is "[ a, b, c, f, g, … ]".
When the server returns the response content corresponding to the merged request to the client, the Ajax pool returns the response content to the corresponding client according to the association relationship between the client and the request item and the index of the request item corresponding to each client, so that the client can update data and render a page.
It can be seen from the foregoing introduction that, by de-duplicating the request items sent by the client within the set time period and combining the de-duplicated request items into one request, the total loading time of the client can be reduced, and adding repeated requests in the request queue is avoided, thereby reducing the data volume of the communication interaction between the client and the server, and also reducing the number of times of the communication interaction between the client and the server, improving the communication efficiency between the client and the server, and improving the response capability of the server while optimizing the page performance of the client; the reusability of the request pool is greatly improved by establishing the association relationship between the request items and the clients and the index of the request item corresponding to each client, and each component of the client page can directly use the request pool to improve the performance of the client page.
Fig. 6 is a schematic diagram of main modules of an apparatus for optimizing client page performance according to an embodiment of the present invention. As shown in fig. 6, the apparatus 600 for optimizing client page performance according to the embodiment of the present invention mainly includes a request merging module 601 and a response returning module 602.
The request merging module 601 is configured to merge request items sent by a client in a set time period into one request, and then send the merged request to a server, where the request items are interactive requests sent by interactive components on the same interface of the client;
a response returning module 602, configured to return response data of the server to the corresponding client.
According to an embodiment of the present invention, the request merging module 601 may further be configured to:
and carrying out deduplication on the request items sent by the client in the set time period, and combining the deduplicated request items into one request.
According to another embodiment of the present invention, the apparatus 600 for optimizing the performance of the client page may further include an association establishing module (not shown in the figure) for:
before sending the merged request to the server, establishing an association relationship between the client and the request item;
and, the response returning module 602 may be further configured to:
and returning the response data of the server to the corresponding client according to the association relation.
According to another embodiment of the present invention, the apparatus 600 for optimizing the performance of the client page may further include an index creating module (not shown in the figure) configured to:
before sending the merged request to the server, establishing an index for the request item sent by each client;
and, the response returning module 602 may be further configured to:
and returning the response data of the server to each client according to the index and the preset rule.
According to the technical scheme of the embodiment of the invention, the request item combination is carried out by establishing the request pool, and the response data is returned to the corresponding client.
According to the technical scheme of the embodiment of the invention, the request items sent by the client in the set time period are combined into one request, and then the combined request is sent to the server; the response data of the server is returned to the corresponding client, so that the times of communication interaction between the client and the server are reduced, the cost of interaction between the client and the server is reduced, and the problem of frequent data requests of the client and the server in a short time is effectively solved; by removing the duplicate of the request items sent by the client and combining the request items after the duplicate removal into one request, the total loading time of the client can be reduced, and the repeated requests are prevented from being added in the request queue, so that the data volume of the communication interaction between the client and the server is reduced, the communication efficiency between the client and the server is further improved, the page performance of the client is optimized, and the response capability of the server is improved; the reusability of the request pool is greatly improved by establishing the association relationship between the request items and the clients and the index of the request item corresponding to each client, and each component of the client page can directly use the request pool to improve the performance of the client page.
Fig. 7 illustrates an exemplary system architecture 700 of a method or apparatus for optimizing client page performance to which embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. The terminal devices 701, 702, 703 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for optimizing the client page performance provided by the embodiment of the present invention is generally performed by the server 705, and accordingly, the apparatus for optimizing the client page performance is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device or server implementing an embodiment of the present invention. The terminal device or the server shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware. The described units or modules may also be provided in a processor, and may be described as: a processor includes a request merge module and a response return module. The names of the units or modules do not form a limitation on the units or modules themselves in some cases, for example, the request merging module may also be described as a "module for merging request items sent by a client in a set time period into one request and then sending the merged request to a server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: merging request items sent by a client in a set time period into a request, and then sending the merged request to a server, wherein the request items are interactive requests sent by interactive components on the same interface of the client; and returning the response data of the server to the corresponding client.
According to the technical scheme of the embodiment of the invention, the request items sent by the client in the set time period are combined into one request, and then the combined request is sent to the server; the response data of the server is returned to the corresponding client, so that the times of communication interaction between the client and the server are reduced, the cost of interaction between the client and the server is reduced, and the problem of frequent data requests of the client and the server in a short time is effectively solved; by removing the duplicate of the request items sent by the client and combining the request items after the duplicate removal into one request, the total loading time of the client can be reduced, and the repeated requests are prevented from being added in the request queue, so that the data volume of the communication interaction between the client and the server is reduced, the communication efficiency between the client and the server is further improved, the page performance of the client is optimized, and the response capability of the server is improved; the reusability of the request pool is greatly improved by establishing the association relationship between the request items and the clients and the index of the request item corresponding to each client, and each component of the client page can directly use the request pool to improve the performance of the client page.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method for optimizing client page performance, comprising:
merging request items sent by a client in a set time period into a request, and then sending the merged request to a server, wherein the request items are interactive requests sent by interactive components on the same interface of the client;
and returning the response data of the server to the corresponding client.
2. The method of claim 1, wherein merging request items from the client into one request within a set time period comprises:
and carrying out deduplication on the request items sent by the client in the set time period, and combining the deduplicated request items into one request.
3. The method of claim 1, wherein before sending the merged request to the server, further comprising:
establishing an incidence relation between the client and the request item;
and, returning the response data of the server to the corresponding client comprises:
and returning the response data of the server to the corresponding client according to the incidence relation.
4. The method according to claim 1 or 3, wherein before sending the merged request to the server, further comprising:
establishing an index for the request item sent by each client;
and, returning the response data of the server to the corresponding client comprises:
and returning the response data of the server to each client according to the index and a preset rule.
5. The method of claim 1, wherein the request item consolidation is performed by establishing a request pool and the response data is returned to the corresponding client.
6. An apparatus for optimizing client page performance, comprising:
the request merging module is used for merging request items sent by a client side in a set time period into a request and then sending the merged request to a server side, wherein the request items are interactive requests sent by interactive components under the same interface of the client side;
and the response returning module is used for returning the response data of the server to the corresponding client.
7. The apparatus of claim 6, wherein the request merge module is further configured to:
and carrying out deduplication on the request items sent by the client in the set time period, and combining the deduplicated request items into one request.
8. The apparatus of claim 6, further comprising an association establishment module configured to:
before sending the merged request to the server, establishing an association relationship between the client and the request item;
and the response returning module is further used for:
and returning the response data of the server to the corresponding client according to the incidence relation.
9. The apparatus of claim 6 or 8, further comprising an index building module configured to:
before sending the merged request to the server, establishing an index for the request item sent by each client;
and the response returning module is further used for:
and returning the response data of the server to each client according to the index and a preset rule.
10. The apparatus of claim 6, wherein the request item merging is performed by establishing a request pool and the response data is returned to the corresponding client.
11. An electronic device for optimizing client page performance, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201910590236.8A 2019-07-02 2019-07-02 Method and device for optimizing client page performance Pending CN112182445A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910590236.8A CN112182445A (en) 2019-07-02 2019-07-02 Method and device for optimizing client page performance

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910590236.8A CN112182445A (en) 2019-07-02 2019-07-02 Method and device for optimizing client page performance

Publications (1)

Publication Number Publication Date
CN112182445A true CN112182445A (en) 2021-01-05

Family

ID=73915569

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910590236.8A Pending CN112182445A (en) 2019-07-02 2019-07-02 Method and device for optimizing client page performance

Country Status (1)

Country Link
CN (1) CN112182445A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113364637A (en) * 2021-08-09 2021-09-07 中建电子商务有限责任公司 Network communication optimization method and system based on batch packing scheduling
CN113691630A (en) * 2021-08-26 2021-11-23 北京字节跳动网络技术有限公司 DNS request processing method, device, system, electronic equipment and storage medium
CN113885902A (en) * 2021-08-23 2022-01-04 北京房江湖科技有限公司 Application program interface updating method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113364637A (en) * 2021-08-09 2021-09-07 中建电子商务有限责任公司 Network communication optimization method and system based on batch packing scheduling
CN113885902A (en) * 2021-08-23 2022-01-04 北京房江湖科技有限公司 Application program interface updating method
CN113885902B (en) * 2021-08-23 2022-10-11 贝壳找房(北京)科技有限公司 Application program interface updating method
CN113691630A (en) * 2021-08-26 2021-11-23 北京字节跳动网络技术有限公司 DNS request processing method, device, system, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110661826B (en) Method for processing network request by proxy server side and proxy server
CN112182445A (en) Method and device for optimizing client page performance
CN109936605B (en) Method and device for loading interface data
CN103051706A (en) Dynamic webpage request processing system and method for dynamic website
CN102799636A (en) Method and system for displaying webpage by mobile terminal
CN111478781B (en) Message broadcasting method and device
CN111737615A (en) Method and device for acquiring page resources, electronic equipment and readable storage medium
CN110928905B (en) Data processing method and device
CN112398669A (en) Hadoop deployment method and device
CN112445988A (en) Data loading method and device
CN112214250A (en) Application program assembly loading method and device
CN110647327B (en) Method and device for dynamic control of user interface based on card
CN112395337B (en) Data export method and device
US20180131783A1 (en) Video and Media Content Delivery Network Storage in Elastic Clouds
CN111796878B (en) Resource splitting and loading method and device applied to single-page application
CN111177109A (en) Method and device for deleting overdue key
CN112688982B (en) User request processing method and device
CN114125067A (en) Front-end and back-end separated gray scale publishing method, front-end server and configuration server
CN113220981A (en) Method and device for optimizing cache
CN112749353A (en) Processing method and device of webpage icon
CN112860268B (en) Method and device for hot deployment of templates
CN104978339A (en) File processing method and equipment, and network system
CN110858240A (en) Front-end module loading method and device
CN110727889A (en) Static webpage resource loading method, device, medium and electronic equipment
CN113760886B (en) Method, apparatus, device and computer readable medium for providing data service

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination