CN113285979A - Network request processing method, device, terminal and storage medium - Google Patents

Network request processing method, device, terminal and storage medium Download PDF

Info

Publication number
CN113285979A
CN113285979A CN202110407067.7A CN202110407067A CN113285979A CN 113285979 A CN113285979 A CN 113285979A CN 202110407067 A CN202110407067 A CN 202110407067A CN 113285979 A CN113285979 A CN 113285979A
Authority
CN
China
Prior art keywords
domain name
connection
target
network request
name resolution
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.)
Granted
Application number
CN202110407067.7A
Other languages
Chinese (zh)
Other versions
CN113285979B (en
Inventor
谈晶晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202110407067.7A priority Critical patent/CN113285979B/en
Publication of CN113285979A publication Critical patent/CN113285979A/en
Application granted granted Critical
Publication of CN113285979B publication Critical patent/CN113285979B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]

Abstract

The embodiment of the invention provides a network request processing method, a device, a terminal and a storage medium, wherein the method comprises the following steps: acquiring a network request, determining a target domain name to which the network request belongs, and searching a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a predetermined candidate domain name, the target connection is a connection corresponding to a candidate domain name matched with the target domain name, and if the target connection is found, the target connection is used for sending request data to the server; in the embodiment of the invention, because the connection corresponding to the predetermined candidate domain name is established, after the target domain name to which the network request belongs is obtained, the connection corresponding to the candidate domain name matched with the target domain name can be directly used for sending the request data to the server, so that the time spent in the network request process can be saved when the network request is actually sent, and the network request processing efficiency is improved.

Description

