Summary of the invention
In view of this, the object of this invention is to provide a kind of method and device that improves web page browsing speed.
For achieving the above object, the invention provides technical scheme as follows:
Improve a method for web page browsing speed, be applied to, in web proxy gateway, it is characterized in that, described method comprises:
While receiving the http request of browser transmission, obtain described http and ask corresponding html file;
Described html file is resolved, obtain the same domain name page elements that described html file is quoted, and obtain the first quantity of described same domain name page elements;
When described the first quantity is greater than default thresholding, described html file is modified, the url of the second quantity page elements in described same domain name page elements is revised as and points to other web proxy gateways, and wherein, described the second quantity is the poor of described the first quantity and described default thresholding;
Amended html file is sent to browser, so that browser obtains described same domain name page elements from a plurality of web proxy gateways.
Above-mentioned method, wherein, described default thresholding is the concurrent connection number threshold value of browser to same domain name.
Above-mentioned method, wherein, also comprises: the User-Agent field of the http head of asking from described http, obtain the concurrent connection number threshold value of browser to same domain name.
Above-mentioned method, wherein, also comprises: receive and preserve user configured first element type that need to carry out the page elements of multiple domain name acceleration;
Describedly obtain the same domain name page elements that described html file quotes and be: obtain same domain name page elements that described html file is quoted, that element type is described the first element type.
Above-mentioned method, wherein, the quantity of described other web proxy gateways is one or more, and the quantity of the corresponding page elements of each web proxy gateway is less than or equal to described default thresholding.
Improve a device for web page browsing speed, be applied in web proxy gateway, described device comprises:
The first acquiring unit, while asking for receiving the http of browser transmission, obtains described http and asks corresponding html file;
Second acquisition unit, for described html file is resolved, obtains the same domain name page elements that described html file is quoted, and obtains the first quantity of described same domain name page elements;
Html file modification unit, while presetting thresholding for being greater than when described the first quantity, described html file is modified, the url of the second quantity page elements in described same domain name page elements is revised as and points to other web proxy gateways, wherein, described the second quantity is the poor of described the first quantity and described default thresholding;
Transmitting element, for amended html file is sent to browser, so that browser obtains described same domain name page elements from a plurality of web proxy gateways.
Above-mentioned device, wherein, described default thresholding is the concurrent connection number threshold value of browser to same domain name.
Above-mentioned device, wherein, also comprises: the 3rd acquiring unit, obtains the concurrent connection number threshold value of browser to same domain name for the User-Agent field of the http head from described http request.
Above-mentioned device, wherein, also comprises dispensing unit, for receiving and preserve user configured first element type that need to carry out the page elements of multiple domain name acceleration;
Described second acquisition unit is further used for: obtain same domain name page elements that described html file is quoted, that element type is described the first element type.
Above-mentioned device, wherein, the quantity of described other web proxy gateways is one or more, and the quantity of the corresponding page elements of each web proxy gateway is less than or equal to described default thresholding.
Compared with prior art, the present invention does not need source station to increase domain name or revises source code, but connect by revise the url of page elements in the html page on web proxy gateway, increase the domain name number that browser is accessed simultaneously, thereby improve the concurrent download performance of browser, and then improved web page browsing speed.
Embodiment
Below in conjunction with accompanying drawing, the embodiment of the present invention is described in detail.
Fig. 1 is the system construction drawing that improves according to an embodiment of the invention web page browsing speed.With reference to Fig. 1, described system can comprise: browser, a plurality of web proxy gateway (there is shown 3, comprise 1 dynamic multiple domain name rewriting server and 2 domain name expansion servers) and web server (source station), web proxy gateway is between browser and web server.Wherein, browser is arranged in client, and browser refers to the html file content that can show web server or file system, and allows a kind of software of user and these file interactions, can be the browsers such as IE, firefox, chrome.Browser is mainly mutual by http agreement and web server and obtain webpage, and these webpages are specified by URL(uniform resource locator) (url), and file format is generally html, and is indicated in http agreement by MIME.Client can be wired or wireless communication device, for example, and computer, mobile phone, personal digital assistant (PDA) etc.In web server, store one or more webpages.
Web proxy gateway is a kind of reverse proxy, browser can obtain the webpage in web server by web proxy gateway, that is to say, to the page request of web server, first (for example http request) can arrive web proxy gateway to browser, by web proxy gateway, the page request of browser is responded, for example, return to browser after obtaining webpage from web server or local cache.In embodiments of the present invention, web proxy gateway can also be modified to html file, makes browser can from a plurality of web proxy gateways, obtain a plurality of same domain name page elements in same webpage.
Particularly, be by revising the url of element in the html page, to connect to increase browser access domain concrete number simultaneously on web proxy gateway, improve the concurrent download performance of browser.Further, can also concurrent domain concrete number be set according to http page elements type, as picture is used multiple domain name, video is used single domain name etc.Further, can also different concurrent domain concrete numbers be set according to different browsers, thus performance browser optimum performance.
Below provide the specific implementation of web proxy gateway.
Fig. 2 is the structure drawing of device that improves according to an embodiment of the invention web page browsing speed.Described application of installation, in web proxy gateway (DDNS in Fig. 1 is rewritten server), comprises the first acquiring unit 10, second acquisition unit 20, html file modification unit 30 and transmitting element 40.
The operation principle of this device is:
When the first acquiring unit 10 receives the http request of browser transmission, can obtain described http and ask corresponding html file.Whether the first acquiring unit 10, when the http request that receives browser transmission, can first judge in buffer memory and exist this http to ask corresponding html file, if so, from buffer memory, to obtain described html file; Otherwise (web server) obtains described html file from source station, and the html file getting is added in buffer memory to the html file of buffer memory (if can).
20 pairs of described html files of second acquisition unit are resolved, and obtain the same domain name page elements that described html file is quoted, and so-called with domain name page elements, refer to, the url of a plurality of page elements points to same domain name.Second acquisition unit 20 also further obtains the first quantity of the page elements that described same domain name page elements comprises.
First html file modification unit 30 judges whether described the first quantity is greater than default thresholding, if described the first quantity is greater than default thresholding, described html file is modified, the url of the second quantity page elements in described same domain name page elements is revised as and points to other web proxy gateways, wherein, described the second quantity is the poor of described the first quantity and described default thresholding.For example, in Fig. 1, DDNS is rewritten server and is received described html request, and after getting corresponding html file, described html file is rewritten, and the url of partial page element is wherein revised as and points to two other domain name expansion servers.If described the first quantity is less than or equal to default thresholding, html file is not carried out to above-mentioned modification, by transmitting element 40, directly send it to browser.
Wherein, the quantity of described other web proxy gateways is one or more, and alternatively, the quantity of the corresponding page elements of each web proxy gateway is less than or equal to described default thresholding.That is to say, when 30 pairs of html file modification unit url modifies, can be revised as and point to a plurality of web proxy gateways, and browser still can be followed the restriction of number of concurrent to the access of each proxy gateway.
Transmitting element 40 is for sending to browser by amended html file.After browser receives amended html file, described html file is resolved, the url (url of unmodified) that finds that there is partial page element points to source station, so initiate the request to this page elements to source station, this request can arrive web proxy gateway (DDNS in Fig. 1 is rewritten server); The url that browser also finds that there is partial page element points to other web proxy gateways (the domain name expansion servers in Fig. 1), so initiate the request to this page elements to other web proxy gateways.Like this, browser just can obtain described same domain name page elements from a plurality of web proxy gateways, has been equivalent to increase the domain name number that browser is accessed simultaneously, thereby has improved the concurrent download performance of browser.
In the above-described embodiments, described default thresholding can be the concurrent connection number threshold value of browser to same domain name.
Alternatively, described device also comprises the 3rd acquiring unit (not shown), for the User-Agent field of the http head from described http request, obtains the concurrent connection number threshold value of browser to same domain name.For example, for IE browser, can get this threshold value from User-Agent field is 4, and for firefox or chrome browser, can get this threshold value from User-Agent field is 6.That is to say, in embodiments of the present invention, can different concurrent domain concrete numbers be set according to different browsers, thus performance browser optimum performance.
Alternatively, described device also comprises dispensing unit (not shown), for receiving and preserve user configured first element type that need to carry out the page elements of multiple domain name acceleration.Now, described second acquisition unit 20 is further used for: obtain same domain name page elements that described html file is quoted, that element type is described the first element type.That is to say, in embodiments of the present invention, user can arrange concurrent domain concrete number according to http page elements type, and as picture is used multiple domain name, video is used single domain name etc.
Fig. 3 is the method flow diagram that improves according to an embodiment of the invention web page browsing speed, is applied in web proxy server, and with reference to Fig. 3, described method can comprise:
Step 301, while receiving the http request of browser transmission, obtains described http and asks corresponding html file;
Step 302, resolves described html file, obtains the same domain name page elements that described html file is quoted, and obtains the first quantity of described same domain name page elements;
Step 303, when described the first quantity is greater than default thresholding, described html file is modified, the url of the second quantity page elements in described same domain name page elements is revised as and points to other web proxy gateways, wherein, described the second quantity is the poor of described the first quantity and described default thresholding;
The quantity of described other web proxy gateways is one or more.Alternatively, the quantity of the corresponding page elements of each web proxy gateway is less than or equal to described default thresholding.
Described default thresholding can be the concurrent connection number threshold value of browser to same domain name, and obtains the concurrent connection number threshold value of browser to same domain name the User-Agent field of the http head that can ask from described http.
Step 304, sends to browser by amended html file, so that browser obtains described same domain name page elements from a plurality of web proxy gateways.
Alternatively, described method also comprises: receive and preserve user configured first element type that need to carry out the page elements of multiple domain name acceleration.Now, described in, obtaining the same domain name page elements that described html file quotes is: obtain same domain name page elements that described html file is quoted, that element type is described the first element type.
An application example of the present invention following (with reference to Fig. 1):
In Fig. 1, dynamically multiple domain name rewriting server and domain name expansion servers are all to operate in reverse http proxy mode.If do not carry out dynamic multiple domain name expansion, browser access www.abc.com website is all to rewrite server by dynamic multiple domain name, supposing has 9 picture pic1~pic9.jpg in the page, and browser is 3 to the concurrent restriction of same domain name, want so to demonstrate page browser and can only download 3 pictures simultaneously, divide 3 batches and downloaded.
As reverse proxy, the dns of www.abc.com is resolved to dynamic multiple domain name and rewrites server, thereby dynamically multiple domain name is rewritten the request that server can get the GET html page that browser sends at first, from the User-Agent field of HTTP head, can judge the type of browser, in this example, can know that browser is 3 to the maximum number of concurrent of a domain name.
Dynamically multiple domain name is rewritten server and from source station or from buffer memory, is read html content of pages, parse and in the page, have 9 pictures, and picture is set to the acceleration of multiple domain name in configuration (configuration that user can revise), at this moment dynamically multiple domain name is rewritten server by (rewriting server can be one of them) in this 9 picture mean allocation to 3 domain name expansion servers.
Rewrite method to the html page is as follows:
Url:www.abc.com/pic1~the pic3.jpg of first three picture, does not rewrite, and browser also can be accessed dynamic multiple domain name and be rewritten server like this;
By the url:www.abc.com/pic4~pic6.jpg of the 4th to 6 pictures, do you be rewritten as respectively s1.foo.com/pic4~pic6.jpg? domain=www.abc.com, browser can be accessed this station server of s1.foo.com and be obtained picture like this, and s1 server can be from buffer memory or gone back to source station and obtain corresponding picture and return to browser;
Equally, by the url:www.abc.com/pic7~pic9.jpg of the 7th to 9 pictures, do you be rewritten as respectively s2.foo.com/pic7~pic9.jpg? domain=www.abc.com, s2 server can be from buffer memory or is gone back to source station and obtain picture and return to browser;
Through above-mentioned modification, the access of browser becomes three domain names from a domain name, and concurrent download number increases to 9 from 3 simultaneously, has significantly increased the download performance of browser.
It should be noted that, in the step shown in the flow chart of accompanying drawing, can in being provided with the computer system of one group of computer executable instructions, carry out, and, although there is shown logical order in flow process, but in some cases, can carry out shown or described step with the order being different from herein.In addition, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on the network that a plurality of calculation elements form, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in storage device and be carried out by calculation element, or they are made into respectively to each integrated circuit modules, or a plurality of modules in them or step are made into single integrated circuit module to be realized.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, be equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.