Method and device for optimizing page loading speed
By recording domain name resolution and network connection time, the network status is determined, and compression is performed on the page server side, which solves the problem of long page loading time and improves user experience.
Patent Information
- Application Number
- CN202211135833.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, page loading is not optimized according to network conditions, resulting in long page loading time and poor user experience.
By recording the domain name resolution time and network connection establishment time, the network connection status is judged. If the requirements are not met, a compression mark is added to the page request message to cause the page server to compress the page and decompress it for display on the terminal.
It reduces the workload of the terminal, reduces network bandwidth usage, increases page loading speed, and improves user experience.
Smart Images

Figure CN115529243B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and device for optimizing page loading speed. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the invention recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] Currently, most pages tend to load all static resources when they are loaded for the first time. However, if the network connection between the terminal and the page server is not good at this time (for example, there is a high packet loss rate, network delay, network congestion, etc.), if the page server sends all the static resources of the page to the terminal in the conventional loading method, it will cause the terminal to take a long time to load the page, seriously affecting the user experience.
[0004] There is an urgent need for a method for optimizing page loading speed, so as to solve the problem in the prior art that page loading is not optimized according to network conditions, resulting in long page loading time and poor user experience. Summary of the invention
[0005] In order to solve the problems existing in the prior art, the embodiments of the present invention provide a method and device for optimizing page loading speed, which realizes optimizing the page loading speed according to the current network status. This solves the problem that the prior art page loading is not optimized according to the network status, resulting in long page loading time and poor user experience.
[0006] In order to solve the above technical problems, the specific technical solutions of the present invention are as follows:
[0007] An embodiment of the present invention provides a method for optimizing page loading speed, the method comprising:
[0008] After receiving the domain name address selected by the user, recording the time of obtaining the Internet Protocol address corresponding to the domain name address from the domain name server as the first time;
[0009] Using the Internet Protocol address, sending a request to establish a network connection to a page server corresponding to the Internet Protocol address, and recording the time when the network connection is established as a second time;
[0010] Determining whether the network connection status meets the requirements according to the first time and the second time;
[0011] If the network connection status does not meet the requirements, a page compression identifier is added to the page request message sent to the page server, so that the page server compresses the page corresponding to the Internet protocol and returns the compressed page;
[0012] The compressed page is decompressed, and the decompressed page is displayed to the user.
[0013] Furthermore, determining whether the network connection status meets the requirement according to the first time and the second time further includes:
[0014] Determining whether the first time exceeds a first preset threshold, and determining whether the second time exceeds a second preset threshold;
[0015] If the first time exceeds the first preset threshold and the second time exceeds the second preset threshold, the network connection status does not meet the requirement.
[0016] Furthermore, recording the time when the network connection is established as the second time further includes,
[0017] When establishing the network connection, recording the response time of each message in a predetermined number of messages, wherein the predetermined number of messages are sent to the page server in a sequential order when establishing the network connection;
[0018] The second time is calculated according to the response time of each message in the predetermined number of messages.
[0019] Further, calculating the second time according to the response time of each message in the predetermined number of messages further includes:
[0020] An average value of total response time of the predetermined number of messages is calculated, and the average value is used as the second time.
[0021] Further, determining whether the network connection status meets the requirement according to the first time and the second time also includes:
[0022] A network connection status score is determined according to the first time and the second time, and whether the network connection status meets the requirement is determined according to the network connection status score.
[0023] Furthermore, when the network connection status does not meet the requirements, the method further includes:
[0024] Determining a compression data type corresponding to the network connection status score in a preset compression data type list as a target compression data type;
[0025] The page compression instruction is generated according to the target compression data type, so that the page server compresses the page according to the target compression data type in the page compression instruction.
[0026] Furthermore, decompressing the compressed page and displaying the decompressed page to the user further includes:
[0027] The data corresponding to the target compressed data type in the compressed page is decompressed to obtain the page, and the page is displayed to the user.
[0028] Furthermore, after receiving the domain name address selected by the user, the method further includes:
[0029] Determine whether there is cache data of the domain name address, and if so, delete the cache data;
[0030] The method for obtaining the first time further comprises,
[0031] After deleting the cache data, sending the domain name address resolution request to the domain name server, and recording the acquisition time of the Internet Protocol address as the first time.
[0032] An embodiment of the present invention further provides a device for optimizing page loading speed, the device comprising:
[0033] an Internet Protocol address acquisition time determination unit, configured to, after receiving the domain name address selected by the user, record the time of acquiring the Internet Protocol address corresponding to the domain name address from the domain name server as the first time;
[0034] a network connection establishment time determination unit, configured to use the Internet Protocol address to send a network connection establishment request to a page server corresponding to the Internet Protocol address, and record the time when the network connection is established as a second time;
[0035] A network status determination unit, configured to determine whether a network connection status meets the requirements according to the first time and the second time;
[0036] a page compression instruction sending unit, configured to add a page compression identifier to a page request message sent to the page server when the network connection state does not meet the requirements, so that the page server compresses the page corresponding to the Internet protocol and returns the compressed page;
[0037] The page display unit is used to display the compressed page to the user.
[0038] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the computer program.
[0039] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0040] An embodiment of the present invention further provides a computer program product, wherein the computer program product includes a computer program, and the computer program implements the above method when executed by a processor.
[0041] In an embodiment of the present invention, after a user selects a domain name address on a terminal, the terminal records the time of obtaining the Internet Protocol address corresponding to the domain name address from the domain name server as the first time, and then the terminal needs to use the obtained Internet Protocol address to establish a network connection with the page server corresponding to the Internet Protocol address, and records the time when the network connection is established as the second time, and then determines whether the network connection status meets the requirements based on the first time and the second time. If it does not meet the requirements, a page compression identifier is added to the page request message sent by the terminal to the page server, so that the page server compresses the page corresponding to the Internet Protocol address and sends the compressed page to the terminal, and the terminal then decompresses the compressed page and displays the decompressed page to the user. The invention realizes determining the network connection status by utilizing the time required for domain name resolution in the process of the terminal requesting a page from the page server and the time required for establishing the network connection. There is no need for the terminal to send additional reports to analyze the network connection status, thereby reducing the workload of the terminal. In addition, when the network connection status does not meet the requirements, the page server is notified to compress the requested page, thereby reducing the network bandwidth occupancy and increasing the page loading speed. The page loading speed is optimized, and the problem of the prior art that the page loading is not optimized according to the network conditions, resulting in long page loading time and poor user experience is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention 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 only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0043] Figure 1 A schematic diagram of an implementation system of a method for optimizing page loading speed in an embodiment of the present invention;
[0044] Figure 2 A schematic diagram of the steps of a method for optimizing page loading speed according to an embodiment of the present invention;
[0045] Figure 3This is a step of determining whether the network connection status meets the requirements according to the first time and the second time in an embodiment of the present invention;
[0046] Figure 4 This is a step of determining the compressed data type according to the network connection status score in an embodiment of the present invention;
[0047] Figure 5 A schematic diagram of the structure of a device for optimizing page loading speed according to an embodiment of the present invention;
[0048] Figure 6 The figure is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention.
[0049] Description of the accompanying symbols:
[0050] 101. Terminal;
[0051] 102. Network forwarding equipment;
[0052] 103. Domain name server;
[0053] 104. Page server;
[0054] 501, an Internet Protocol address acquisition time determination unit;
[0055] 502. Network connection establishment time determination unit;
[0056] 503. Network status determination unit;
[0057] 504, page compression instruction sending unit;
[0058] 505, page display unit;
[0059] 602. Computer equipment;
[0060] 604, processor;
[0061] 606. Memory;
[0062] 608, driving mechanism;
[0063] 610, input / output module;
[0064] 612. Input devices;
[0065] 614. Output devices;
[0066] 616. Presentation equipment;
[0067] 618. Graphical user interface;
[0068] 620, network interface;
[0069] 622, communication link;
[0070] 624. Communication bus. DETAILED DESCRIPTION
[0071] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0072] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0073] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes 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 equipment.
[0074] Figure 1The diagram is a schematic diagram of a system for implementing a method for optimizing page loading speed provided by an embodiment of the present invention, which may include a terminal 101, a network forwarding device 102, a domain name server 103, and a page server 104. In the prior art, when a user clicks on a selected domain name address on the terminal 101, since the domain name address does not contain the corresponding Internet Protocol address of the page server 104 (i.e., the IP address of the page server 104), the terminal 101 sends the domain name address selected by the user to the network forwarding device 102, and the network forwarding device 102 forwards the domain name address to the corresponding domain name server 103, and then waits for a response from the domain name server 103. After receiving the domain name address, the domain name server 103 searches for the Internet Protocol address corresponding to the domain name address, and sends the Internet Protocol address to the network forwarding device 102, and the network forwarding device 102 sends the Internet Protocol address to the terminal 101. If the terminal takes a long time to obtain the Internet Protocol address, it may indicate that the network status is abnormal, such as the link between the terminal 101 and the network forwarding device 102 is abnormal, the forwarding service of the network forwarding device 102 is abnormal, the link between the network forwarding device 102 and the domain name server 103 is abnormal, and the service of the domain name server 103 is abnormal. Therefore, it is possible to judge whether the network connection status meets the requirements based on the time of obtaining the Internet Protocol address corresponding to the domain name address.
[0075] After receiving the Internet Protocol address, the terminal 101 needs to establish a connection with the page server 104 corresponding to the Internet Protocol address (for example, establish a TCP connection) in order to obtain the corresponding page. First, the terminal 101 sends a connection establishment request message to the network forwarding device 102. The destination address of the message is the Internet Protocol address of the page server 104. The network forwarding device 102 forwards the connection establishment request message to the page server 104. The page server 104 returns a response message to the network forwarding device 102, and then the network forwarding device 102 forwards the response message to the terminal 101. Since there are many factors affecting the network connection status, if it takes a long time to establish a network connection, it can also indicate that the network status is abnormal, such as the link between the terminal 101 and the network forwarding device 102 is abnormal, the forwarding service of the network forwarding device 102 is abnormal, the link between the network forwarding device 102 and the page server 104 is abnormal, and the service of the page server 104 is abnormal. Therefore, it is possible to judge whether the network connection status meets the requirements based on the time required to establish the network connection.
[0076] If the network connection status does not meet the requirements, the terminal 101 notifies the page server 104 so that the page server 104 compresses the page and sends the compressed page to the terminal 101, thereby optimizing the page loading speed.
[0077] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a method for optimizing page loading speed, which can be applied in the terminal 101 to optimize the page loading speed. Figure 2 It is a schematic diagram of the steps of a method for optimizing page loading speed provided by an embodiment of the present invention. This specification provides the method operation steps described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or device product is executed, it can be executed in the order or in parallel according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 2 As shown, the method may include:
[0078] Step 201: after receiving the domain name address selected by the user, recording the time of obtaining the Internet Protocol address corresponding to the domain name address from the domain name server as the first time;
[0079] Step 202: using the Internet Protocol address to send a request to establish a network connection to a page server corresponding to the Internet Protocol address, and recording the time when the network connection is established as a second time;
[0080] Step 203: Determine whether the network connection status meets the requirements according to the first time and the second time;
[0081] Step 204: if the network connection status does not meet the requirement, a page compression identifier is added to the page request message sent to the page server, so that the page server compresses the page corresponding to the Internet protocol and returns the compressed page;
[0082] Step 205: decompress the compressed page and display the decompressed page to the user.
[0083] Through the method of the embodiment of the present invention, when the user selects a domain name address on the terminal, the terminal records the time of obtaining the Internet Protocol address corresponding to the domain name address from the domain name server as the first time, and then the terminal needs to use the obtained Internet Protocol address to establish a network connection with the page server corresponding to the Internet Protocol address, and records the time when the network connection is established as the second time, and then determines whether the network connection status meets the requirements based on the first time and the second time. If it does not meet the requirements, a page compression identifier is added to the page request message sent by the terminal to the page server, so that the page server compresses the page corresponding to the Internet Protocol address and sends the compressed page to the terminal, and the terminal then decompresses the compressed page and displays the decompressed page to the user. The invention realizes determining the network connection status by utilizing the time required for domain name resolution in the process of the terminal requesting a page from the page server and the time required for establishing the network connection. There is no need for the terminal to send additional reports to analyze the network connection status, thereby reducing the workload of the terminal. In addition, when the network connection status does not meet the requirements, the page server is notified to compress the requested page, thereby reducing the network bandwidth occupancy and increasing the page loading speed. The page loading speed is optimized, and the problem of the prior art that the page loading is not optimized according to the network conditions, resulting in long page loading time and poor user experience is solved.
[0084] In an embodiment of the present invention, the first time represents the time when the Internet Protocol address (i.e., IP address) is obtained from the domain name server. Specifically, the time when the DNS domain name resolution message is sent is taken as the initial time, and the time when the Internet Protocol address is received is taken as the end time. The difference between the end time and the initial time is calculated, and the difference is taken as the first time.
[0085] Exemplarily, the terminal first constructs a DNS domain name resolution message according to the domain name address selected by the user and the set DNS server address, and then sends the DNS domain name resolution message to the network forwarding device and records the initial time. The source IP of the DNS domain name resolution message is the IP address of the terminal, and the destination IP is the DNS server address; then the network forwarding device sends the DNS domain name resolution message to the domain name server according to the configured route. The domain name server determines the corresponding IP address according to the domain name in the DNS domain name resolution message, and then constructs a reply message according to the IP address, and sends the reply message to the network forwarding device. The network forwarding device forwards the reply message to the terminal according to the route. The terminal uses the time when the reply message is received as the end time, and then calculates the difference between the end time and the initial time. The difference represents the total time consumed for domain name resolution, and the difference is used as the first time.
[0086] In an embodiment of the present invention, the second time represents the time required to establish a network connection. Specifically, the time for sending a network connection establishment request message is used as the initial time for establishing the connection, and the time for receiving a response message to the network connection establishment request message is used as the connection establishment time. The difference between the connection establishment time and the initial time for establishing the connection is calculated, and the difference is used as the second time.
[0087] Exemplarily, after receiving the reply message from the DNS, the terminal parses the reply message to obtain the IP address corresponding to the domain name address, which is the IP address of the page server, and then establishes a network connection. The terminal generates a connection request message based on the IP address of the page server, and the destination IP of the message is the IP of the page server. The terminal sends the connection request message to the network forwarding device and records the initial time of establishing the connection. The network forwarding device sends the connection request message to the page server according to the route, and then the page server responds to the terminal's connection request, generates a reply message and sends it to the network forwarding device, and the network forwarding device forwards the reply message to the terminal. The terminal uses the time of receiving the reply message as the connection establishment time, and then calculates the difference between the connection establishment time and the initial time of establishing the connection, and uses the difference as the second time.
[0088] Furthermore, in the embodiment of the present invention, the connection established between the terminal and the page server may be a TCP connection, and the process of establishing the TCP connection is a "two-way handshake" (the process of establishing a TCP connection is common knowledge in the art and will not be described in detail in the embodiments of this specification). Therefore, in order to accurately calculate the time when the connection is established, according to one embodiment of the present invention, the time when the network connection is established is recorded as the second time, further including:
[0089] When establishing the network connection, recording the response time of each message in a predetermined number of messages, wherein the predetermined number of messages are sent to the page server in a sequential order when establishing the network connection;
[0090] The second time is calculated according to the response time of each message in the predetermined number of messages.
[0091] In the embodiment of the present invention, the predetermined number can be determined according to the established connection protocol. For example, when a TCP connection is established, the predetermined number is preferably 2. That is, the response time of the first TCP "two handshakes" message is recorded respectively, and then the second time is calculated according to the response time of the "two handshakes" message.
[0092] Further, according to an embodiment of the present invention, calculating the second time according to the response time of each message in the predetermined number of messages further includes:
[0093] The total response time of the predetermined number of messages is calculated, and the total response time is used as the second time.
[0094] In the embodiment of the present invention, the total response time of these predetermined number of messages can be used as the time required to establish the connection. Taking the establishment of a TCP connection as an example, after the "two handshakes" are completed, the TCP connection is established, that is, the total response time of the "two handshakes" is the time required to establish the TCP connection.
[0095] According to one embodiment of the present invention, Figure 3 As shown, determining whether the network connection status meets the requirements according to the first time and the second time further includes:
[0096] Step 301: Determine whether the first time exceeds a first preset threshold, and determine whether the second time exceeds a second preset threshold;
[0097] Step 302: If the first time exceeds the first preset threshold and the second time exceeds the second preset threshold, the network connection status does not meet the requirement.
[0098] In an embodiment of the present invention, the first preset threshold value and the second preset threshold value may be empirical values. If the first time exceeds the first preset threshold value, it indicates that the link between the terminal and the domain name server is abnormal, for example, the link between the terminal and the network forwarding device is abnormal, the forwarding service of the network forwarding device is abnormal, the link between the network forwarding device and the domain name server is abnormal, and the service of the domain name server is abnormal. If the second time exceeds the second preset threshold value, it indicates that the link between the terminal and the page server is abnormal, for example, the link between the terminal and the network forwarding device is abnormal, the forwarding service of the network forwarding device is abnormal, the link between the network forwarding device and the page server is abnormal, and the service of the page server is abnormal. Therefore, in order to comprehensively analyze the network connection status, it is necessary to judge the first time and the second time. Specifically, if the first time exceeds the first preset threshold value and the second time exceeds the second preset threshold value, the network connection status does not meet the requirements.
[0099] In some other embodiments of the present invention, the network connection status score can also be calculated based on the value of the first time and the value of the second time, and whether the network connection status meets the requirements can be determined based on the network connection status score. For example, the first time is compared with a predetermined domain name resolution time score table to determine the domain name resolution time score corresponding to the value of the first time, and the second time is compared with a predetermined network connection establishment time score table to determine the network connection establishment time score corresponding to the value of the second time. The network connection status score is calculated based on the domain name resolution time score and the network connection establishment time score.
[0100] In an embodiment of the present invention, a page may be composed of pictures, videos, text, font styles, etc. The pictures, videos or font styles in some pages are only for rendering the page effect, but the pictures, videos or font styles will greatly increase the time of page loading, that is, the page server needs to transmit a large number of messages to the terminal. Therefore, the page can be selectively compressed according to the network connection status score, so that when the network connection status does not meet the requirements, the page loading speed can still be guaranteed, and the user experience is less lost. Specifically, according to an embodiment of the present invention, Figure 4 As shown, when the network connection status does not meet the requirements, the method further includes:
[0101] Step 401: Determine the compression data type corresponding to the network connection status score in a preset compression data type list as the target compression data type;
[0102] Step 402: Generate the page compression instruction according to the target compression data type, so that the page server compresses the page according to the target compression data type in the page compression instruction.
[0103] In an embodiment of the present invention, the preset compressed data type list may include a correspondence between a network connection status score and a compressed data type pre-set by a staff member, for example, when the network connection status score is between 80-100, the corresponding compressed data type is font style (because less bandwidth is required to load font style), and when the network connection status score is between 60-80, the corresponding compressed data type is font style and picture. When the network connection status score is less than 60, the corresponding compressed data type is font style, picture and video.
[0104] Then the preset compression data type list determines the compression data type corresponding to the network connection status score as the target compression data type, and generates a page compression instruction based on the target compression data type, so that the page server compresses the page according to the target compression data type in the page compression instruction. In this way, when the network connection status does not meet the requirements, the page loading speed can still be guaranteed with less loss of user experience.
[0105] It should be noted that the page server can compress the page using page compression tools such as GZIP in the prior art, which will not be repeated in the embodiments of this specification.
[0106] According to an embodiment of the present invention, decompressing the compressed page and displaying the decompressed page to the user further comprises:
[0107] The data corresponding to the target compressed data type in the compressed page is decompressed to obtain the page, and the page is displayed to the user.
[0108] In the embodiment of the present invention, after receiving the compressed page, the terminal can compress the page according to the target compression data type corresponding to the network status score, thereby further improving the page loading speed and improving the user experience.
[0109] In the embodiment of the present invention, if the terminal has previously accessed the domain name, the corresponding relationship between the domain name address and the IP address may be cached. Therefore, in order to improve the accuracy of determining the network connection status, after receiving the domain name address selected by the user, the method further includes:
[0110] Determine whether there is cache data of the domain name address, and if so, delete the cache data;
[0111] The method for obtaining the first time further comprises,
[0112] After deleting the cache data, sending the domain name address resolution request to the domain name server, and recording the acquisition time of the Internet Protocol address as the first time.
[0113] In an embodiment of the present invention, if the terminal has cached the correspondence between the domain name address and the IP address, when accessing the domain name again, the terminal will directly generate a connection request message based on the cached IP address. The first time at this time is 0, which may affect the accuracy of judging the network connection status. Therefore, when the terminal has cached the correspondence between the domain name address and the IP address, the cache is deleted and the IP address corresponding to the domain name address is obtained from the domain name server again, thereby determining the first time and eliminating the influence of the cached data of the domain name address on judging the network connection status.
[0114] Based on the same inventive concept, the embodiment of this specification also provides a device for optimizing page loading speed, such as Figure 5 As shown, the device comprises:
[0115] The Internet Protocol address acquisition time determination unit 501 is used to, after receiving the domain name address selected by the user, record the time of acquiring the Internet Protocol address corresponding to the domain name address from the domain name server as the first time;
[0116] A network connection establishment time determination unit 502, configured to use the Internet Protocol address to send a network connection establishment request to a page server corresponding to the Internet Protocol address, and record the time when the network connection is established as a second time;
[0117] A network status determining unit 503, configured to determine whether a network connection status meets the requirements according to the first time and the second time;
[0118] A page compression instruction sending unit 504 is used to add a page compression identifier to the page request message sent to the page server when the network connection status does not meet the requirements, so that the page server compresses the page corresponding to the Internet protocol and returns the compressed page;
[0119] The page display unit 505 is used to display the compressed page to the user.
[0120] The beneficial effects obtained by the above-mentioned device are consistent with the beneficial effects obtained by the above-mentioned method, and will not be described in detail in the embodiments of this specification.
[0121] like Figure 6 As shown, a computer device provided in an embodiment of the present invention, the apparatus in the present invention may be a computer device in this embodiment, and the method of the present invention described above is executed. The computer device 602 may include one or more processors 604, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 602 may also include any memory 606, which is used to store any kind of information such as code, settings, data, etc. Non-limitingly, for example, the memory 606 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent a fixed or removable component of the computer device 602. In one case, when the processor 604 executes an associated instruction stored in any memory or a combination of memories, the computer device 602 may perform any operation of the associated instruction. The computer device 602 also includes one or more drive mechanisms 608 for interacting with any memory, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.
[0122] The computer device 602 may also include an input / output module 610 (I / O) for receiving various inputs (via input devices 612) and for providing various outputs (via output devices 614). A specific output mechanism may include a presentation device 616 and an associated graphical user interface (GUI) 618. In other embodiments, the input / output module 610 (I / O), input device 612, and output device 614 may not be included, and the computer device 602 may be used as a computer device in a network. The computer device 602 may also include one or more network interfaces 620 for exchanging data with other devices via one or more communication links 622. One or more communication buses 624 couple the components described above together.
[0123] The communication link 622 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 622 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.
[0124] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0125] An embodiment of the present invention further provides a computer program product, wherein the computer program product includes a computer program, and the computer program implements the above method when executed by a processor.
[0126] 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.
[0127] 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.
[0128] 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.
[0129] 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.
[0130] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for optimizing page loading speed, characterized in that: The method comprises: After receiving the domain name address selected by the user, recording the time of obtaining the Internet Protocol address corresponding to the domain name address from the domain name server as the first time; Using the Internet Protocol address, sending a request to establish a network connection to a page server corresponding to the Internet Protocol address, and recording the time when the network connection is established as a second time; Determining whether the network connection status meets the requirements according to the first time and the second time; Determining whether the network connection status meets the requirement according to the first time and the second time includes: Determine a network connection status score according to the first time and the second time, and determine whether the network connection status meets the requirements according to the network connection status score; If the network connection status does not meet the requirements, a page compression identifier is added to the page request message sent to the page server, so that the page server compresses the page corresponding to the Internet protocol and returns the compressed page; The compressed page is decompressed, and the decompressed page is displayed to the user.
2. The method according to claim 1, characterized in that Determining whether the network connection status meets the requirements according to the first time and the second time further includes: Determining whether the first time exceeds a first preset threshold, and determining whether the second time exceeds a second preset threshold; If the first time exceeds the first preset threshold and the second time exceeds the second preset threshold, the network connection status does not meet the requirement.
3. The method according to claim 1, characterized in that Recording the time when the network connection is established as the second time further includes, When establishing the network connection, recording the response time of each message in a predetermined number of messages, wherein the predetermined number of messages are sent to the page server in a sequential order when establishing the network connection; The second time is calculated according to the response time of each message in the predetermined number of messages.
4. The method according to claim 3, characterized in that Calculating the second time according to the response time of each message in the predetermined number of messages further includes: The total response time of the predetermined number of messages is calculated, and the total response time is used as the second time.
5. The method according to claim 1, characterized in that When the network connection status does not meet the requirements, the method further includes: Determining a compression data type corresponding to the network connection status score in a preset compression data type list as a target compression data type; The page compression instruction is generated according to the target compression data type, so that the page server compresses the page according to the target compression data type in the page compression instruction.
6. The method according to claim 5, characterized in that Decompressing the compressed page and displaying the decompressed page to the user further includes: The data corresponding to the target compressed data type in the compressed page is decompressed to obtain the page, and the page is displayed to the user.
7. The method according to claim 1, characterized in that After receiving the domain name address selected by the user, the method further includes: Determine whether there is cache data of the domain name address, and if so, delete the cache data; The method for obtaining the first time further comprises, After deleting the cache data, sending the domain name address resolution request to the domain name server, and recording the acquisition time of the Internet Protocol address as the first time.
8. A device for optimizing page loading speed, characterized in that: include: an Internet Protocol address acquisition time determination unit, configured to, after receiving the domain name address selected by the user, record the time of acquiring the Internet Protocol address corresponding to the domain name address from the domain name server as the first time; a network connection establishment time determination unit, configured to use the Internet Protocol address to send a network connection establishment request to a page server corresponding to the Internet Protocol address, and record the time when the network connection is established as a second time; A network status determination unit, configured to determine whether a network connection status meets the requirements according to the first time and the second time; Determining whether the network connection state meets the requirements according to the first time and the second time includes: determining a network connection state score according to the first time and the second time, and determining whether the network connection state meets the requirements according to the network connection state score; a page compression instruction sending unit, configured to add a page compression identifier to a page request message sent to the page server when the network connection state does not meet the requirements, so that the page server compresses the page corresponding to the Internet protocol and returns the compressed page; The page display unit is used to display the compressed page to the user.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
