CN115529243A - Method and device for optimizing page loading speed - Google Patents

Method and device for optimizing page loading speed Download PDF

Info

Publication number
CN115529243A
CN115529243A CN202211135833.XA CN202211135833A CN115529243A CN 115529243 A CN115529243 A CN 115529243A CN 202211135833 A CN202211135833 A CN 202211135833A CN 115529243 A CN115529243 A CN 115529243A
Authority
CN
China
Prior art keywords
time
page
network connection
domain name
internet protocol
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
CN202211135833.XA
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202211135833.XA priority Critical patent/CN115529243A/en
Publication of CN115529243A publication Critical patent/CN115529243A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • H04L41/083Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability for increasing network speed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of communication, in particular to a method and a device for optimizing page loading speed, wherein the method comprises the following steps: after receiving a domain name address selected by a user, recording the time for acquiring an internet protocol address corresponding to the domain name address from a domain name server as first time; sending a request for establishing network connection to a page server corresponding to the internet protocol address by using the internet protocol address, and recording the time for establishing the network connection as second time; determining whether the network connection state meets the requirement according to the first time and the second time; if the request message does not meet the requirement, adding a page compression identifier into a page request message sent to a page server so that the page server compresses the page and returns the compressed page; and displaying the decompressed page to a user. According to the embodiment of the invention, the optimization of the page loading speed according to the current network state is realized.

Description