Network request processing method, device, terminal and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a network request processing method, an apparatus, a terminal, and a storage medium.
Background
With the development of network technology, people rely more and more on obtaining information needed by themselves through a network. Specifically, one may use a terminal (e.g., smartphone, tablet, computer, etc.) to send a network request to obtain a corresponding result presentation.
In the prior art, the network request is generally an HTTP/HTTPs (Hyper Text Transfer Protocol/Hyper Text Transfer Protocol over secure Layer) network request. Sending an HTTP/HTTPs network request to receive a request response typically involves at least several stages of domain name resolution, establishing a connection, sending the request data, receiving the response, and so on. Therefore, the time spent by the user from clicking the link to receiving the returned page is long, and especially in the environment with slow network speed, the user experience is greatly influenced.
Disclosure of Invention
The invention provides a network request processing method, a network request processing device, a terminal and a computer readable storage medium, which are used for solving the problem that the network request process takes long time in the prior art to a certain extent.
According to a first aspect of the present invention, there is provided a network request processing method, which is applied to a client and includes:
acquiring a network request and determining a target domain name to which the network request belongs;
searching for a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a candidate domain name, and the target connection is a connection corresponding to the target domain name;
and if the target connection is found, sending request data to a server by using the target connection.
Optionally, before the obtaining the network request, the method further includes:
determining a candidate domain name;
acquiring a corresponding domain name resolution result according to the candidate domain name, and storing the domain name resolution result; the domain name resolution result comprises a plurality of IP addresses;
and selecting at least one IP address from the stored domain name resolution result to establish pre-connection, and storing the pre-connection.
Optionally, the determining the candidate domain name includes:
acquiring a preset service flow;
determining a current process node corresponding to the current service from the preset service process;
and determining the domain name corresponding to the candidate process node after the current process node as the candidate domain name according to the preset service process.
Optionally, the determining the candidate domain name includes:
acquiring historical access data;
determining a preset number of domain names with domain name resolution time exceeding a preset resolution time threshold value from the historical access data as the candidate domain names; alternatively, the first and second electrodes may be,
and sorting the domain name resolution time/domain name resolution time ratio in the historical access data, and taking the domain name with the longest domain name resolution time/the largest domain name resolution time ratio and a preset number as the candidate domain name.
Optionally, the method further comprises:
if the target connection cannot be found in the preset connections, searching a target domain name resolution result matched with the target domain name from the stored domain name resolution results;
and establishing connection by using any IP address in the target domain name resolution result.
Optionally, the method further comprises:
judging whether the pre-connected idle time exceeds a preset idle time threshold;
and if so, disconnecting the pre-connection.
Optionally, the method further comprises:
judging whether the time for storing the domain name resolution result exceeds a preset storage time threshold or not;
and if so, updating the domain name resolution result.
According to a second aspect of the present invention, there is provided a network request processing apparatus, comprising:
the domain name determining module is used for acquiring a network request and determining a target domain name to which the network request belongs;
a first search module for searching for a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a candidate domain name, and the target connection is a connection corresponding to the target domain name;
and the data sending module is used for sending request data to a server by using the target connection if the target connection is found.
Optionally, the apparatus further comprises:
the candidate domain name determining module is used for determining a candidate domain name;
the domain name resolution module is used for acquiring a corresponding domain name resolution result according to the candidate domain name and storing the domain name resolution result; the domain name resolution result comprises a plurality of IP addresses;
and the pre-connection module is used for selecting at least one IP address from the stored domain name resolution result to establish pre-connection and storing the pre-connection.
Optionally, the candidate domain name determining module includes:
the business process obtaining submodule is used for obtaining a preset business process;
a current node determining submodule, configured to determine a current process node corresponding to a current service from the preset service process;
and the first determining submodule is used for determining the domain name corresponding to the candidate process node behind the current process node as the candidate domain name according to the preset service process.
Optionally, the candidate domain name determining module includes:
the historical data acquisition submodule is used for acquiring historical access data;
a second determining sub-module, configured to determine, from the historical access data, a preset number of domain names whose domain name resolution time exceeds a preset resolution time threshold as the candidate domain names; alternatively, the first and second electrodes may be,
the domain name resolution time/domain name resolution time ratio in the historical access data is ranked, and the domain name with the longest domain name resolution time/the largest domain name resolution time ratio and the preset number of domain names is used as the candidate domain name.
Optionally, the apparatus further comprises:
the second searching module is used for searching a target domain name resolution result matched with the target domain name from the stored domain name resolution results if the target connection cannot be searched in the preset connections;
and the connection establishing module is used for establishing connection by using any IP address in the target domain name resolution result.
Optionally, the apparatus further comprises:
the first judgment module is used for judging whether the pre-connected idle time exceeds a preset idle time threshold value;
and the disconnection module is used for disconnecting the pre-connection if the idle time of the pre-connection exceeds a preset idle time threshold.
Optionally, the apparatus further comprises:
the second judgment module is used for judging whether the time for storing the domain name resolution result exceeds a preset storage time threshold value or not;
and the updating result module is used for updating the domain name resolution result if the time for storing the domain name resolution result exceeds the preset storage time threshold.
According to a third aspect of the present invention, there is provided a terminal comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the network request processing method according to any of the first aspect.
According to a fourth aspect of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the network request processing method according to any one of the first aspects.
Compared with the background art, the embodiment of the invention has the following advantages:
in the embodiment of the invention, the target domain name to which the network request belongs is determined by acquiring the network request, and then the target connection is searched from a plurality of pre-connections; the pre-connection is a connection corresponding to the candidate domain name, the target connection is a connection corresponding to the candidate domain name matched with the target domain name, and if the target connection is found, the target connection is used for sending request data to the server; in the embodiment of the invention, aiming at the problem that the time proportion of domain name resolution and connection establishment is large in the network request processing process, the connection corresponding to the candidate domain name is established in advance, and after the target domain name to which the network request belongs is obtained, the connection corresponding to the candidate domain name matched with the target domain name can be directly used for sending the request data to the server, so that the time spent in the network request process can be saved when the network request is actually sent, and the network request processing efficiency is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flowchart illustrating steps of a network request processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart illustrating steps of another network request processing method according to an embodiment of the present invention;
fig. 3 is a schematic view of an overall scheme design flow of a network request processing method according to an embodiment of the present invention;
fig. 4 is a schematic structural block diagram of a network request processing apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
According to research, in the process from sending an HTTP/HTTPS network request to receiving a request response, a Domain Name System (DNS) Domain Name resolution stage generally comprises 1 Round-Trip Time (RTT), and in a connection establishing stage, if the HTTP network request is sent, 1 RTT is needed; if the transmitted request is an HTTPS network request, 2-3 RTTs are needed; the data request sending and response receiving phases are generally greater than or equal to 1 RTT, and are positively correlated with the data volume of the data request sending. It can be seen that the time occupied by the DNS domain name resolution phase and the connection establishment phase occupies a great proportion in the whole process from sending the network request to receiving the request response, and especially, the influence is greater when the data volume of the data request is smaller.
In view of this, the idea of the present invention is that, in the process of sending a network request to receiving a request response, processing operations (DNS domain name resolution stage and connection establishment stage) which are necessary to be executed and have a large proportion of time are performed, and relevant information is processed and stored in advance before the network request is actually sent, so that when the network request is actually needed to be sent, a DNS domain name resolution result and connection corresponding to the network request which is actually needed to be sent can be directly obtained from the relevant information which is processed and stored in advance, thereby saving the time of the request, further improving the efficiency of network request processing, and enabling the user experience effect to be better.
Referring to fig. 1, a schematic flowchart illustrating steps of a network request processing method according to an embodiment of the present invention is shown, where the method may be applied to a client, and the client refers to a program that corresponds to a server and provides a service. The client may run on a variety of devices that may be used by the user, including but not limited to smart phones, tablets, Personal Digital Assistants (PDAs), Mobile Internet Devices (MIDs), and the like. Therefore, the client can be a mobile phone client, a tablet computer client and the like according to the device division for operating the client. The client can be a social application client, a shopping application client, a news client, or the like according to the type of the client, and is not limited to any one of the above in specific implementation.
The method provided by this embodiment may specifically include the following steps:
step 101, acquiring a network request, and determining a target domain name to which the network request belongs.
The network request acquisition comprises the network request initiated by user operation and the network request initiated by the client. The network request initiated by the user operation may be a process of clicking a link of a service when the user needs to access a relevant service of the client, that is, initiating the network request by the user operation; the specific scenario may be that, after the user starts the client, if the function provided by the client needs to be used, the user needs to log in the related account first, and at this time, the network request related to the login is initiated by receiving an operation that the user clicks a login account control.
The network request actively initiated by the client may be a network request actively sending a network request associated with a certain service when the service is executed; the specific scenario may be that when the client executes a service of displaying a recommended page of the top page, the client may actively send a network request for loading a tab page adjacent to the recommended page; or, when the client executes the start service, the client may actively send a network request for loading the history data at a set time after the start is completed.
The network request includes domain name information, so that the target domain name to which the network request belongs can be determined according to the acquired network request.
Step 102, searching a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a candidate domain name, and the target connection is a connection corresponding to the target domain name.
In this embodiment, before a user initiates a network request, a plurality of candidate domain names may be predetermined, and a domain name resolution request may be sent to the DNS server based on each predetermined candidate domain name, and then a domain name resolution result corresponding to the candidate domain name, which is returned by the DNS server, that is, an IP address list may be obtained, and then at least one IP address may be selected from the IP address list to establish a connection, and the established connection is stored as a pre-connection. The connection and the domain name have a corresponding relation, namely the website data of the domain name can be obtained through the connection corresponding to the domain name, and when one connection is obtained, the domain name corresponding to the connection can be directly obtained; and when a domain name is acquired, finding the corresponding connection according to the domain name.
The process of establishing connection with the IP address is related to a Transmission Protocol of the network request, for example, when the network request is an HTTP request, a TCP (Transmission Control Protocol) connection is performed on the IP address. When the network request is an HTTPS request, after TCP connection is performed on the IP address, TLS (Transport Layer Security) connection is continued.
When a user initiates a network request, a target domain name to which the network request belongs can be obtained. Each pre-connection can obtain a corresponding candidate domain name; and searching a target candidate domain name matched with the target domain name from a plurality of candidate domain names corresponding to the target domain name in advance according to the target domain name, and determining the corresponding pre-connection as the target connection of the target domain name according to the target candidate domain name.
In the specific implementation, after the client is started and before the network request is received, the pre-connection is to predict the network request to be received, and to process the work of the two stages of domain name resolution and connection establishment in advance, so that when the network request is actually received, the work of the two stages of domain name resolution and connection establishment is already processed in advance, and therefore, the pre-connection obtained by the pre-processing can be directly adopted to send request data, the time for processing the network request can be saved, and the response speed is improved.
Due to network resource considerations, the probability that the target connection can be found among multiple pre-connections should be increased, and ideally, multiple pre-connections should be used. In view of this, how to determine a ring where pre-connection is critical is to determine the appropriate candidate domain name first.
In this embodiment, the candidate domain name may be determined according to a certain rule, and specifically, the determining of the candidate domain name may include determining the candidate domain name according to historical access data of the client, and/or determining the candidate domain name according to a service flow preset by the client. In the process of determining the candidate domain name according to the historical access data of the client, determining a historical access service process according to the historical access data, further determining the candidate domain name according to the historical access service process, and determining the domain name with longer historical access time domain name resolution time as the candidate domain name according to the historical access data. The method comprises the steps of determining a candidate domain name according to a historical visited business process and determining the candidate domain name according to a preset business process of a client, wherein the difference is that the determination process of the business process is different, and after the business process is determined, the process of further determining the candidate domain name is similar.
The service process preset by the client can be a service process set in the client development process, and taking a social application client as an example, when a user uses the client, the user account needs to be logged in first, and then the related functions of the client can be normally used; at this time, the set business process can be that the client starts and logs in the account; that is, when the client is started, during the period of starting the screen advertisement of the client, the steps of domain name resolution and connection establishment can be performed on the domain name of the login account in advance, and after the screen advertisement is started, the user can enter the main page of the client firstly; since the user uses the functions in the main page, the user must log in the account, obviously, the user will perform the login operation in the next step, that is, send the network request of logging in the account; the domain name of the login account is subjected to domain name resolution and connection establishment in advance, and at the moment, the request data of the login account can be directly sent by using the connection established in advance, so that the network request processing time is saved during actual operation.
And 103, if the target connection is found, sending request data to a server by using the target connection.
When the target connection corresponding to the target domain name is found, the target connection can be directly used for sending the request data to the server, so that the time from the network request sending to the corresponding result display process is saved.
When the target connection corresponding to the target domain name cannot be found, the target candidate domain name matched with the target domain name can be found from the multiple candidate domain names, the domain name resolution result corresponding to the target candidate domain name is obtained and used as the target resolution result of the target domain name, and then one IP address is selected from the IP address list of the target resolution result to establish connection; finally, the established connection is used for sending request data to the server; the time spent in the domain name resolution stage can be saved, and the efficiency of network request processing is improved.
According to the network request processing method provided by the embodiment of the invention, the target domain name to which the network request belongs can be determined by acquiring the network request, and then the target connection is searched from a plurality of pre-connections; the pre-connection is a connection corresponding to a predetermined candidate domain name, the target connection is a connection corresponding to a candidate domain name matched with the target domain name, and finally, the target connection is used for sending request data to the server; in the embodiment of the invention, because the connection corresponding to the predetermined candidate domain name is established, after the target domain name to which the network request belongs is obtained, the connection corresponding to the candidate domain name matched with the target domain name can be directly used for sending the request data to the server, so that the time spent in the network request process can be saved when the network request is actually sent, and the network request processing efficiency is improved.
Fig. 2 is a flowchart of steps of another network request processing method according to an embodiment of the present invention, where the method may include:
step 201, determining candidate domain names.
In this embodiment, the candidate domain name may refer to a domain name for which no network request is received. The candidate domain name is a domain name for which a network request will be received within a specified time period in the future. For example, the candidate domain name should have a characteristic that the domain name matches a domain name of a network request received in a future specified time period or a matching rate reaches a set matching rate threshold, and/or a characteristic that the domain name resolution occupies a time exceeding a preset duration or a preset occupation ratio in the network request processing process.
In an alternative embodiment, the step 201 may include the following sub-steps:
acquiring historical access data;
determining a preset number of domain names with domain name resolution time exceeding a preset resolution time threshold value from the historical access data as the candidate domain names; alternatively, the first and second electrodes may be,
sorting domain name resolution time/domain name resolution time ratios in the historical access data, and taking the domain names with the longest domain name resolution time and a preset number as the candidate domain names; alternatively, the first and second electrodes may be,
determining the number of times of resolution of each domain name from the historical access data, and taking the domain name with the number of times exceeding a preset number of times as the candidate domain name; alternatively, the first and second electrodes may be,
and sorting the domain names in the historical access data according to the times of resolution, and taking the domain names with the most times and the preset number as the candidate domain names.
The historical access data may be access data of the last week, access data of the last month, or the like, and this embodiment does not specifically limit this.
Because the time occupied by the DNS domain name resolution stage and the connection establishment stage is larger in proportion, historical access data of the client can be acquired from a monitoring system in specific implementation; then, according to the relation between the time spent in the domain name resolution stage when the network request is processed historically and a preset resolution time threshold, selecting a preset number of domain names as candidate domain names from the domain names of which the domain name resolution time exceeds the preset resolution time threshold; in this embodiment, the setting of the preset analysis time threshold and the preset number is not particularly limited.
Or after the time consumed in the domain name resolution stage when the network request is processed historically is obtained, sorting is performed according to the domain name resolution time, and the domain names with the longest domain name resolution time and the preset number are used as candidate domain names. In this embodiment, the setting of the preset number is not particularly limited.
In another specific implementation, after obtaining the historical access data of the client, the time ratio of the time consumed in the domain name resolution stage in the corresponding network request process can be obtained from the historical access data. And sequencing according to the domain name resolution time ratio, and taking the domain name with the largest domain name resolution time ratio and the preset number as a candidate domain name. In this embodiment, the setting of the preset number is not particularly limited.
According to the method and the device, the domain name with longer historical domain name resolution time is obtained through the historical access data, the domain name can be used as a candidate domain name, the steps of domain name resolution and connection establishment are carried out on the candidate domain name in advance, the time of a DNS domain name resolution stage and the time of a connection establishment stage are saved, and the time of actually processing the network request is also reduced.
In another specific implementation, after obtaining the historical access data of the client, the number of times of each domain name resolution may be obtained from the historical access data. And taking the domain name with the frequency exceeding the preset frequency as a candidate domain name. Illustratively, when the historical access data is the access data of the last week, the preset number of times may be 7 times, or 10 times, and the preset number of times is not particularly limited in the present embodiment.
In another specific implementation, after obtaining the historical access data of the client, the number of times of domain name resolution may be obtained from the historical access data, and then sorting is performed according to the number of times of domain name resolution, and the domain name with the largest number of times and a preset number is used as the candidate domain name. In this embodiment, the setting of the preset number is not particularly limited.
In the embodiment, the times of each domain name resolution during historical domain name resolution are obtained through historical access data, the domain name with more resolution times or more than the preset times is used as a candidate domain name, and the steps of domain name resolution and connection establishment are performed on the candidate domain name in advance, so that the time for actually processing the network request is reduced.
It should be noted that, in this embodiment, the candidate domain name may also be determined by combining the number of times of domain name resolution and the time of domain name resolution.
In another alternative embodiment, the step 201 may include the following sub-steps:
acquiring a preset service flow;
determining a current process node corresponding to the current service from the preset service process;
and determining the domain name corresponding to the candidate process node after the current process node as the candidate domain name according to the preset service process.
In this embodiment, the business process may be considered as a sequence generated by a plurality of business requirements; the preset service flow may be a service flow determined according to historical access data, or a service flow set in the client development process, which is not limited in the present invention.
Each process node in the service process corresponds to a service, and the process of responding to the service can be regarded as a process of processing a network request, namely before responding to the service, acquiring a network request initiated aiming at the service, acquiring a corresponding target domain name according to the network request, performing domain name resolution and connection establishment on the target domain name, then sending request data, and finally receiving a response. The service may include downloading configuration, jumping to a page, etc.
In the specific implementation, the position of the current service in the preset service flow is determined, namely, the current flow node; determining a process node behind the current process node according to the business process, namely a candidate process node; it can be considered that the service corresponding to the candidate process node closest to the current process node is the service that the user will need to use, and therefore, the domain name of the service that will need to be used is obtained as the candidate domain name. Because the user operation has certain subjectivity, in order to ensure that the target domain name to which the network request to be sent by the user belongs can be in the candidate domain names to a greater extent, the domain name corresponding to the preset number of candidate process nodes closest to the current process node can be selected as the candidate domain name. In this embodiment, the setting of the preset number is not particularly limited.
Illustratively, taking a certain video application as an example, the preset business process of the video application is starting → starting screen advertisement → entering a video home page recommendation page → entering a tab page adjacent to the recommendation page; during the period of playing the startup screen advertisement after the video application is started, the candidate process node can be determined as entering the video home page recommendation page, so that the domain name corresponding to the video home page recommendation page is taken as the candidate domain name; when the current process node of the video application is a recommended page of a video home page, the candidate process node is a label page adjacent to the recommended page, and at the moment, the candidate domain name is a domain name corresponding to the label page adjacent to the recommended page.
After determining the candidate domain name, sending a domain name resolution request aiming at the candidate domain name to a DNS server, obtaining a corresponding domain name resolution result comprising a plurality of IP addresses, selecting at least one IP address from the domain name resolution result to establish pre-connection while keeping the domain name resolution result, and storing the pre-connection. When the currently displayed page of the video application program is a video home page recommended page, the right sliding operation of a user is received, and a network request for acquiring the tab page adjacent to the right of the recommended page is generated.
In the embodiment, the network request to be sent by the user is predicted from the service angle, the domain name to which the predicted network request belongs is taken as a candidate domain name, the steps of domain name resolution and connection establishment are performed in advance, and the time for actually processing the network request is reduced.
It should be noted that, in a specific implementation, the candidate domain name may also be determined by combining the above-mentioned determination of the candidate domain name by the historical access data and the above-mentioned determination of the candidate domain name by the preset service process.
Step 202, acquiring a corresponding domain name resolution result according to the candidate domain name, and storing the domain name resolution result; the domain name resolution result comprises a plurality of IP addresses.
In this embodiment, after determining the candidate domain name, a domain name resolution request for the candidate domain name may be sent to the DNS server, and the DNS server performs domain name resolution on the candidate domain name to obtain a domain name resolution result of the candidate domain name, where the domain name resolution result is generally an IP address list including a plurality of IP addresses; and then saving the domain name resolution result in a local cache for subsequent use.
It should be noted that, in the embodiment of the present invention, a process of obtaining a domain name resolution result corresponding to a candidate domain name in the above example is not limited, for example, in an actual application, after a candidate domain name is determined, a domain name resolution request for the candidate domain name is sent to a DNS server, the DNS server forwards the domain name resolution request to a server in charge of the candidate domain name, and receives a domain name resolution result corresponding to the candidate domain name returned by the server in charge of the candidate domain name.
Step 203, selecting at least one IP address from the saved domain name resolution result to establish pre-connection, and saving the pre-connection.
In this embodiment, after obtaining domain name resolution results (multiple IP address lists) corresponding to multiple candidate domain names, one of the IP addresses may be selected from each IP address list to establish a pre-connection, or a partial IP address list may be selected from the multiple IP address lists, and then one of the IP addresses is selected from each IP address list of the partial IP address list to establish a pre-connection.
It should be noted that, in the process of selecting an IP address from the IP address list to establish a pre-connection, the IP addresses may be sequentially selected from the IP address list according to a preset sequence to attempt to establish the pre-connection until the pre-connection is successfully established; it is also possible to randomly select an IP address from the IP address list to attempt to establish a pre-connection until the pre-connection establishment is successful. The embodiments of the present invention are not limited in this regard.
After establishing the pre-connection, the pre-connection is saved for subsequent use. Specifically, the pre-connection may be placed in a local connection pool for management.
Step 204, acquiring the network request, and determining a target domain name to which the network request belongs.
Specifically, the implementation manner of this step may refer to step 101 described above, and details of the embodiment of the present invention are not described herein.
Step 205, searching a target connection from a plurality of pre-connections; the target connection is a connection corresponding to the candidate domain name that matches the target domain name.
In this embodiment, when the network request is acquired, a target domain name to which the network request belongs is determined, and whether a target connection corresponding to the target domain name exists is searched from the connection pool according to the target domain name. Specifically, the connection pool includes a plurality of pre-connections and candidate domain names corresponding to the pre-connections, and it is possible to search whether a target candidate domain name matching the target domain name exists in a manner of traversing the candidate domain names in the connection pool, and if so, further obtain the pre-connections of the target candidate domain name as the target connections according to the correspondence between the pre-connections and the candidate domain names.
Further, in an alternative embodiment, to conserve network resources, a timer may be started for pre-connections in the connection pool. And processing the pre-connected connection state by judging whether the pre-connected idle time exceeds a preset idle time threshold. For example, when the idle time of the pre-connection exceeds a preset idle time threshold, the pre-connection is disconnected. Here, the idle time refers to a time when the pre-connection is not used. Optionally, when the pre-connection is used within the preset idle time threshold, the timer may be restarted after the use to calculate the idle time of the pre-connection.
Step 206, the target connection is used to send the request data to the server.
When the target connection corresponding to the target domain name is found, the target connection can be directly used for sending the request data to the server, so that the time from the network request sending to the corresponding result display process is saved.
Further, in an optional embodiment, the method further includes:
if the target connection cannot be found in the preset connections, searching a target domain name resolution result matched with the target domain name from the stored domain name resolution results;
and establishing connection by using any IP address in the target domain name resolution result.
In this embodiment, in the process of establishing the preset connection, the preset connection may be selectively established for the IP address in the partial domain name resolution result; in practical application, the connection may be unsuccessful in the process of establishing the preset connection, and the established preset connection may be disconnected; therefore, when the target connection cannot be found in the connection pool, the target domain name resolution result matched with the target domain name can be found from the stored domain name resolution results.
Specifically, the corresponding candidate domain name can be determined according to the domain name resolution result; whether a target candidate domain name matched with the target domain name exists can be searched in a mode of traversing the candidate domain names corresponding to the domain name resolution results; if the target domain name exists, further acquiring a domain name resolution result of the target candidate domain name as a target domain name resolution result according to the corresponding relation between the domain name resolution result and the candidate domain name. And then selecting one IP address from the target domain name resolution result to establish connection. The process of specifically selecting an IP address, and the process of establishing a connection with the IP address are related to the transmission protocol of the network request, which can be referred to the foregoing description, and are not described herein again.
In the embodiment of the invention, when the target connection cannot be found in the connection pool, the time spent in the domain name resolution stage can be saved and the network request processing efficiency can be improved by finding the target domain name resolution result corresponding to the target domain name from the domain name resolution result and then establishing the connection according to the found target domain name resolution result.
Further, in order to ensure the validity of the stored domain name resolution result, the domain name resolution result can be periodically refreshed; specifically, whether the time for storing the domain name resolution result exceeds a preset storage time threshold can be judged, and if not, the domain name resolution result is defaulted to be not overdue; if yes, updating the domain name resolution result, namely when the time for storing the domain name resolution result exceeds a preset storage time threshold, the domain name resolution result is considered to be overdue, at the moment, a domain name resolution request aiming at the candidate domain name needs to be sent again to obtain a latest domain name resolution result, and the stored domain name resolution result is updated by adopting the latest domain name resolution result.
In order to make those skilled in the art more clearly understand the technical solution of the present invention, the network request processing method provided in the embodiment of the present invention will be described below with reference to fig. 3.
FIG. 3 is a flowchart illustrating an overall design of a network request processing method according to an embodiment of the present invention; the method specifically comprises the following steps:
step 301, APP (Application) is started or network status is changed; step 302 is executed generally when the application program is started or the network status changes;
step 302, performing domain name resolution of the core domain name; the core domain name is a candidate domain name determined by a preset rule, a domain name resolution request is sent to the determined candidate domain name, and a domain name resolution result is received;
step 303, local domain name resolution caching; storing the obtained domain name resolution result into a local domain name resolution cache;
step 304, establishing the connection of the core domain name; further establishing connection for the candidate domain name after completing domain name resolution;
step 305, connecting the pool; putting the established connection into a connection pool;
step 306, starting to send a network request; namely, receiving a network request sent by user operation, or actively sending the network request according to a response service;
step 307, searching a connection pool; searching a target connection corresponding to the network request from the established connections stored in the connection pool;
step 308, judging whether a target connection is found; if yes, go to step 313; if not, go to step 309;
step 309, searching a local domain name resolution cache; when the target connection cannot be found, a target domain name resolution result corresponding to the network request is found from the local domain name resolution cache;
step 310, judging whether a target domain name resolution result is found; if yes, go to step 312; if not, go to step 311;
step 311, performing domain name resolution; when the target domain name resolution result cannot be searched in the local domain name resolution cache, sending a domain name resolution request according to a target domain name corresponding to the network request to obtain a corresponding target domain name resolution result;
step 312, executing creating connection; creating a target connection using target domain name resolution;
step 313, sending request data; sending the request data using the target connection;
step 314, receiving response data; when the response data is received, a complete network request procedure is ended.
When a client is started or a network state is changed, a candidate domain name is predetermined, a domain name resolution request aiming at the candidate domain name is sent to obtain a domain name resolution result corresponding to the candidate domain name, the domain name resolution result is stored, meanwhile, a connection is established by utilizing the domain name resolution result, and the established connection is placed into a connection pool; when a network request is received, firstly, judging whether available connection exists in a connection pool or not, and if so, directly using the existing available connection to send request data; if the domain name does not exist, searching an available domain name resolution result from the stored domain name resolution result, and if the domain name is obtained through searching, directly establishing connection by using the stored available domain name resolution result. Efficiency of network request processing can be achieved.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 4, a schematic block diagram of a network request processing apparatus according to an embodiment of the present invention is shown, which may specifically include the following modules:
a domain name determining module 401, configured to obtain a network request and determine a target domain name to which the network request belongs;
a first searching module 402 for searching for a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a candidate domain name, and the target connection is a connection corresponding to the target domain name;
a data sending module 403, configured to send request data to a server by using the target connection if the target connection is found.
Optionally, the apparatus further comprises:
the candidate domain name determining module is used for determining a candidate domain name;
the domain name resolution module is used for acquiring a corresponding domain name resolution result according to the candidate domain name and storing the domain name resolution result; the domain name resolution result comprises a plurality of IP addresses;
and the pre-connection module is used for selecting at least one IP address from the stored domain name resolution result to establish pre-connection and storing the pre-connection.
Optionally, the candidate domain name determining module includes:
the business process obtaining submodule is used for obtaining a preset business process;
a current node determining submodule, configured to determine a current process node corresponding to a current service from the preset service process;
and the first determining submodule is used for determining the domain name corresponding to the candidate process node behind the current process node as the candidate domain name according to the preset service process.
Optionally, the candidate domain name determining module includes:
the historical data acquisition submodule is used for acquiring historical access data;
a second determining sub-module, configured to determine, from the historical access data, a preset number of domain names whose domain name resolution time exceeds a preset resolution time threshold as the candidate domain names; alternatively, the first and second electrodes may be,
the domain name resolution time/domain name resolution time ratio in the historical access data is ranked, and the domain name with the longest domain name resolution time/the largest domain name resolution time ratio and the preset number of domain names is used as the candidate domain name.
Optionally, the apparatus further comprises:
the second searching module is used for searching a target domain name resolution result matched with the target domain name from the stored domain name resolution results if the target connection cannot be searched in the preset connections;
and the connection establishing module is used for establishing connection by using any IP address in the target domain name resolution result.
Optionally, the apparatus further comprises:
the first judgment module is used for judging whether the pre-connected idle time exceeds a preset idle time threshold value;
and the disconnection module is used for disconnecting the pre-connection if the idle time of the pre-connection exceeds a preset idle time threshold.
Optionally, the apparatus further comprises:
the second judgment module is used for judging whether the time for storing the domain name resolution result exceeds a preset storage time threshold value or not;
and the updating result module is used for updating the domain name resolution result if the time for storing the domain name resolution result exceeds the preset storage time threshold.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiment of the present invention further provides a terminal, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when being executed by the processor, the computer program implements each process of the above-described network request processing method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the processes of the above-described network request processing method embodiment are implemented, and the same technical effects can be achieved, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As is readily imaginable to the person skilled in the art: any combination of the above embodiments is possible, and thus any combination between the above embodiments is an embodiment of the present invention, but the present disclosure is not necessarily detailed herein for reasons of space.
The network request processing methods provided herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The structure required to construct a system incorporating aspects of the present invention will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the network request processing method according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (10)

