Summary of the invention
In view of above-mentioned, the present invention proposes a kind of network loading processing method and apparatus, available connection can be more accurately found out from the connection pool set up, and can directly utilize the available connection found out to connect, network is loaded less consuming time, webpage loading velocity is faster, realizes more fast browsing webpage.
Technical scheme provided by the invention is as follows:
The invention provides a kind of network loading processing method, comprising: receive network request; Obtain the target domain name belonging to described network request and port; Obtain the target ip address of the target domain name obtained after domain name mapping is carried out to target domain name; According to the information of described target domain name, target ip address and port, from network connection pool, searching available connection, when finding available connection, directly using described available connection to send web access requests to network side.
Preferably, the described information according to described target domain name, target ip address and port, available connection is searched from network connection pool, when finding available connection, the described available connection of direct use sends web access requests to network side and comprises: first according to the information of described target domain name and port, available connection is searched from network connection pool, when finding the domain name connection identical with port with the target domain name belonging to network address with port, determine that described connection is available, directly use described available connection to send web access requests to network side; When searching the connection less than domain name and port are identical with port with the target domain name belonging to network address, again according to the information of described target ip address and port, available connection is searched from network connection pool, when finding the connection identical with port with the target ip address belonging to network address with port of IP address, determine that described connection is available, directly use described available connection to send web access requests to network side.
Preferably, wherein, when searching the connection less than IP address and port are identical with port with the target ip address belonging to network address, creating new network according to target ip address and connecting, use new network to connect and send web access requests to network side.
Preferably, wherein: the described information according to target domain name and port, from network connection pool, search available connection comprise: according to the information of described target domain name and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond; The described information according to target ip address and port, from network connection pool, search available connection comprise: according to the information of target ip address and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond.
Preferably, wherein, the target ip address of the target domain name that described acquisition obtains after carrying out domain name mapping to target domain name comprises: carry out domain name mapping to target domain name, obtains the target ip address that one or more target domain name is corresponding; And, search one by one according to target ip address when searching available connection from network connection pool.
The invention provides a kind of network loading processing device, comprising: receiver module, for receiving network request; First acquisition module, for obtaining target domain name belonging to described network request and port; Second acquisition module, for obtain domain name mapping is carried out to target domain name after the target ip address of target domain name that obtains; Processing module, according to the information of described target domain name, target ip address and port, searches available connection from network connection pool, when finding available connection, directly uses described available connection to send web access requests to network side.
Preferably, described processing module comprises: the first processing module, for the information first according to described target domain name and port, available connection is searched from network connection pool, when finding the domain name connection identical with port with the target domain name belonging to network address with port, determine that described connection is available, directly use described available connection to send web access requests to network side; Second processing module, during for searching the connection less than domain name and port are identical with port with the target domain name belonging to network address when described first processing module, again according to the information of described target ip address and port, available connection is searched from network connection pool, when finding the connection identical with port with the target ip address belonging to network address with port of IP address, determine that described connection is available, directly use described available connection to send web access requests to network side.
Preferably, described processing module also comprises: the 3rd processing module, for when described second processing module searches the connection less than IP address and port are identical with port with the target ip address belonging to network address, create new network according to target ip address to connect, use new network to connect and send web access requests to network side.
Preferably, wherein, described first processing module is the information according to described target domain name and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond; Described second processing module, the information according to target ip address and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond.
Preferably, network loading processing device also comprises: domain name mapping module, for carrying out domain name mapping to target domain name, obtains the target ip address that one or more target domain name is corresponding; And described second acquisition module obtains target ip address corresponding to one or more target domain name from domain name parsing module; Described processing module is search one by one according to target ip address when searching available connection from network connection pool.
Utilize said method, the present invention program can get target domain name belonging to network request and port, target ip address target domain name being carried out to the target domain name after domain name mapping can also be got, so utilize target domain name, the information of target ip address and port, just first can search available connection from the network connection pool preset, if when can find available connection, described available connection just can be directly used to send web access requests to network side, thus omit the step of network connection establishment, save network and load the time spent, by web page access time shorten, promote Consumer's Experience.And, consider that different domain name may comprise identical IP address, and the destination server that two different domain names will be asked when IP address is identical is identical, therefore present invention incorporates target domain name and target ip address judges, some can be avoided originally can not to be judged out by the connection shared, just can improve the reusability of available connection, thus the step connecting and create under making more susceptible condition, can be saved.
In order to realize above-mentioned and relevant object, will describe in detail and the feature particularly pointed out in the claims after one or more aspect of the present invention comprises.Explanation below and accompanying drawing describe some illustrative aspects of the present invention in detail.But what these aspects indicated is only some modes that can use in the various modes of principle of the present invention.In addition, the present invention is intended to comprise all these aspects and their equivalent.
Embodiment
Various aspects of the present disclosure are described below.It is to be understood that instruction herein can with varied form imbody, and in this article disclosed any concrete structure, function or both be only representational.Based on instruction herein, those skilled in the art are it is to be understood that an aspect disclosed herein can realize independent of any other side, and the two or more aspects in these aspects can combine according to various mode.Such as, aspect, implement device or the hands-on approach of any number described in this paper can be used.In addition, other structure, function or except one or more aspect described in this paper or be not the 26S Proteasome Structure and Function of one or more aspect described in this paper can be used, realize this device or put into practice this method.In addition, any aspect described herein can comprise at least one element of claim.
The present invention proposes a kind of network loading processing method, can more accurately find out available connection from the connection pool set up, and can directly utilize the available connection found out to connect, network be loaded less consuming time, webpage loading velocity is faster, realizes more fast browsing webpage.
The present invention is shared by the statistics loading flow process each step consuming time to network, finds domain name mapping, connects and create the time scale that this time shared by two steps accounts for whole network request and be greater than 10%.Therefore, the present invention program proposes when carrying out network and loading, can set up in advance and the connection wanting the webpage of accessing, these are connected stored in pre-connection cache pool, when such user initiates web-page requests by browser client, first can search whether there is available connection from pre-connection cache pool, if there is available connection, can directly use, thus domain name mapping can be saved and be connected the step created, save network loads spend time, by web page access time shorten, lifting Consumer's Experience.In addition, the present invention also by with long connect also stored in long Connection Cache pond, such user also first can search whether there is available connection from long Connection Cache pond, if there is available connection, can directly use, thus omit the step connecting and create, save network and load the time spent.
The present invention sets up 2 network connection pools, and 1 is pre-connection cache pool, and other 1 is long Connection Cache pond.Pre-connection, refers to the also not used connection of setting up in advance; Long to connect, refer to but still keep the connection that connects.Save in long Connection Cache pond and used but the connection of also not losing efficacy.
Concrete, after receiving network request, extract the domain name belonging to network request, the available pre-connection corresponding with this domain name whether is had according in domain name lookup pre-connection cache pool, if there is available pre-connection, then directly can obtain corresponding pre-connection to use, if there is no available pre-connection, again according to whether there being the available length corresponding with this domain name to connect in the long connection pool of domain name lookup, if there is available long connection, then can obtain corresponding long connection to use, also network creation step can be omitted, if there is no available long connection, now resolve domain name again and obtain corresponding IP address, the network new according to IP address creation connects.It should be noted that, above-mentioned pre-connection of searching does not have considered critical with the long order be connected, and first can search long connection yet, then search pre-connection.
Further, when the present invention finds to carry out domain name mapping, client is to the request of DNS (DomainNameSystem, domain name system) server sending domain name analysis, and dns server is by the IP address of targeted website corresponding for this domain name of response.Under normal circumstances, the IP address that domain name mapping returns may have one or more, and returns to client after sorting according to certain load balancing.Wherein the most important is, may there be identical part the IP address that domain name A and domain name B returns, and namely different domain name may comprise identical IP address, and the destination server that two different domain names will be asked when IP address is identical is identical.That is, as long as comprise identical IP address in domain name mapping, and port is identical, can connect by community network.
Therefore, the present invention program utilize different domain names may obtain identical ip addresses after resolving and its network used connect can reusable characteristic, on the basis that domain name judges, in pre-connection cache pool with long Connection Cache pond, the connection (pre-connection or length are connected) that can share is obtained more further according to IP address, such ratio only relies on domain name to judge can more accurately find out the connection that can share, avoid some originally can not to be judged out by the connection shared, improve the reusability of pre-connection buffer memory and long Connection Cache, thus the step connecting and create under making more susceptible condition, can be saved, directly send request, accelerating network loading velocity, promote Consumer's Experience.
Each embodiment of the present invention is described below with reference to accompanying drawings.
Fig. 1 is the first pass figure of the network loading processing method of the inventive method.
As shown in Figure 1, step is comprised:
Step 101, reception network request;
Step 102, obtain target domain name belonging to described network request and port;
Such as, containing network address in network request, network address has affiliated target domain name and port, so can obtain the target domain name belonging to network address in described network request and port.It should be noted that, be not can only obtain said target domain name and port by network address, when network request does not have a network address, can get the target domain name belonging to network request and port yet.
Step 103, obtain the target ip address of the target domain name obtained after domain name mapping is carried out to target domain name;
Step 104, information according to described target domain name, target ip address and port, search available connection from network connection pool, when finding available connection, directly uses described available connection to send web access requests to network side.
Wherein, step 104 specifically comprises:
First according to the information of described target domain name and port, available connection is searched from network connection pool, when finding the domain name connection identical with port with the target domain name belonging to network address with port, determine that described connection is available, directly use described available connection to send web access requests to network side;
When searching the connection less than domain name and port are identical with port with the target domain name belonging to network address, again according to the information of described target ip address and port, available connection is searched from network connection pool, when finding the connection identical with port with the target ip address belonging to network address with port of IP address, determine that described connection is available, directly use described available connection to send web access requests to network side.
When searching the connection less than IP address and port are identical with port with the target ip address belonging to network address, creating new network according to target ip address and connecting, use new network to connect and send web access requests to network side.
Wherein, the described information according to target domain name and port, from network connection pool, search available connection comprise: according to the information of described target domain name and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond;
The described information according to target ip address and port, from network connection pool, search available connection comprise: according to the information of target ip address and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond.
As can be seen from the above, the present invention program can get target domain name belonging to network request and port, target ip address target domain name being carried out to the target domain name after domain name mapping can also be got, so utilize target domain name, the information of target ip address and port, just first can search available connection from the network connection pool preset, if when can find available connection, described available connection just can be directly used to send web access requests to network side, thus omit the step of network connection establishment, save network and load the time spent, by web page access time shorten, promote Consumer's Experience.And, consider that different domain name may comprise identical IP address, and the destination server that two different domain names will be asked when IP address is identical is identical, therefore present invention incorporates target domain name and target ip address judges, some can be avoided originally can not to be judged out by the connection shared, just can improve the reusability of available connection, thus the step connecting and create under making more susceptible condition, can be saved.
Fig. 2 is the second flow chart of the network loading processing method of the inventive method.Fig. 2 describes the solution of the present invention in more detail relative to Fig. 1.As shown in Figure 2, step is comprised:
Step 201, reception network request.
Step 202, obtain target domain name belonging to network request and port.
Step 203, in pre-connection cache pool, search whether there is available pre-connection according to domain name, if so, enter step 209 and obtain corresponding network and connect, if not, enter step 204.
Matched rule in this step for: exist in pre-connection cache pool and connect with the target domain name network identical with port numbers belonging to request, then think there is available network connection.
In pre-connection cache pool, save the pre-connection established, in pre-connection cache pool, the IP address of each pre-connection, domain name, port are corresponding stored.That is, in pre-connection cache pool, save the pre-connection established, and each pre-connection carries respective key message.Key message is as the IP address of pre-connection, target domain name, target port and creation-time etc.
Step 204, in long Connection Cache pond, search whether there be available longly to connect according to domain name, if so, enter step 209 and obtain corresponding network and connect, if not, enter step 205.
Matched rule in this step for: exist in long Connection Cache pond and connect with the target domain name network identical with port numbers belonging to request, then think there is available network connection.
In long Connection Cache pond, save used long connection, the IP address of each long connection in long Connection Cache pond, domain name, port are corresponding stored.Its store relation and pre-connection cache pool similar.
Step 205, when the connection all not having caching of target domain name corresponding in pre-connection cache pool and long Connection Cache pond, domain name mapping is carried out to target domain name, obtains the target ip address of target domain name.
This step carries out domain name mapping to target domain name, obtains the target ip address [IP1, IP2 ... IPN] of one or more target domain name.
Step 206, the order returned according to IP address, search whether be cached with the available pre-connection corresponding with target ip address one by one in pre-connection cache pool, if so, enters step 209 and obtain corresponding network connection, if not, enter step 207.
Matched rule in this step is: there is the network identical with port numbers with arbitrary target ip address in pre-connection cache pool and connect, then think and have available network to connect.Here the port said is identical with foregoing port.
Step 207, the order returned according to IP address, search one by one and whether be cached with the available long connection corresponding with target ip address in long Connection Cache pond, if so, enters step 209 and obtain corresponding network connection, if not, enter step 208.
Matched rule in this step is: there is the network identical with port numbers with arbitrary target ip address in long Connection Cache pond and connect, then think and have available network to connect.
If all there is no the connection that buffer memory is corresponding with target ip address in step 208 pre-connection cache pool and long Connection Cache pond, then start to create network and connect.
The network of step 209, acquisition correspondence connects.
If pre-connection cache pool, then what obtain is pre-connection, if long Connection Cache pond, then what obtain is long connection.
Step 210, utilize network connect initiate web access requests.
In this step, utilize the pre-connection obtained from pre-connection cache pool, or the long connection obtained from long Connection Cache pond, or newly-built network connects, and initiates web access requests.
What deserves to be explained is, between previous step 203 and step 204, and the order between step 206 and step 207 can be exchanged, and does not namely limit and first searches in pre-connection cache pool or search in long Connection Cache pond.But consider stability and error rate that pre-connection is connected with long connection two kinds, in the present invention program, preferably execution mode is, the order in access pre-connection cache pool and long Connection Cache pond is that pre-connection cache pool has precedence over long Connection Cache pond.
Also it should be noted that, the present invention, after the target domain name obtained in network request belonging to the network address of asking and port, also first can carry out domain name mapping to target domain name, obtain the target ip address of target domain name.
The beneficial effect of the present invention program is: due in the present invention program, whether can to search from network connection pool (pre-connection cache pool and long Connection Cache pond) according to domain name has available network to be connected (pre-connection or long connect), can also further when available network cannot be found according to domain name to be connected, whether to search from network connection pool (pre-connection cache pool and long Connection Cache pond) according to IP address has available network to be connected (pre-connection or long connect), the connection that can share more accurately is judged than the mode only utilizing domain name to judge, some can be avoided originally can not to be judged out by the connection shared, effectively improve the reusability connecting buffer memory and long Connection Cache in advance, thus the step connecting and create under making more susceptible condition, can be saved, directly send request, accelerating network loading velocity, promote Consumer's Experience.Through statistics, in two kinds of modes, according to the mode that domain name judges together with IP address, than only according to the mode that domain name judges, pre-connection and grow the reusability that is connected and can improve 10 ~ 20%.
Above-mentionedly describe method of the present invention in detail, accordingly, the invention provides a kind of network loading processing device.Fig. 3 is network loading processing apparatus structure first schematic diagram of the present invention.
As shown in Figure 3, a kind of network loading processing device 30, comprising: receiver module 301, first acquisition module 302, second acquisition module 303, processing module 304.
Receiver module 301, for receiving network request;
First acquisition module 302, for obtaining target domain name belonging to described network request and port;
Second acquisition module 303, for obtain domain name mapping is carried out to target domain name after the target ip address of target domain name that obtains;
Processing module 304, according to the information of described target domain name, target ip address and port, searches available connection from network connection pool, when finding available connection, directly uses described available connection to send web access requests to network side.
Fig. 4 is network loading processing apparatus structure second schematic diagram of the present invention.
As shown in Figure 4, on the basis of Fig. 3 structure, described processing module 304 comprises: the first processing module 3041, second processing module 3042.
First processing module 3041, for the information first according to described target domain name and port, available connection is searched from network connection pool, when finding the domain name connection identical with port with the target domain name belonging to network address with port, determine that described connection is available, directly use described available connection to send web access requests to network side;
Second processing module 3042, for when described first processing module 3041 searches the connection less than domain name and port are identical with port with the target domain name belonging to network address, again according to the information of described target ip address and port, available connection is searched from network connection pool, when finding the connection identical with port with the target ip address belonging to network address with port of IP address, determine that described connection is available, directly use described available connection to send web access requests to network side.
Described processing module also comprises: the 3rd processing module 3043.
3rd processing module 3043, for when described second processing module 3042 searches the connection less than IP address and port are identical with port with the target ip address belonging to network address, create new network according to target ip address to connect, use new network to connect and send web access requests to network side.
Wherein, described first processing module 3041, be the information according to described target domain name and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond; Described second processing module 3042, the information according to target ip address and port, from pre-connection cache pool and long Connection Cache pond, search available pre-connection respectively or to be longly connected, described looked-up sequence is first search pre-connection cache pool or first search long Connection Cache pond.
Network loading processing device also comprises: domain name mapping module 305.Domain name mapping module 305, for carrying out domain name mapping to target domain name, obtains the target ip address that one or more target domain name is corresponding; And described second acquisition module 303 obtains target ip address corresponding to one or more target domain name from domain name parsing module; Described processing module 304 is search one by one according to target ip address when searching available connection from network connection pool.
Reciprocal process between above-mentioned each unit module, see the description in previous methods, repeats no more herein.
Fig. 5 is the structural representation of mobile terminal of the present invention.
As shown in Figure 5, this mobile terminal 50 comprises the network loading processing device 30 of foregoing description.The structure of this device 30 is concrete as shown in Figure 3 and Figure 4, repeats no more herein.
In addition, typically, mobile terminal of the present invention can be the various hand-held terminal device with Bluetooth function, such as, have the mobile phone of Bluetooth function, personal digital assistant (PDA).
In addition, the computer program performed by the processor (such as CPU) in mobile terminal can also be implemented as according to method of the present invention, and store in a memory in the mobile terminal.When this computer program is executed by processor, perform the above-mentioned functions limited in method of the present invention.
In addition, a kind of computer program can also be embodied as according to method of the present invention, this computer program comprises computer-readable medium, stores the computer program for performing the above-mentioned functions limited in method of the present invention on the computer-readable medium.
In addition, said method step and system unit also can utilize controller and realize for storing the computer readable storage devices making controller realize the computer program of above-mentioned steps or Elementary Function.
Those skilled in the art will also understand is that, may be implemented as electronic hardware, computer software or both combinations in conjunction with various illustrative logical blocks, module, circuit and the algorithm steps described by disclosure herein.In order to this interchangeability of hardware and software is clearly described, the function with regard to various exemplary components, square, module, circuit and step has carried out general description to it.This function is implemented as software or is implemented as hardware and depends on embody rule and be applied to the design constraint of whole system.Those skilled in the art can realize described function in every way for often kind of embody rule, but this realization determines should not be interpreted as causing departing from the scope of the present invention.
Although disclosed content shows exemplary embodiment of the present invention above, it should be noted that under the prerequisite not deviating from the scope of the present invention that claim limits, can multiple change and amendment be carried out.Need not perform with any particular order according to the function of the claim to a method of inventive embodiments described herein, step and/or action.In addition, although element of the present invention can, with individual formal description or requirement, also it is contemplated that multiple, be odd number unless explicitly limited.
Although describe each embodiment according to the present invention above with reference to figure to be described, it will be appreciated by those skilled in the art that each embodiment that the invention described above is proposed, various improvement can also be made on the basis not departing from content of the present invention.Therefore, protection scope of the present invention should be determined by the content of appending claims.