Method and device for optimizing page loading speed
Technical Field
The invention relates to the technical field of communication, in particular to a method and a device for optimizing page loading speed.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
At present, most of pages are often loaded with all static resources completely when being loaded for the first time, but if the network connection between the terminal and the page server is not good (for example, packet loss rate is too high, network delay, network congestion and the like occur), if the page server sends all static resources of the page to the terminal according to a conventional loading mode, the time for loading the page by the terminal is longer, and user experience is seriously affected.
Now, a method for optimizing page loading speed is needed, so that the problems that in the prior art, when a page is loaded, optimization is not performed according to network conditions, so that page loading time is long, and user experience is poor are solved.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for optimizing a page loading speed, so as to optimize the page loading speed according to a current network state. The problems that in the prior art, the page loading time is long and the user experience is poor due to the fact that optimization is not performed on the network condition when the page is loaded are solved.
In order to solve the technical problems, the specific technical scheme of the invention is as follows:
the embodiment of the invention provides a method for optimizing page loading speed, which comprises the following steps:
after receiving a domain name address selected by a user, recording the time for acquiring an internet protocol address corresponding to the domain name address from a domain name server as first time;
sending a request for establishing network connection to a page server corresponding to the internet protocol address by using the internet protocol address, and recording the time for establishing network connection as second time;
determining whether the network connection state meets the requirement or not according to the first time and the second time;
if the network connection state does not meet the requirement, adding a page compression identifier into a 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;
and decompressing the compressed page, and displaying the decompressed page to the user.
Further, determining whether the network connection status meets a requirement based on the first time and the second time further comprises,
judging whether the first time exceeds a first preset threshold value or not, and judging whether the second time exceeds a second preset threshold value or not;
and if the first time exceeds the first preset threshold value and the second time exceeds the second preset threshold value, the network connection state does not meet the requirement.
Further, recording a time of network connection establishment, as the second time further comprising,
when the network connection is established, recording the response time of each message in a preset number of messages, wherein the preset number of messages are sent to the page server according to the sequence when the network connection is established;
and calculating the second time according to the response time of each message in the preset number of messages.
Further, calculating the second time based on the response time of each of the predetermined number of packets further comprises,
and calculating the average value of the total response time of the predetermined number of messages, and taking the average value as the second time.
Further, determining whether the network connection status meets requirements based on the first time and the second time further comprises,
and determining a network connection state score according to the first time and the second time, and determining whether the network connection state meets the requirement or not according to the network connection state score.
Further, in the case that the network connection status is not satisfactory, the method further comprises,
determining a compressed data type corresponding to the network connection state score in a preset compressed data type list as a target compressed data type;
and generating 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.
Further, decompressing the compressed page and presenting the decompressed page to the user further comprises,
and decompressing the data corresponding to the target compressed data type in the compressed page to obtain the page, and displaying the page to the user.
Further, after receiving the domain name address selected by the user, the method further comprises,
judging whether cache data of the domain name address exist or not, and if yes, deleting the cache data;
the method of obtaining the first time further comprises,
after the cache data is deleted, 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.
The embodiment of the invention also provides a device for optimizing the page loading speed, which comprises:
the device comprises an Internet protocol address acquisition time determining unit, a domain name server and a domain name server, wherein the Internet protocol address acquisition time determining unit is used for recording the time of acquiring the Internet protocol address corresponding to the domain name address from the domain name server as first time after receiving the domain name address selected by a user;
the network connection establishment time determining unit is used for sending a network connection establishment request to a page server corresponding to the Internet protocol address by using the Internet protocol address, and recording the time of network connection establishment as second time;
the network state determining unit is used for determining whether the network connection state meets the requirement according to the first time and the second time;
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 requirement, so that the page server compresses a page corresponding to the internet protocol, and returns the compressed page;
and the page display unit is used for displaying the compressed page to the user.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the above method.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the method described above.
In the embodiment of the invention, after a user selects a domain name address on a terminal, the terminal records the time for acquiring an internet protocol address corresponding to the domain name address from a domain name server as first time, then the terminal needs to establish network connection with a page server corresponding to the internet protocol address by using the acquired internet protocol address, records the time for establishing the network connection as second time, then determines whether the network connection state meets the requirement according to the first time and the second time, if the network connection state does not meet the requirement, a page compression identifier is added into a page request message sent to the page server by the terminal so that the page server compresses a page corresponding to the internet protocol address, the compressed page is sent to the terminal, the terminal decompresses the compressed page, and the decompressed page is displayed to the user. The method and the device have the advantages that the network connection state is determined by utilizing the time required by domain name resolution and the time required by network connection establishment in the process that the terminal requests the page server for the page, the network connection state is not required to be analyzed by extra sending of a report from the terminal, so that the workload of the terminal is reduced, the page server is informed to compress the requested page under the condition that the network connection state does not meet the requirement, the occupation of network bandwidth is reduced, the loading speed of the page is increased, the optimization of the loading speed of the page is realized, and the problems that the page loading time is long and the user experience is poor due to the fact that the optimization is not performed on the network condition during page loading in the prior art are solved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a schematic diagram of a system for implementing a method for optimizing page loading speed according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating steps of a method for optimizing page loading speed according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a step of determining whether a network connection status meets a requirement according to a first time and a second time according to an embodiment of the present invention;
FIG. 4 illustrates the steps for determining the type of compressed data based on the network connection status score according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for optimizing page loading speed according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a computer device provided in an embodiment of the present invention.
Description of the figures the symbols:
101. a terminal;
102. a network forwarding device;
103. a domain name server;
104. a page server;
501. an internet protocol address acquisition time determining unit;
502. a network connection establishment time determination unit;
503. a network status determination unit;
504. a page compression instruction transmitting unit;
505. a page display unit;
602. a computer device;
604. a processor;
606. a memory;
608. a drive mechanism;
610. an input/output module;
612. an input device;
614. an output device;
616. a presentation device;
618. a graphical user interface;
620. a network interface;
622. a communication link;
624. a communication bus.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
Fig. 1 is a schematic diagram of an implementation system of a method for optimizing a page loading speed according to 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 a selected domain name address on a terminal 101, since the domain name address does not include an internet protocol address of a corresponding page server 104 (i.e., an IP address of the page server 104), the terminal 101 sends the domain name address selected by the user to a network forwarding device 102, the network forwarding device 102 forwards the domain name address to a corresponding domain name server 103, 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, 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 time for the terminal to acquire the ip address is long, it may indicate that the network state is abnormal, for example, a link between the terminal 101 and the network forwarding device 102 is abnormal, a forwarding service of the network forwarding device 102 is abnormal, a link between the network forwarding device 102 and the domain name server 103 is abnormal, and a service of the domain name server 103 is abnormal. Therefore, whether the network connection state meets the requirement can be judged according to the time for acquiring the IP address corresponding to the domain name address.
When the terminal 101 receives the ip address, a connection (e.g., a TCP connection) needs to be established with the page server 104 corresponding to the ip address, so that the terminal can obtain the corresponding page. Firstly, 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. Because the network connection state has more influencing factors, if the time consumed for establishing the network connection is long, it may also indicate that the network state is abnormal, for example, a link between the terminal 101 and the network forwarding device 102 is abnormal, a forwarding service of the network forwarding device 102 is abnormal, a link between the network forwarding device 102 and the page server 104 is abnormal, and a service of the page server 104 is abnormal. Therefore, whether the network connection state meets the requirement can be judged according to the time required for establishing the network connection.
If the network connection state does not meet the requirement, the terminal 101 informs 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.
In order to solve the problems in the prior art, an embodiment of the present invention provides a method for optimizing a page loading speed, which can be applied to the terminal 101 to optimize the page loading speed. Fig. 2 is a schematic diagram of steps of a method for optimizing page loading speed according to an embodiment of the present invention, and the present specification provides the method operation steps according to the embodiment or the flowchart, but more or less operation steps may be included based on conventional or non-creative labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of sequences, and does not represent a unique order of performance. In the actual implementation of the system or the device product, the method according to the embodiments or shown in the drawings can be executed in sequence or in parallel. Specifically, as shown in fig. 2, the method may include:
step 201: after receiving a domain name address selected by a user, recording the time for acquiring an internet protocol address corresponding to the domain name address from a domain name server as first time;
step 202: sending a request for establishing network connection to a page server corresponding to the Internet protocol address by using the Internet protocol address, and recording the time for establishing network connection as second time;
step 203: determining whether the network connection state meets the requirement according to the first time and the second time;
step 204: if the network connection state does not meet the requirement, adding a page compression identifier into a 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;
step 205: and decompressing the compressed page and displaying the decompressed page to the user.
According to the method provided by the embodiment of the invention, after a user selects a domain name address on a terminal, the terminal records the time for acquiring an internet protocol address corresponding to the domain name address from a domain name server as a first time, then the terminal needs to establish network connection by using the acquired internet protocol address and a page server corresponding to the internet protocol address, records the time for establishing the network connection as a second time, then determines whether the network connection state meets the requirement according to the first time and the second time, if the network connection state does not meet the requirement, a page compression identifier is added into a page request message sent to the page server by the terminal, so that the page server compresses a page corresponding to the internet protocol address, the compressed page is sent to the terminal, the terminal decompresses the compressed page, and the decompressed page is displayed to the user. The method and the device have the advantages that the network connection state is determined by utilizing the time required by domain name resolution and the time required by network connection establishment in the process that the terminal requests the page server for the page, the network connection state is not required to be analyzed by extra sending of a report from the terminal, so that the workload of the terminal is reduced, the page server is informed to compress the requested page under the condition that the network connection state does not meet the requirement, the occupation of network bandwidth is reduced, the loading speed of the page is increased, the optimization of the loading speed of the page is realized, and the problems that the page loading time is long and the user experience is poor due to the fact that the optimization is not performed on the network condition during page loading in the prior art are solved.
In this embodiment of the present invention, the first time indicates a time when an internet protocol address (i.e., an IP address) is acquired from a domain name server, and specifically, a time when a DNS domain name resolution packet is sent is taken as an initial time, a time when the internet protocol address is received is taken as an end time, a difference between the end time and the initial time is calculated, and the difference is taken as the first time.
Exemplarily, a terminal firstly constructs a domain name resolution message according to a domain name address selected by a user and a set DNS server address, then sends the domain name resolution message to a network forwarding device and records initial time, wherein a source IP of the domain name resolution message is an IP address of the terminal, and a target IP is the DNS server address; then the network forwarding equipment sends the DNS domain name resolution message to a domain name server according to the configured route, the domain name server determines a corresponding IP address according to a domain name in the DNS domain name resolution message, then a response message is constructed according to the IP address, the response message is sent to the network forwarding equipment, the network forwarding equipment forwards the response message to a terminal according to the route, the terminal takes the time of receiving the response message as the end time, then the difference value between the end time and the initial time is calculated, the difference value represents the total time consumption of domain name resolution, and the difference value is taken as the first time.
In the embodiment of the present invention, the second time represents time required for establishing a network connection, and specifically, time for sending a network connection establishment request packet is taken as initial time for establishing a connection, time for receiving a response packet of the network connection establishment request packet is taken as connection establishment time, a difference between the connection establishment time and the initial time for establishing a connection is calculated, and the difference is taken as the second time.
Exemplarily, after receiving a response message of the DNS, the terminal parses the response message to obtain an IP address corresponding to a domain name address, where the IP address is an IP address of the page server, and then establishes a network connection. The terminal generates a connection establishment request message according to the IP address of the page server, the destination IP of the message is the IP of the page server, the terminal sends the connection establishment request message to the network forwarding equipment and records the initial connection establishment time, the network forwarding equipment sends the connection establishment request message to the page server according to the route, then the page server responds to the connection establishment request of the terminal, a response message is generated and sent to the network forwarding equipment, the network forwarding equipment forwards the response message to the terminal, the terminal takes the time of receiving the response message as the connection establishment time, then the difference value between the connection establishment time and the initial connection establishment time is calculated, and the difference value is taken as the second time.
Further, in the embodiment of the present invention, the connection established between the terminal and the page server may be a TCP connection, and the establishment procedure of the TCP connection is "two-way handshake" (the procedure of establishing the TCP connection is common knowledge in the art, and is not described in detail in the embodiment of this specification), so that, in order to accurately calculate the time of establishing the connection, according to an embodiment of the present invention, the time of establishing the network connection is recorded, and the second time further includes,
when the network connection is established, recording the response time of each message in a preset number of messages, wherein the preset number of messages are sent to the page server according to the sequence when the network connection is established;
and calculating the second time according to the response time of each message in the preset number of messages.
In the embodiment of the present invention, the predetermined number may be determined according to an established connection protocol, for example, when a TCP connection is established, the predetermined number is preferably 2. Namely, the response time of the former TCP 'two-time handshake' message is recorded respectively, and then the second time is calculated according to the response time of the 'two-time handshake' message.
Further, in accordance with an embodiment of the present invention, calculating the second time based on the response time of each of the predetermined number of packets further comprises,
and calculating the total response time of the messages with the preset number, and taking the total response time as the second time.
In the embodiment of the present invention, the total response time of these predetermined number of messages may be used as the time required to establish the connection. Taking the establishment of the TCP connection as an example, after the "two-way handshake" is finished, the establishment of the TCP connection is completed, that is, the total response time of the "two-way handshake" is the time required for establishing the TCP connection.
According to an embodiment of the present invention, as shown in fig. 3, determining whether the network connection status meets the requirement according to the first time and the second time further comprises,
step 301: judging whether the first time exceeds a first preset threshold value or not, and judging whether the second time exceeds a second preset threshold value or not;
step 302: and if the first time exceeds the first preset threshold value and the second time exceeds the second preset threshold value, the network connection state does not meet the requirement.
In the embodiment of the present invention, the first preset threshold and the second preset threshold may be empirical values. If the first time exceeds a 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 a 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 analyze the network connection status in an all-around manner, it is necessary to determine a first time and a second time, and specifically, if the first time exceeds the first preset threshold and the second time exceeds the second preset threshold, the network connection status is not satisfactory.
In some other embodiments of the present invention, the network connection status score may be calculated according to the value of the first time and the value of the second time, and whether the network connection status meets the requirement may be determined according to the network connection status score. For example, the first time is compared with a predetermined domain name resolution time score table, a domain name resolution time score corresponding to the numerical value of the first time is determined, the second time is compared with a predetermined network connection establishment time score table, and a network connection establishment time score corresponding to the numerical value of the second time is determined. And calculating the network connection state score according to the domain name resolution time score and the network connection establishment time score.
In the embodiment of the invention, the page can be composed of pictures, videos, characters, font styles and the like, the pictures, videos or font styles in some pages are only used for rendering the page effect, but the pictures, videos or font styles can greatly increase the page loading time, namely, a page server needs to transmit a large amount of messages to the terminal. Therefore, the page can be selectively compressed according to the network connection state score, so that when the network connection state is not satisfactory, the loading speed of the page can be still ensured, and less user experience is lost. In particular, according to an embodiment of the present invention, as shown in fig. 4, in case the network connection status is not satisfactory, the method further comprises,
step 401: determining a compressed data type corresponding to the network connection state score in a preset compressed data type list as a target compressed data type;
step 402: and generating 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.
In the embodiment of the present invention, the preset compressed data type list may include a corresponding relationship between a network connection status score and a compressed data type, which is set by a worker in advance, for example, when the network connection status score is between 80 and 100, the corresponding compressed data type is a font style (because a bandwidth required for loading the font style is small), and when the network connection status score is between 60 and 80, the corresponding compressed data type is a font style and a picture. And when the network connection state score is less than 60, the corresponding compressed data types are font styles, pictures and videos.
And then the preset compressed data type list determines the compressed data type corresponding to the network connection state score as a target compressed data type, and generates a page compression instruction according to the target compressed data type, so that the page server compresses the page according to the target compressed data type in the page compression instruction, and therefore when the network connection state does not meet the requirement, the loading speed of the page can be still ensured, and less user experience is lost.
It should be noted that the page server may compress the page by using page compression tools such as GZIP in the prior art, which is not described in this specification.
According to an embodiment of the present invention, decompressing the compressed page and presenting the decompressed page to the user further comprises,
and decompressing the data corresponding to the target compressed data type in the compressed page to obtain the page, and displaying the page to the user.
In the embodiment of the invention, after the terminal receives the compressed page, the page can be compressed according to the target compressed data type corresponding to the network state score, so that the page loading speed is further increased, and the user experience is improved.
In the embodiment of the present invention, if the terminal has accessed the domain name before, the corresponding relationship between the domain name address and the IP address may be cached, so in order to improve the accuracy of determining the network connection state, after receiving the domain name address selected by the user, the method further includes,
judging whether cached data of the domain name address exist or not, and if yes, deleting the cached data;
the method of obtaining said first time further comprises,
after the cache data is deleted, 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.
In the embodiment of the invention, if the terminal caches the corresponding relationship between the domain name address and the IP address, when the terminal accesses the domain name again, the terminal directly generates the connection establishment request message according to the cached IP address, the first time at this time is 0, which may affect the accuracy of judging the network connection state, so that when the terminal caches the corresponding relationship between the domain name address and the IP address, the cache is deleted, 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 cache data of the domain name address on judging the network connection state.
Based on the same inventive concept, an embodiment of the present specification further provides an apparatus for optimizing a page loading speed, as shown in fig. 5, the apparatus includes:
an internet protocol address obtaining time determining unit 501, configured to record, after receiving a domain name address selected by a user, a time for obtaining an internet protocol address corresponding to the domain name address from a domain name server as a first time;
a network connection establishment time determining unit 502, configured to send a request for establishing a network connection to a page server corresponding to the internet protocol address by using the internet protocol address, and record a time for establishing a network connection as a second time;
a network status determining unit 503, configured to determine whether the network connection status meets the requirement according to the first time and the second time;
a page compression instruction sending unit 504, 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 requirement, so that the page server compresses a page corresponding to the internet protocol, and returns the compressed page;
a page display unit 505, configured to display the compressed page to the user.
The advantages obtained by the device are consistent with those obtained by the method, and the embodiments of the present description are not repeated.
As shown in fig. 6, a computer device provided in this embodiment of the present invention, in which an apparatus in the present invention may be a computer device in this embodiment and execute the method of the present invention described above, may include one or more processors 604, such as one or more Central Processing Units (CPUs), each of which may implement one or more hardware threads. The computer device 602 may also include any memory 606 for storing any kind of information, such as code, settings, data, etc. For example, and without limitation, memory 606 may include any one or more of the following in combination: any type of RAM, any type of ROM, flash memory devices, hard disks, optical disks, 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 fixed or removable components of computer device 602. In one case, when the processor 604 executes the associated instructions, which are stored in any memory or combination of memories, the computer device 602 may perform any of the operations of the associated instructions. The computer device 602 also includes one or more drive mechanisms 608, such as a hard disk drive mechanism, an optical disk drive mechanism, etc., for interacting with any memory.
Computer device 602 may also include an input/output module 610 (I/O) for receiving various inputs (via input device 612) and for providing various outputs (via output device 614). One particular output mechanism may include a presentation device 616 and an associated Graphical User Interface (GUI) 618. In other embodiments, input/output module 610 (I/O), input device 612, and output device 614 may also be excluded, as just one computer device in a network. 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 above-described components together.
Communication link 622 may be implemented in any manner, such as through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. 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.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the above method.
Embodiments of the present invention further provide a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the foregoing method.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. A method for optimizing page loading speed, the method comprising:
after receiving a domain name address selected by a user, recording the time for acquiring an internet protocol address corresponding to the domain name address from a domain name server as first time;
sending a request for establishing network connection to a page server corresponding to the Internet protocol address by using the Internet protocol address, and recording the time for establishing network connection as second time;
determining whether the network connection state meets the requirement according to the first time and the second time;
if the network connection state does not meet the requirement, adding a page compression identifier into a 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;
and decompressing the compressed page and displaying the decompressed page to the user.
2. The method of claim 1, wherein determining whether a network connection status is satisfactory based on the first time and the second time further comprises,
judging whether the first time exceeds a first preset threshold value or not, and judging whether the second time exceeds a second preset threshold value or not;
and if the first time exceeds the first preset threshold value and the second time exceeds the second preset threshold value, the network connection state does not meet the requirement.
3. The method of claim 1, wherein recording a time of network connection establishment as the second time further comprises,
when the network connection is established, recording the response time of each message in a preset number of messages, wherein the preset number of messages are sent to the page server according to the sequence when the network connection is established;
and calculating the second time according to the response time of each message in the preset number of messages.
4. The method of claim 3, wherein calculating the second time based on the response time of each of the predetermined number of packets further comprises,
and calculating the total response time of the messages with the preset number, and taking the total response time as the second time.
5. The method of claim 1, wherein determining whether a network connection status is satisfactory based on the first time and the second time further comprises,
and determining a network connection state score according to the first time and the second time, and determining whether the network connection state meets the requirement or not according to the network connection state score.
6. The method of claim 5, wherein in the event the network connection status is unsatisfactory, the method further comprises,
determining a compressed data type corresponding to the network connection state score in a preset compressed data type list as a target compressed data type;
and generating 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.
7. The method of claim 6, wherein decompressing the compressed page and presenting the decompressed page to the user further comprises,
and decompressing the data corresponding to the target compressed data type in the compressed page to obtain the page, and displaying the page to the user.
8. The method of claim 1, wherein upon receiving a domain name address selected by a user, the method further comprises,
judging whether cached data of the domain name address exist or not, and if yes, deleting the cached data;
the method of obtaining the first time further comprises,
after the cache data is deleted, 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.
9. An apparatus for optimizing page loading speed, comprising:
the device comprises an Internet protocol address acquisition time determining unit, a domain name server and a domain name server, wherein the Internet protocol address acquisition time determining unit is used for recording the time of acquiring an Internet protocol address corresponding to a domain name address from the domain name server as first time after receiving the domain name address selected by a user;
a network connection establishment time determining unit, configured to send a network connection establishment request to a page server corresponding to the internet protocol address by using the internet protocol address, and record a network connection establishment time as a second time;
the network state determining unit is used for determining whether the network connection state meets the requirement according to the first time and the second time;
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 requirement, so that the page server compresses a page corresponding to the internet protocol, and returns the compressed page;
and the page display unit is used for displaying the compressed page to the user.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 8.
12. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 8.
CN202211135833.XA 2022-09-19 2022-09-19 Method and device for optimizing page loading speed Pending CN115529243A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211135833.XA CN115529243A (en) 2022-09-19 2022-09-19 Method and device for optimizing page loading speed

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211135833.XA CN115529243A (en) 2022-09-19 2022-09-19 Method and device for optimizing page loading speed