1. A network request processing method, comprising:
acquiring a network request and determining a target domain name to which the network request belongs;
searching for a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a candidate domain name, and the target connection is a connection corresponding to the target domain name;
and if the target connection is found, sending request data to a server by using the target connection.
2. The method of claim 1, wherein prior to said obtaining the network request, the method further comprises:
determining a candidate domain name;
acquiring a corresponding domain name resolution result according to the candidate domain name, and storing the domain name resolution result; the domain name resolution result comprises a plurality of IP addresses;
and selecting at least one IP address from the stored domain name resolution result to establish pre-connection, and storing the pre-connection.
3. The method of claim 2, wherein the determining the candidate domain name comprises:
acquiring a preset service flow;
determining a current process node corresponding to the current service from the preset service process;
and determining the domain name corresponding to the candidate process node after the current process node as the candidate domain name according to the preset service process.
4. The method of claim 2 or 3, wherein the determining the candidate domain name comprises:
acquiring historical access data;
determining a preset number of domain names with domain name resolution time exceeding a preset resolution time threshold value from the historical access data as the candidate domain names; alternatively, the first and second electrodes may be,
and sorting the domain name resolution time/domain name resolution time ratio in the historical access data, and taking the domain name with the longest domain name resolution time/the largest domain name resolution time ratio and a preset number as the candidate domain name.
5. The method of claim 4, further comprising:
if the target connection cannot be found in the preset connections, searching a target domain name resolution result matched with the target domain name from the stored domain name resolution results;
and establishing connection by using any IP address in the target domain name resolution result.
6. The method of claim 5, further comprising:
judging whether the pre-connected idle time exceeds a preset idle time threshold;
and if so, disconnecting the pre-connection.
7. The method of claim 6, further comprising:
judging whether the time for storing the domain name resolution result exceeds a preset storage time threshold or not;
and if so, updating the domain name resolution result.
8. A network request processing apparatus, comprising:
the domain name determining module is used for acquiring a network request and determining a target domain name to which the network request belongs;
a first search module for searching for a target connection from a plurality of pre-connections; the pre-connection is a connection corresponding to a candidate domain name, and the target connection is a connection corresponding to the target domain name;
and the data sending module is used for sending request data to a server by using the target connection if the target connection is found.
9. A terminal, comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing a network request processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the network request processing method according to any one of claims 1 to 7.
CN202110407067.7A 2021-04-15 2021-04-15 Network request processing method, device, terminal and storage medium Active CN113285979B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110407067.7A CN113285979B (en) 2021-04-15 2021-04-15 Network request processing method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110407067.7A CN113285979B (en) 2021-04-15 2021-04-15 Network request processing method, device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN113285979A true CN113285979A (en) 2021-08-20
CN113285979B CN113285979B (en) 2022-11-29

