A kind of reorientation method and content distribution nodes applied to content distributing network
Technical field
The present invention relates to content distributing network field, more specifically, it relates to a kind of applied to content distributing network
Reorientation method and content distribution nodes.
Background technology
The full name of CDN is Content Delivery Network, i.e. content distributing network.Its basic ideas is as far as possible
The bottleneck and link for avoiding being possible to influencing data transmission bauds and stability on internet, make content transmission faster, it is more steady
It is fixed.The purpose is to by increasing by one layer of new network architecture in existing Internet, the content of website is published to and is most connect
The network " edge " of nearly user, allows user to obtain required content nearby, improves the response speed that user accesses website.
CDN by placing one on the existing Internet basic layer intelligent virtual net that node server is constituted everywhere in network
Network, CDN system can be in real time according to the connection of network flow and each node, load state and the distance to user and responses
The integrated informations such as time re-direct the request of user on the service node nearest from user.The purpose is to make user can be nearby
Content needed for obtaining solves the crowded situation of Internet network, improves the response speed that user accesses website.
However in the prior art, be in CDN by identify user local domain name server (LOCAL DNS, LOCAL
Domain Name Server) judge what user sources were scheduled.As user and LOCALDNS geography and operator's informaiton
When inconsistent, user's assignment error can be caused.Traditional CDN manufacturers redirect according to the source IP of user sometimes, will use
It is redirected to correct CDN node in family.Such a process increases the access times of user when visit capacity is higher, not only effect of optimization
It is limited, and aggravated the burden of server.
Invention content
In view of this, the present invention provides a kind of reorientation method applied to content distributing network and content distribution sections
Point, to overcome the reorientation method of the prior art that can aggravate the technical issues of server is born when visit capacity is higher.
To achieve the above object, the present invention provides the following technical solutions:
A kind of reorientation method applied to content distributing network, global load balancing server receive what client was initiated
First content access request, and the IP address according to the client is determined for compliance with the content distributing network CDN sections of preset condition
Point, and the CDN node information is back to the client;This method includes:
The content distributing network CDN node receives the second content access request that the client is initiated;
The CDN node is requested from the source station server acquisition client according to second content access request
Content;
The CDN node extracts the text message in the requested content of the client, and will be in the text message
Uniform resource position mark URL replace with the CDN node URL of itself;
The URL of itself is back to the client by the CDN node.
Preferably, further include:
It is described when the client re-initiates the second content access request according to the CDN node URL of itself
CDN node provides the corresponding contents of URL of itself to the client.
Preferably, the CDN node obtains the client according to second content access request from source station server
Requested content, specifically includes:
Second access to content is reduced to the first content access request by the CDN node;
The first content access request is forwarded to source station server by the CDN node;
The CDN node obtains the requested content of first content access request that the source station server returns.
Preferably, the content distribution request is HTTP or HTTPS request.
Preferably, the IP address according to the client is determined for compliance with the content distributing network CDN sections of preset condition
Point, specially:
IP address according to the client is determined apart from the CDN node that client is nearest and/or Network status is best.
A kind of content delivery network node, including:
First receiving module, the second content access request initiated for receiving the client;
Acquisition module is asked for obtaining the client from source station server according to second content access request
Content;
Extraction module, for extracting the text message in the requested content of the client;
Replacement module, for the uniform resource position mark URL in the text message to be replaced with the CDN node itself
URL;
First returns to module, for the URL of itself to be back to the client.
Preferably, further include:
Content module is provided, for the URL of itself to re-initiate the second content according to the CDN node in the client
When access request, the corresponding contents of URL of itself are provided to the client.
Preferably, the acquisition module specifically includes:
Submodule is restored, for second access to content to be reduced to the first content access request;
Submodule is forwarded, for the first content access request to be forwarded to source station server;
Acquisition submodule, it is requested interior for obtaining the first content access request that the source station server returns
Hold.
A kind of content distributing network, including:Global load balancing server, client, source station server and CDN node,
Wherein:
The global load balancing server includes:Second receiving module, determining module and second return to module, described to connect
The first content access request that module is used to receive client initiation is received, the determining module is for the IP according to the client
Address is determined for compliance with the content distributing network CDN node of preset condition, and the return module is used for the CDN node information
It is back to the client;
The source station server is used to provide the requested content of client to the CDN node;
The CDN node includes:
First receiving module, the second content access request initiated for receiving the client;
Acquisition module is asked for obtaining the client from source station server according to second content access request
Content;
Extraction module, for extracting the text message in the requested content of the client;
Replacement module, for the uniform resource position mark URL in the text message to be replaced with the CDN node itself
URL;
Module is returned to, for the URL of itself to be back to the client.
Preferably, the determining module is specifically used for:IP address according to the client determines nearest apart from client
And/or the CDN node that Network status is best.
It can be seen via above technical scheme that compared with prior art, it is disclosed by the invention to be applied to content distributing network
Reorientation method and content distribution nodes, can be by scanning the http response that source station server returns by CDN node, can be with
The HTTP information of all text types is got, and URL therein is replaced with to the addresses URL of itself, after ensureing user
Continuous duration accesses, to solve in the prior art since a large amount of 302 redirect caused user's number of request increase and service
The technical issues of device load increases.Also, the embodiment of the present invention can make up is based only on user sources IP progress in the prior art
The deficiency of redirection.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is the flow chart of the reorientation method embodiment 1 disclosed by the embodiments of the present invention applied to content distributing network;
Fig. 2 is the flow chart of step 105 in embodiment of the method 1;
Fig. 3 is the flow chart of the reorientation method embodiment 2 disclosed by the embodiments of the present invention applied to content distributing network;
Fig. 4 is that the structure of the redirection device embodiment 1 disclosed by the embodiments of the present invention applied to content distributing network is shown
It is intended to;
Fig. 5 is the structural schematic diagram of acquisition module 402 in device embodiment 1;
Fig. 6 is that the structure of the redirection device embodiment 2 disclosed by the embodiments of the present invention applied to content distributing network is shown
It is intended to;
Fig. 7 is the structural schematic diagram of content distributing network disclosed by the embodiments of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.Embodiment one
Shown in Figure 1, Fig. 1 is that the reorientation method disclosed by the embodiments of the present invention applied to content distributing network is implemented
The flow chart of example 1, in the present embodiment, the method may include:
Step 101:Global load balancing server receives the first content access request that client is initiated.
In content distributing network, if user wants to obtain a multimedia content or to a website is logged in, need
Trigger content access request to global load balancing server GSLB, the content distribution request in the present embodiment can be HTTP or
Person's HTTPS request.
Step 102:IP address according to the client is determined for compliance with the content distributing network CDN node of preset condition.
After GSLB gets Client-initiated content access request, distance can be filtered out according to the source IP of user and is used
The nearest content delivery network node in family, using this CDN node nearest apart from user as best CDN node.
Wherein, this step is specifically as follows in specific implementation:IP address according to the client is determined apart from client
The CDN node that end is nearest and/or Network status is best.It is GSLB in the CDN node for being determined for compliance with preset condition, it can also
The factor of the Network status of each CDN node is taken into account, as a parameter of the best CDN node of determination.
Step 103:The CDN node information is back to client.
Calculated CDN node information is returned to client by GSLB by one 302 response.
Step 104:The content distributing network CDN node receives the second content access request that the client is initiated.
User after receiving 302 responses of GSLB returns, initiate in second by the best CDN node indicated to the response
Hold access request.
Step 105:The CDN node obtains the client according to second content access request from source station server
Requested content.
After the CDN node receives the second content access request of Client-initiated, SLB servers are by second content
Access request is first reduced to first content access request and is transmitted to source station server, is asked to obtain client from source station
Content HTTP information.
Wherein, refering to what is shown in Fig. 2, this step may include in specific implementation:
Step 201:Second access to content is reduced to the first content access request by the CDN node;
Step 202:The first content access request is forwarded to source station server by the CDN node;
Step 203:The CDN node obtains the first content access request that the source station server returns and is asked
Content.
Step 106:The CDN node extracts the text message in the requested content of the client, and by the text
Uniform resource position mark URL in this information replaces with the CDN node URL of itself.
After the CDN node obtains the content that source station server returns, the return head of the content is first obtained, with extraction
Go out all return file types and be the HTTP information of text type, and URL therein is replaced, the URL of script is replaced
For the URL information of the access address containing itself, the continuous access of user is demonstrate,proved in continuation of insurance later.
Step 107:The URL of itself is back to the client by the CDN node.
Replaced HTTP information is being back to client by the CDN node, so that client acquisition is modified
After HTTP, continue to send subsequent content access request to the best CDN node.
In the present embodiment, by scanning the http response that source station server returns by CDN node, all texts can be got
The HTTP information of this type, and URL therein is replaced with to the addresses URL of itself, to ensure that the subsequent duration of user is visited
It asks, to solve in the prior art since a large amount of 302 redirect caused user's number of request increase and server load is increased
Technical problem.Also, the embodiment of the present invention can make up and be based only on the deficiency that user sources IP is redirected in the prior art.
Embodiment two
With reference to shown in Fig. 3, Fig. 3 is that the reorientation method disclosed by the embodiments of the present invention applied to content distributing network is implemented
The flow chart of example 2, the present embodiment can specifically include following steps:
Step 301:User obtains the IP address of global load balancing server by dns resolution.
First, user is parsed by name server (DNS), can obtain the IP address of GSLB, as certain Beijing Netcom uses
Family needs to access " weibo.com ", then local domain name server (LOCAL DNS) will return to global load balancing server
IP address is to user.
Step 302:User initiates first content access request by client to global load balancing server.
User triggers client and initiates HTTP request " GET http to the global load balancing server://
weibo.com”。
Step 303:The global load balancing server is determined for compliance with preset condition according to the IP address of the client
Content distributing network CDN node.
After global load balancing server obtains HTTP request and the IP address of user, and calculate from user most
Close and best network state CDN node.In the present embodiment, global load balancing server receives the access to content of user
After request find client source-information be not inconsistent with present node, and calculate the client to Beijing Netcom node performance
It is best.
Step 304:The CDN node information is back to the client.
The global load balancing server returns to one 302 redirection (REDIRECT http://
Bjcnc.weibo.com) to client.
Step 305:Client initiates the second content access request to the content distributing network CDN node.
After client receives 302 requests, the second content access request (GET http are sent out to Beijing Netcom node://
bjcnc.weibo.com)。
Step 306:The CDN node obtains the client according to second content access request from source station server
Requested content.
After Beijing Netcom node receives the second content access request, second content access request is reduced into first
One content access request (http://weibo.com), relay to source station server.Source station receives first content access and asks
Node server of the requested content of the request to Beijing Netcom is returned after asking.
Step 307:The CDN node extracts the text message in the requested content of the client.
After CDN node gets the content that source station server returns, scanning wherein all types are the return information of text.
Step 308:URL in the text message is replaced with into the CDN node URL of itself.
CDN node is further according to the URL information in the URL information modification return information of itself, specifically, CDN node obtains
Modify after the content of text that source station server returns, in the present example returned text content for example "<Img src=
http://img001.com/001.gif>", CDN node the above is revised as "<Img src=http://
bjcnc.img001.com/001.gif>”。
Step 309:According to the CDN node, the URL of itself re-initiates the second content access request to the client.
The HTTP information that itself URL is substituted is back to client by CDN node again, and client is directly heavy according to the information
Newly the second content requests are initiated to the CDN node.
Step 310:The CDN node provides the corresponding contents of URL of itself to the client.
After CDN node receives the second content access request of client triggering, subsequently directly it is provided to client
Requested content.
It in embodiments of the present invention, can be according to own node after the content that CDN node scanning source station server returns
Information changes the content that source station returns, and ensures that client can be directly to this in nearest CDN node initiation in this way
Hold access request, to ensure that the continuous access of user.
Method is described in detail in aforementioned present invention disclosed embodiment, diversified forms can be used for the method for the present invention
Device realize, therefore the invention also discloses a kind of redirection device applied to content distributing network, be given below specifically
Embodiment be described in detail.
Embodiment three
Shown in Figure 4, Fig. 4 is that the redirection device disclosed by the embodiments of the present invention applied to content distributing network is implemented
The structural schematic diagram of example 1, in the present embodiment, described device may include:
First receiving module 401, the second content access request initiated for receiving the client;
Acquisition module 402, for obtaining the client institute from source station server according to second content access request
The content of request;
Specifically, refering to what is shown in Fig. 5, the acquisition module 402 can specifically include:
Submodule 501 is restored, for second access to content to be reduced to the first content access request;
Submodule 502 is forwarded, for the first content access request to be forwarded to source station server;
Acquisition submodule 503 is asked for obtaining the first content access request that the source station server returns
Content.
Extraction module 403, for extracting the text message in the requested content of the client;
Replacement module 404, for the uniform resource position mark URL in the text message to be replaced with the CDN node
The URL of itself;
First returns to module 405, for the URL of itself to be back to the client.
In the present embodiment, by scanning the http response that source station server returns by CDN node, all texts can be got
The HTTP information of this type, and URL therein is replaced with to the addresses URL of itself, to ensure that the subsequent duration of user is visited
It asks, to solve in the prior art since a large amount of 302 redirect caused user's number of request increase and server load is increased
Technical problem.Also, the embodiment of the present invention can make up and be based only on the deficiency that user sources IP is redirected in the prior art.
Shown in Figure 6, in practical applications, other than module shown in Fig. 4, described device can also include:
Content module 601 is provided, for the URL of itself to re-initiate second according to the CDN node in the client
When content access request, the corresponding contents of URL of itself are provided to the client.
In embodiments of the present invention, the redirection device applied to content distributing network also ensures that user subsequently visits
The continuity asked.
Example IV
The embodiment of the present invention additionally provides a kind of content distributing network, refering to what is shown in Fig. 7, the content distributing network specifically may be used
To include:Global load balancing server 701, client 702, source station server 703 and CDN node 704, wherein:
The global load balancing server 701 can specifically include:Second receiving module, determining module and second return
Module, the receiving module are used to receive the first content access request of client initiation, and the determining module is used for according to institute
The IP address for stating client is determined for compliance with the content distributing network CDN node of preset condition, and the return module is used for will be described
CDN node information is back to the client;
The source station server 703 is used to provide the requested content of client to the CDN node;
The CDN node 704 can specifically include:
First receiving module, the second content access request initiated for receiving the client;
Acquisition module is asked for obtaining the client from source station server according to second content access request
Content;
Extraction module, for extracting the text message in the requested content of the client;
Replacement module, for the uniform resource position mark URL in the text message to be replaced with the CDN node itself
URL;
Module is returned to, for the URL of itself to be back to the client.
It should also be noted that, herein, relational terms such as first and second and the like are used merely to one
Entity or operation are distinguished with another entity or operation, without necessarily requiring or implying between these entities or operation
There are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant are intended to contain
Lid non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also include other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor
The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit
Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology
In any other form of storage medium well known in field.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention.
Various modifications to these embodiments will be apparent to those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest range caused.