Publications (1)

Publication Number Publication Date
CN115529243A true CN115529243A (en) 2022-12-27

Family

ID=84697023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211135833.XA Pending CN115529243A (en) 2022-09-19 2022-09-19 Method and device for optimizing page loading speed

Country Status (1)

Country Link
CN (1) CN115529243A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010668B1 (en) * 2004-10-01 2011-08-30 F5 Networks, Inc. Selective compression for network connections
CN110287433A (en) * 2019-06-28 2019-09-27 北京金山安全软件有限公司 Network information processing method and device and electronic equipment
CN114090927A (en) * 2021-11-29 2022-02-25 中国平安财产保险股份有限公司 Page loading method and device, computer equipment and storage medium
CN115002097A (en) * 2022-04-25 2022-09-02 青岛海尔科技有限公司 Application image display method and device, storage medium and electronic device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010668B1 (en) * 2004-10-01 2011-08-30 F5 Networks, Inc. Selective compression for network connections
CN110287433A (en) * 2019-06-28 2019-09-27 北京金山安全软件有限公司 Network information processing method and device and electronic equipment
CN114090927A (en) * 2021-11-29 2022-02-25 中国平安财产保险股份有限公司 Page loading method and device, computer equipment and storage medium
CN115002097A (en) * 2022-04-25 2022-09-02 青岛海尔科技有限公司 Application image display method and device, storage medium and electronic device