Family

ID=77276857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110407067.7A Active CN113285979B (en) 2021-04-15 2021-04-15 Network request processing method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN113285979B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114124891A (en) * 2021-10-25 2022-03-01 青岛海尔科技有限公司 Network request processing method and device, storage medium and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150106231A1 (en) * 2013-10-10 2015-04-16 Go Daddy Operating Company, LLC System and method for candidate domain name generation
CN105306609A (en) * 2014-06-26 2016-02-03 优视科技有限公司 Network loading processing method and device
CN106921699A (en) * 2015-12-25 2017-07-04 北京奇虎科技有限公司 A kind of Network Access Method, device and system
CN109241483A (en) * 2018-08-31 2019-01-18 中国科学院计算技术研究所 A kind of website discovery method and system recommended based on domain name
CN109413229A (en) * 2018-12-20 2019-03-01 全链通有限公司 Domain name analytic method, equipment, system and storage medium
CN110636072A (en) * 2019-09-26 2019-12-31 腾讯科技(深圳)有限公司 Target domain name scheduling method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150106231A1 (en) * 2013-10-10 2015-04-16 Go Daddy Operating Company, LLC System and method for candidate domain name generation
CN105306609A (en) * 2014-06-26 2016-02-03 优视科技有限公司 Network loading processing method and device
CN106921699A (en) * 2015-12-25 2017-07-04 北京奇虎科技有限公司 A kind of Network Access Method, device and system
CN109241483A (en) * 2018-08-31 2019-01-18 中国科学院计算技术研究所 A kind of website discovery method and system recommended based on domain name
CN109413229A (en) * 2018-12-20 2019-03-01 全链通有限公司 Domain name analytic method, equipment, system and storage medium
CN110636072A (en) * 2019-09-26 2019-12-31 腾讯科技(深圳)有限公司 Target domain name scheduling method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114124891A (en) * 2021-10-25 2022-03-01 青岛海尔科技有限公司 Network request processing method and device, storage medium and electronic device
CN114124891B (en) * 2021-10-25 2023-12-19 青岛海尔科技有限公司 Processing method and device of network request, storage medium and electronic device

Also Published As

Publication number Publication date
CN113285979B (en) 2022-11-29

Similar Documents

Publication Publication Date Title
EP2985705A2 (en) Webpage access method and apparatus, and router
CN109644154B (en) Location-based access control for human dialog entities
US20240073274A1 (en) Accelerating connections to a host server
US20140214963A1 (en) Method, server and system for data sharing in social networking service
EP3163946A1 (en) Information transmission method and apparatus, device, computer program and recording medium
US20160234307A1 (en) Data transmission method, device, and system
CN104967644A (en) Message push method, apparatus and system
CN110677492A (en) Access request processing method and device, electronic equipment and storage medium
CN113285979B (en) Network request processing method, device, terminal and storage medium
CN108428027B (en) Event processing method and device
CN103561063A (en) Method and terminal for logging onto set top box
CN108122124B (en) Information pushing method, platform and system
CN111615694B (en) Method for selecting server node and terminal equipment
CN112751931B (en) Network connection method and device, electronic device, and medium
US9125024B2 (en) Broadcasting availability of free internet access at wireless access points
US20210112025A1 (en) Method and server for processing messages
CN103729440A (en) Method and device for having access to website
CN110858238B (en) Data processing method and device
CN112417330A (en) Page loading method, device, equipment and storage medium
CN115134405B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN108810043B (en) Method and device for storing comment information
US20180198866A1 (en) Method for preventing verification flaw by controlling session time and session data traffic
CN117424929A (en) Notification message processing method and device, electronic equipment and storage medium
CN113554429A (en) Payment processing method, payment processing device, server and storage medium
CN116582691A (en) Video data loading method and device, storage medium and electronic equipment

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
GR01 Patent grant
GR01 Patent grant