Similar Documents

Publication Publication Date Title
US10212063B2 (en) Network aware distributed business transaction anomaly detection
US8493871B2 (en) End-to end analysis of transactions in networks with traffic-altering devices
CN111200830B (en) Data transmission method and device and electronic equipment
CN109547524B (en) User behavior storage method, device, equipment and storage medium based on Internet of things
US8341285B2 (en) Method and system for transferring files
US9935853B2 (en) Application centric network experience monitoring
CN112019407A (en) Forwarding equipment data testing method and device, computer equipment and storage medium
US8582447B2 (en) Loopback device and mirroring method
CN110826001A (en) Data acquisition request processing method and device, computer equipment and storage medium
US10432490B2 (en) Monitoring single content page application transitions
CN114500633A (en) Data forwarding method, related device, program product and data transmission system
CN109471713B (en) Method and device for inquiring information
CN112422604B (en) File uploading method, device and system and computer equipment
CN115529243A (en) Method and device for optimizing page loading speed
CN108494700B (en) Cross-link data transmission method and device, computer equipment and storage medium
US20170223136A1 (en) Any Web Page Reporting and Capture
CN114697205B (en) Log processing method and device
CN115086194A (en) Data transmission method for cloud application, computing equipment and computer storage medium
CN113536168B (en) Component processing method and device
CN113411228B (en) Network condition determining method and server
US20170222904A1 (en) Distributed Business Transaction Specific Network Data Capture
CN112688982B (en) User request processing method and device
CN109669846B (en) Management information query method, device and computer readable medium
JP6787845B2 (en) Suspected location estimation device and suspected location estimation method
CN112769960A (en) Active flow control method and system based on Nginx server

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