CN107749887A - A kind of CDN resource allocations, localization method and device and CDN system - Google Patents

A kind of CDN resource allocations, localization method and device and CDN system Download PDF

Info

Publication number
CN107749887A
CN107749887A CN201711009988.8A CN201711009988A CN107749887A CN 107749887 A CN107749887 A CN 107749887A CN 201711009988 A CN201711009988 A CN 201711009988A CN 107749887 A CN107749887 A CN 107749887A
Authority
CN
China
Prior art keywords
server
resource
virtual
identification
mapping
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711009988.8A
Other languages
Chinese (zh)
Inventor
陈辉
王守堰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Storm Group Ltd By Share Ltd
Original Assignee
Storm Group Ltd By Share 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 Storm Group Ltd By Share Ltd filed Critical Storm Group Ltd By Share Ltd
Priority to CN201711009988.8A priority Critical patent/CN107749887A/en
Publication of CN107749887A publication Critical patent/CN107749887A/en
Pending legal-status Critical Current

Links

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
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of CDN resource allocations, localization method and device and CDN system, the CDN resource allocation methods include:Obtain the resource identification of resource to be allocated and the server identification of each server in server group;The resource identification and the server identification are mapped in annular region according to default hash algorithm;Inquired about according to the resource identification in the annular region by preset direction, it is determined that server corresponding to first server identification found is used to deposit resource to be allocated corresponding to the resource identification, the preset direction is clockwise or counterclockwise;By the resource allocation to be allocated to the corresponding server.Technical scheme, resource failed ratio is significantly reduced, original CDN resources access a large amount of failures during solving the problems, such as CDN dilatations and capacity reducing.

Description

A kind of CDN resource allocations, localization method and device and CDN system
Technical field
The present invention relates to network transmission technology field, especially a kind of CDN resource allocations, localization method and device and CDN System.
Background technology
CDN (Content Delivery Network, content distributing network) basic ideas are to avoid interconnecting as far as possible The online bottleneck and link for being possible to influence data transmission bauds and stability, make content transmission faster, it is more stable.By Network places one on the existing Internet basic layer intelligent virtual network that node server is formed, CDN systems everywhere System can be in real time according to the connection of network traffics and each node, load state and comprehensive to the distance of user and response time etc. Information is closed to re-direct the request of user on the service node nearest from user.So that user can obtain required content nearby, Solve the crowded situation of Internet network, improve the response speed that user accesses website.
Assuming that some websites, it has recently been found that as flow increases, server stress is increasing, before direct read/write data The mode in storehouse less gives power, then introduces high performance distributed memory target cache system (hereinafter referred to as Memcached) As caching mechanism.If one, which shares three machines, can be used as Memcached servers, it is obvious that simplest strategy is Memcached requests each time are sent to a Memcached server at random, but this strategy may bring two Problem:First, same part data may be stored on different machines and cause data redundancy, two have been possible to certain data It is buffered but accesses and do not hit but, because can not ensures that all access to identical key are sent to identical service Device.Therefore, randomized policy either time efficiency or space efficiency is all very bad.
Solving the above problems need to only accomplish such as subsequent point:Ensure that the access to same asset can be sent to identical clothes Business device.
The management of existing CDN resources and Host map relation typically uses the algorithm of simple Hash,
Such as accessing every time, its cryptographic Hash can be calculated by following algorithm:
H=Hash (key) %3
Wherein Hash is a Hash mapping function from character string to positive integer, and key represents resource identification.So, such as It is 0,1,2 that fruit numbers Memcached Server respectively, then can calculates server numbering h according to above formula and key, Then go to access.
Although this method solves two problems above-mentioned, but some other problems be present.If will be upper The method of stating is abstracted, it is believed that is passed through:
H=Hash (key) %N
Which platform server the request that this formula is calculated to each resource should be sent to, and wherein N is the platform of server Number, and server is numbered according to 0-(N-1).
The problem of this algorithm, is that fault-tolerance and autgmentability are bad.So-called fault-tolerance refers to work as some in system or several When individual server becomes unavailable, whether whole system can correct Effec-tive Function;And autgmentability refers to when the new service of addition After device, whether whole system can correct Effec-tive Function.
It is now assumed that there is a server to delay machine, then in order to fill a vacancy, by the server for the machine of delaying from numbered list Middle removal, server below moves forward in order and subtracts one by its number value by one, and now each key will be by h=Hash (key) % (N-1) is recalculated;Equally, if having increased a server newly, although original server numbering does not have to change, It is to recalculate cryptographic Hash by h=Hash (key) % (N+1).
When resource number is M, server number of units is N, and common hash algorithm dilatation in theory can cause M* (1-1/N) quantity Original resource access failure.Therefore, once there is server change in system, substantial amounts of resource can be relocated to different clothes Business device is not hit by so as to cause largely to cache.
The content of the invention
A technical problem to be solved of the embodiment of the present invention is:The fault-tolerance and autgmentability of CDN system are poor.
A kind of CDN resource allocations, localization method and device and CDN system of the embodiment of the present invention.The technical scheme is as follows:
First aspect according to embodiments of the present invention, there is provided a kind of CDN resource allocation methods, methods described include:
Obtain the resource identification of resource to be allocated and the server identification of each server in server group;
The resource identification and the server identification are mapped in annular region according to default hash algorithm;
Inquired about according to the resource identification in the annular region by preset direction, it is determined that first found Server corresponding to server identification is used to deposit resource to be allocated corresponding to the resource identification, and the preset direction is up time Pin direction or counter clockwise direction;
By the resource allocation to be allocated to the corresponding server.
Optionally, methods described also includes:
When being virtual server corresponding to first server identification found, it is corresponding to inquire about the virtual server Physical server, determine the physical server be used for deposit resource to be allocated corresponding to the resource identification.
Optionally, the basis presets hash algorithm and the resource identification and the server identification is mapped into annulus On domain, including:
Mapping calculation is carried out to the resource identification and virtual server mark according to default hash algorithm, obtains institute State virtual server mapping value corresponding to resource impact value corresponding to resource identification and virtual server mark;
The virtual server mapping value is arranged according to preset order, obtains virtual server mapping value list, The preset order is order from small to large or from big to small;
Inquired about according to the resource identification in the annular region by preset direction, it is determined that first found Server corresponding to server identification is used to deposit resource to be allocated corresponding to the resource identification, including:
Meet preparatory condition according to first in the first resource mapping value inquiry virtual server mapping value list First virtual server mapping value, the preparatory condition are more than or less than the first resource mapping value;
Determine the first virtual server corresponding to the first virtual server mapping value, and first Virtual Service First physical server corresponding to device, first physical server are used to deposit money to be allocated corresponding to the resource identification Source.
Optionally, when increasing an at least physical server in the server group newly, methods described also includes:
Obtain the newly-increased virtual server mark of virtual server corresponding to newly-increased physical server;
The basis presets hash algorithm and the resource identification and the server identification is mapped in annular region, also Including:
Mapping calculation is carried out to the newly-increased virtual server mark according to default hash algorithm, obtained described newly-increased virtual Increase virtual server mapping value corresponding to server identification newly;
The newly-increased virtual server mapping value is added in the server mappings value list, and by the server Servers-all mapping value in mapping value list rearranges according to the preset order;
And/or when an at least physical server failure in the server group, methods described also includes:
Obtain the failure virtual server mark of virtual server corresponding to the physical server of failure;
The basis presets hash algorithm and the resource identification and the server identification is mapped in annular region, also Including:
Mapping calculation is carried out to the failure virtual server mark according to default hash algorithm, it is virtual to obtain the failure Failure virtual server mapping value corresponding to server identification;
The failure virtual server mapping value is deleted from the server mappings value list, and virtually taken described Servers-all mapping value in business device mapping value list rearranges according to the preset order.
Optionally, methods described also includes:
Obtain the disk size of each physical server;
The number of virtual server according to corresponding to the disk size determines each physical server.
Optionally, methods described also includes:
According to physical server numbering generation corresponding to the numbering of the virtual server and the virtual server Virtual server identifies;
The virtual server mark includes:First preset characters string, by the physical server numbering preset value is entered The numbering of the remainder values, the second preset characters string and the virtual server that are obtained after row modulo operation;
And/or the length of the resource identification is at least 20 bytes;And/or the length of the virtual server mark At least 20 bytes.
Second aspect according to embodiments of the present invention, there is provided a kind of CDN resource location methods, methods described include:
Resource identification is extracted according to the resource request received;
Mapping calculation is carried out to the resource identification according to default hash algorithm, obtains resource impact value;
After the resource impact value is found from annular region, inquired about by preset direction, obtain first server and reflect It is first server mapping value to penetrate value, and the annular region includes the default hash algorithm of basis by the resource identification and the clothes The mapping result that the server identification of business device is mapped, the preset direction is clockwise or counterclockwise;
The resource request is sent to first server corresponding to the first server mapping value, taken by described first Business device exports resource corresponding to the resource request.
Optionally, when the first server fails, methods described also includes:
The preset direction inquiry, obtains second server mappings value and is reflected for second server in the annular region Penetrate value;
When it is determined that second server corresponding to the second server mapping value is effective, the resource request is sent to The second server, the resource as corresponding to the upward primary server group of the second server obtains the resource request are laggard Row output;
And/or when being virtual server corresponding to the first server mapping value, methods described also includes:
The first physical server corresponding to the first server mapping value is inquired about, is exported by first physical server Resource corresponding to the resource request;
The resource request is sent to first physical server.
The third aspect according to embodiments of the present invention, there is provided a kind of CDN resource allocation devices, described device include:
First acquisition module, the service of resource identification and each server in server group for obtaining resource to be allocated Device identifies;
Mapping block, for the resource identification and the server identification to be mapped into annular according to default hash algorithm On region;
Enquiry module, for being inquired about according to the resource identification in the annular region by preset direction, it is determined that Server corresponding to first server identification found is used to deposit resource to be allocated corresponding to the resource identification, described Preset direction is clockwise or counterclockwise;
Distribute module, for by the resource allocation to be allocated to corresponding to the server.
Optionally, the enquiry module, for when being virtual server corresponding to first server identification finding When, inquire about the virtual server corresponding to physical server, determine the physical server be used for deposit the resource identification Corresponding resource to be allocated.
Optionally, the mapping block includes:
Calculating sub module, for being carried out according to default hash algorithm to the resource identification and virtual server mark Mapping calculation, obtain virtual server corresponding to resource impact value corresponding to the resource identification and virtual server mark Mapping value;
Submodule is arranged, for the virtual server mapping value to be arranged according to preset order, is virtually taken Business device mapping value list, the preset order is order from small to large or from big to small;
The enquiry module includes:
Submodule is inquired about, for first to be inquired about in the virtual server mapping value list according to first resource mapping value Meet the first virtual server mapping value of preparatory condition, the preparatory condition is to be mapped more than or less than the first resource Value;
Determination sub-module, for determining the first virtual server corresponding to the first virtual server mapping value, and First physical server corresponding to first virtual server, first physical server are used to deposit the resource identification Corresponding resource to be allocated.
Optionally, first acquisition module, for obtaining the new of virtual server corresponding to newly-increased physical server Increase virtual server mark;
The calculating sub module of the mapping block, it is additionally operable to according to default hash algorithm to the newly-increased virtual server mark Know and carry out mapping calculation, obtain increasing virtual server mapping value newly corresponding to the newly-increased virtual server mark;
The arrangement submodule of the mapping block, it is additionally operable to the newly-increased virtual server mapping value being added to the clothes It is engaged in device mapping value list, and by the Servers-all mapping value in the server mappings value list according to the preset order Rearrange;
And/or first acquisition module, for when at least physical server failure in the server group, Obtain the failure virtual server mark of virtual server corresponding to the physical server of failure;
The calculating sub module of the mapping block, it is additionally operable to according to default hash algorithm to the failure virtual server mark Know and carry out mapping calculation, obtain failure virtual server mapping value corresponding to the failure virtual server mark;
The arrangement submodule of the mapping block, it is additionally operable to the failure virtual server mapping value from the server Deleted in mapping value list, and by the Servers-all mapping value in the server mappings value list according to the preset order Rearrange.
Optionally, described device also includes:
Second acquisition module, for obtaining the disk size of each physical server;
Determining module, for virtual server corresponding to determining each physical server according to the disk size Number.
Optionally, described device also includes:
Generation module, for physical server corresponding to the numbering according to the virtual server and the virtual server Numbering generates the virtual server mark.
Optionally, the virtual server mark includes:First preset characters string, by the physical server number to pre- If value carries out the numbering of remainder values, the second preset characters string and the virtual server obtained after modulo operation;And/or institute The length for stating resource identification is at least 20 bytes;And/or the length of the virtual server mark is at least 20 bytes.
Fourth aspect according to embodiments of the present invention, there is provided a kind of CDN Resource orientations device, applied to server group, institute State server group includes including at least two-server, described device:
Extraction module, for extracting resource identification according to the resource request received;
Mapping calculation module, for carrying out mapping calculation to the resource identification according to default hash algorithm, obtain resource Mapping value;
Enquiry module, after the resource impact value is found from annular region, inquired about by preset direction, obtain One server mappings value is first server mapping value, and the annular region includes the default hash algorithm of basis by the resource The mapping result that the server identification of mark and the server is mapped, the preset direction are clockwise direction or inverse time Pin direction;
Sending module, for the resource request to be sent into first service corresponding to the first server mapping value Device, the resource as corresponding to the first server exports the resource request.
Optionally, the enquiry module, the preset direction inquiry in the annular region is additionally operable to, obtains second Server mappings value is second server mapping value;
The sending module, it is additionally operable to when it is determined that second server corresponding to the second server mapping value is effective, The resource request is sent to the second server, the money is obtained by the upward primary server group of the second server Exported after resource corresponding to the request of source;
And/or the enquiry module, it is additionally operable to when the first server mapping value corresponds to virtual server, inquires about First physical server corresponding to the first server mapping value, the resource request is exported by first physical server Corresponding resource;
The sending module, it is additionally operable to the resource request being sent to first physical server.
5th aspect according to embodiments of the present invention, there is provided a kind of CDN system, the system include:CDN resource allocations fill Put and at least one first server group, each first server group include at least two-server,
The CDN resource allocation devices, for obtain resource to be allocated resource identification and the server group in it is each The server identification of server;The resource identification and the server identification are mapped to by annulus according to default hash algorithm On domain;Inquired about according to the resource identification in the annular region by preset direction, it is determined that first found takes Server corresponding to business device mark is used to deposit resource to be allocated corresponding to the resource identification, and the preset direction is clockwise Direction or counter clockwise direction;By the resource allocation to be allocated to the corresponding server;
The server, for depositing the resource to be allocated according to the distribution of the CDN resource allocation devices.
Optionally, the server includes physical server and virtual server, and the server group includes at least two Physical server, each physical server correspond to the virtual server of predetermined number,
The CDN resource allocation devices, for when virtual server corresponding to first server identification found, Physical server corresponding to inquiring about the virtual server, determine that the physical server is corresponding for depositing the resource identification Resource to be allocated.
Optionally, the first server group includes first server, and the system also includes:CDN Resource orientation devices,
The CDN Resource orientations device, for according to the resource request extraction first resource mark received;According to described Default hash algorithm identifies to the first resource carries out mapping calculation, obtains first resource mapping value;Looked into from annular region After finding the first resource mapping value, inquired about in the annular region by preset direction, obtain first server mappings It is worth for first server mapping value;The resource request is sent to first service corresponding to the first server mapping value Device, the resource as corresponding to the first server exports the resource request;
The first server, export resource corresponding to the resource request.
Optionally, the first server group also includes second server, and the system is also included positioned at the described first clothes At least one second server group of business device group last layer, each second server group include at least two-server,
The second server group, all resources included for storing the content distribution network system;
The CDN Resource orientations device, for when the first server fails, being preset over an annular region by described Direction query, it is second server mapping value to obtain second server mappings value;
When it is determined that second server corresponding to the second server mapping value is effective, the resource request is sent to The second server, the resource as corresponding to the upward primary server group of the second server obtains the resource request are laggard Row output;
The second server, for being carried out after obtaining resource corresponding to the resource request to the second server group Output.
The embodiment of the present invention, resource failed ratio is significantly reduced, solved original during CDN dilatations and capacity reducing CDN resources access the problem of a large amount of failures.
In addition, the present invention method specific implementation when, due to the total bandwidth flow that server can be provided be it is fixed, The output speed upper limit based on code check for each video request distribution server, thus, actually server can be handled simultaneously Concurrent request quantity nor fixed, the maximum number of concurrent that server is handled simultaneously is based on the corresponding video of each request Code check and dynamic change, therefore so that the utilization rate of network is greatly improved.
Below by drawings and examples, technical scheme is described in further detail.
Brief description of the drawings
The accompanying drawing of a part for constitution instruction describes embodiments of the invention, and is used to explain together with description The principle of the present invention.
Referring to the drawings, according to following detailed description, the present invention can be more clearly understood, wherein:
Fig. 1 is the flow chart of the CDN resource allocation methods shown in the embodiment of the present invention;
Fig. 2 is the annular region schematic diagram shown in the embodiment of the present invention;
Fig. 3 is the annular region schematic diagram shown in another embodiment of the present invention;
Fig. 4 is the annular region schematic diagram shown in another embodiment of the present invention;
Fig. 5 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention;
Fig. 6 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention;
Fig. 7 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention;
Fig. 8 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention;
Fig. 9 is the flow chart of the CDN resource location methods shown in one embodiment of the invention;
Figure 10 is the flow chart of the CDN resource location methods shown in another embodiment of the present invention;
Figure 11 is the flow chart of the CDN resource location methods shown in another embodiment of the present invention;
Figure 12 is the block diagram of the CDN resource allocation devices shown in the embodiment of the present invention;
Figure 13 is the block diagram of the CDN resource allocation devices shown in another embodiment of the present invention;
Figure 14 is the block diagram of the CDN resource allocation devices shown in another embodiment of the present invention;
Figure 15 is the block diagram of the CDN resource allocation devices shown in another embodiment of the present invention;
Figure 16 is the block diagram of the CDN Resource orientation devices shown in the embodiment of the present invention;
Figure 17 is the block diagram of the CDN system shown in the embodiment of the present invention;
Figure 18 is the block diagram of the CDN system shown in another embodiment of the present invention;
Figure 19 is the block diagram of the CDN system shown in another embodiment of the present invention.
Embodiment
The various exemplary embodiments of the present invention are described in detail now with reference to accompanying drawing.It should be noted that:Unless have in addition Body illustrates that the unlimited system of part and the positioned opposite of step, numerical expression and the numerical value otherwise illustrated in these embodiments is originally The scope of invention.
Simultaneously, it should be appreciated that for the ease of description, the size of the various pieces shown in accompanying drawing is not according to reality Proportionate relationship draw.
The description only actually at least one exemplary embodiment is illustrative to be never used as to the present invention below And its application or any restrictions that use.
It may be not discussed in detail for technology, method and apparatus known to person of ordinary skill in the relevant, but suitable In the case of, the technology, method and apparatus should be considered as part for specification.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang Yi It is defined, then it need not be further discussed in subsequent accompanying drawing in individual accompanying drawing.
The embodiment of the present invention can apply to computer system/server, and it can be with numerous other universal or special calculating System environments or configuration operate together.Suitable for be used together with computer system/server well-known computing system, ring The example of border and/or configuration includes but is not limited to:Personal computer system, server computer system, thin client, thick client Machine, hand-held or laptop devices, the system based on microprocessor, set top box, programmable consumer electronics, NetPC Network PC, Little types Ji calculates machine Xi Tong ﹑ large computer systems and the distributed cloud computing technology environment including any of the above described system, etc..
Computer system/server can be in computer system executable instruction (such as journey performed by computer system Sequence module) general linguistic context under describe.Generally, program module can include routine, program, target program, component, logic, number According to structure etc., they perform specific task or realize specific abstract data type.Computer system/server can be with Implement in distributed cloud computing environment, in distributed cloud computing environment, task is by by the long-range of communication network links Manage what equipment performed.In distributed cloud computing environment, program module can be located at the Local or Remote meter for including storage device In calculation system storage medium.
Technical scheme provided in an embodiment of the present invention, it is related to the server that resource is provided in CDN, generally, according to offer clothes The region of business or type etc., these servers can be grouped, each server group includes at least two-server.
Fig. 1 is the flow chart of the CDN resource allocation methods shown in the embodiment of the present invention.In the present embodiment, as shown in figure 1, The CDN resource allocation methods are applied to server group, comprise the following steps:
Step S11, obtain the resource identification of resource to be allocated and the server identification of each server in server group;
Step S12, resource identification and server identification are mapped in annular region according to default hash algorithm;
Step S13, inquired about over an annular region by preset direction according to resource identification, it is determined that first found Server corresponding to server identification is used to deposit resource to be allocated corresponding to resource identification, preset direction for clockwise or Counterclockwise;
Step S14, by resource allocation to be allocated to corresponding server.
For example, a server group includes 3 servers, numbering 1,2 and 3;
There are 4 resources to be allocated:A、B、C、D.
Fig. 2 is the annular region schematic diagram shown in the embodiment of the present invention.If resource is stored in as shown in Fig. 2 setting On first main frame run into by clock-wise order.Then on the server, resource D is stored on server 3 for resource A storages, money Source B and C storage is on a server 2.
If by server group dilatation to 4 servers, the server of increase numbering 4.Fig. 3 is another embodiment of the present invention The annular region schematic diagram shown.As shown in figure 3, first main frame that resource is stored in and run into by clock-wise order is still set On.Then resource A, C, D deposit position is constant, and only resource B is stored on server 4.
If by server group capacity reducing to 2 servers, the server of reduction numbering 3.Fig. 4 is another embodiment of the present invention The annular region schematic diagram shown.As shown in figure 4, first main frame that resource is stored in and run into by clock-wise order is still set On.Then resource A, B, C deposit position is constant, and only resource D is stored on server 2.
In the present embodiment, when resource number is M, server number of units is N, theoretical when one server of dilatation or capacity reducing The upper original resource that can only make M/N accesses failure, significantly reduces resource failed ratio, solves CDN dilatations and capacity reducing mistake Original CDN resources access the problem of a large amount of failures in journey.
In another embodiment, in order to improve the uniformity of resource distribution on each server in server group, introduce Virtual server.It is mapped to by increasing multiple virtual servers in annular region so that each physics clothes over an annular region The probability that business device is assigned to resource is more balanced.In the present embodiment, server includes physical server and virtual server, clothes Business device group corresponds to the virtual server of predetermined number including at least two physical servers, each physical server.In above-mentioned step In rapid S13, when being virtual server corresponding to first server identification found, thing corresponding to virtual server is inquired about Server is managed, determines that physical server is used to deposit resource to be allocated corresponding to resource identification.
Fig. 5 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention.In the present embodiment, such as Fig. 5 institutes Show, the CDN resource allocation methods comprise the following steps:
Step S51, obtain resource to be allocated resource identification and each physical server corresponding to virtual server void Intend server identification.
In order that the distribution for obtaining resource is more uniform, each physical server can be set and correspond to Virtual Service as much as possible Device, such as corresponding 1024,2048 or 4096 virtual servers.
In general, in actual CDN system, the physical server number relative virtual server in each server group Number is considerably less, and generally 8,16,24 etc..Therefore, in mapping, physical server can be neglected, only obtains virtual clothes Business device mark is mapped, and does not interfere with the uniformity of resource allocation.
Step S52, according to default hash algorithm by resource identification and virtual server identity map to annular region.
The default hash algorithm can include MD5 algorithms, and resource identification and virtual server mark are converted into 16 words The mapping value of section, is evenly distributed on 0~232-1In the range of.Also, MD5 algorithms dispersiveness is preferably, when input changes a byte, Exporting change is very big, meets the use demand of the embodiment of the present invention.
Step S53, inquired about over an annular region by preset direction according to resource identification, it is determined that first found Physical server corresponding to virtual server mark is used to deposit resource to be allocated corresponding to resource identification, and preset direction is up time Pin direction or counter clockwise direction.
Step S54, by resource allocation to be allocated to corresponding physical server.
Staff tests in test process for more than 700 ten thousand order video resources, sets a server group Including 8 physical servers, every server corresponds to VNodeNum virtual server, counted different VNodeNum it is several under The resource number that each physical server can be assigned to.Shown in table 1-4 specific as follows,
Table 1
Table 2
Table 3
Table 4
It is can be seen that according to table 1-4 in the case where total number resource is constant, with the increase of virtual server number, money Source distribution is further uniform, the time-consuming simply slightly increase of resource allocation.
In the present embodiment, virtual server is introduced in mapping process so that substantial amounts of resource identification and virtual server Mark passes through above-mentioned resource allocation policy so that each physical server is assigned to money by the annular region of scattered mapping The probability in source is more balanced.
Fig. 6 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention.As shown in fig. 6, above-mentioned steps S12 includes:
Step S61, mapping calculation is carried out to resource identification and virtual server mark according to default hash algorithm, provided Virtual server mapping value corresponding to resource impact value corresponding to the mark of source and virtual server mark;
Step S62, virtual server mapping value is arranged according to preset order, obtain virtual server mapping value row Table, preset order are order from small to large or from big to small.
Above-mentioned steps S13 includes:
Step S63, meet default bar according to first in first resource mapping value inquiry virtual server mapping value list First virtual server mapping value of part, preparatory condition are more than or less than first resource mapping value;
Step S64, determine the first virtual server corresponding to the first virtual server mapping value, and the first Virtual Service First physical server corresponding to device, the first physical server are used to deposit resource to be allocated corresponding to resource identification.
For example, a server group has 8 physical servers, corresponding 2048 virtual servers of every physical server, warp After crossing default hash algorithm mapping, 16384 virtual server mapping values are always obtained.
If being inquired about over an annular region according to clockwise direction according to resource identification, then these virtual servers are reflected After value is penetrated according to order sequence from small to large, virtual server mapping value list is obtained.According to first resource mapping value in void Intend inquiring about in server mappings value list, finding first virtual server mapping value for being more than the first resource mapping value is First virtual server mapping value.
If being inquired about over an annular region according to counter clockwise direction according to resource identification, then these virtual servers are reflected After value is penetrated according to order sequence from big to small, virtual server mapping value list is obtained.According to first resource mapping value in void Intend inquiring about in server mappings value list, finding first virtual server mapping value for being less than the first resource mapping value is First virtual server mapping value.
First virtual server corresponding to determining the first virtual server mapping value, further determine that the first virtual clothes First physical server corresponding to business device, so that it may by resource allocation to be allocated corresponding to first resource mapping value to the physical services Device is deposited.
In the present embodiment, after being calculated by default hash algorithm, all resource identifications and virtual server mark All it is switched to 0~232-1In the range of 16 bytes mapping value, and each resource identification and virtual server mark are right Answer unique mapping value.Therefore, by being ranked up according to preset order to virtual server mapping value, according to resource impact value Qualified virtual server mapping value is searched in list after sequence, is reflected so as to allocate resources to the virtual server Physical server corresponding to value is penetrated, to improve the uniformity of resource allocation on each physical server in server group, and Resource failed ratio is significantly reduced during CDN dilatations and capacity reducing.
Fig. 7 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention.As shown in fig. 7, work as server When increasing an at least physical server in group newly, this method also includes:
Step S71, obtain the newly-increased virtual server mark of virtual server corresponding to newly-increased physical server;
Above-mentioned steps S12 also includes:
Step S72, mapping calculation is carried out to newly-increased virtual server mark according to default hash algorithm, obtained newly-increased virtual Increase virtual server mapping value corresponding to server identification newly;
Step S73, newly-increased virtual server mapping value is added in server mappings value list, and by server mappings Servers-all mapping value in value list rearranges according to preset order.
In the present embodiment, if corresponding 2048 virtual servers of every physical server, one is increased newly in server group Platform physical server, accordingly to increase by 2048 virtual servers, after mapping, this 2048 virtual servers can be uniform Distribution over an annular region, i.e., in virtual server mapping value list, so, was originally assigned to the money of other physical servers It source, also uniformly can again be assigned on newly-increased physical server, still ensure that in server group on each server The uniformity of resource distribution.Also, if total number resource is 7776930, increase newly after a physical server in server group Totally 8 servers, then the resource for actually there was only 7776930/8, about 97116 or so accesses failure, in CDN dilation process Significantly reduce resource failed ratio.
Fig. 8 is the flow chart of the CDN resource allocation methods shown in another embodiment of the present invention.As shown in figure 8, work as server In group during an at least physical server failure, method also includes:
Step S81, obtain the failure virtual server mark of virtual server corresponding to the physical server of failure;
Above-mentioned steps S12 also includes:
Step S82, mapping calculation is carried out to failure virtual server mark according to default hash algorithm, it is virtual to obtain failure Failure virtual server mapping value corresponding to server identification;
Step S83, failure virtual server mapping value is deleted from server mappings value list, and by virtual server Servers-all mapping value in mapping value list rearranges according to preset order.
In the present embodiment, if corresponding 2048 virtual servers of every physical server, one is reduced in server group Platform physical server, accordingly to reduce by 2048 virtual servers, because virtual server is to be evenly distributed to annulus before On domain, i.e., virtual server mapping value corresponding to each physical server is uniformly divided in virtual server maps value list Cloth, so, the resource of the physical server was originally assigned to, and also can uniformly be assigned to remaining physical server again On, still ensure that the load balancing of each server and the uniformity of resource distribution in server group.Also, if resource is total Number is 7776930, totally 8 servers in original server group, after reducing a physical server, is then actually only had The resource of 7776930/8, about 97116 or so accesses failure, and resource failed ratio is significantly reduced during CDN capacity reducings Example.
In another embodiment, if the disk size of each physical server is different in server group, i.e. storage capacity Difference, then this method also include:
Obtain the disk size of each physical server;It is virtual according to corresponding to disk size determines each physical server The number of server.
So, the number of virtual server corresponding to physical server is more, and resource is assigned on the physical server Probability it is bigger, the number of its corresponding virtual server is set according to the storage capacity of server, resource is rationally divided Match somebody with somebody so that resource can be efficiently stored.
In another embodiment, this method also includes:According to thing corresponding to the numbering of virtual server and virtual server Manage server numbering generation virtual server mark.
In another embodiment, virtual server mark includes:First preset characters string, by physical server number to pre- If value carries out the numbering of remainder values, the second preset characters string and the virtual server obtained after modulo operation.
For example, the first preset characters string is BFP2p2, the second preset characters string is bf!@#P2P#, physical server numbering Preset value 100, it is 3 by the remainder values that physical server numbering to preset value obtain after modulo operation for 200103, it is empty It is 2000 to intend server numbering.Then virtual server mark can be:BFP2p23bf!@#P2P#2000.Wherein, Virtual Service The length of device mark is at least 20 bytes.
In the present embodiment, in order to avoid the situation that the Virtual Service after Hash mapping its mapping value duplicates, set and close The virtual server mark of suitable complexity, when preset value is 100, physical server is may be such that when within 100, virtual clothes Device mapping value of being engaged in is not in repetition situation.In addition, virtual server mark is longer using length, the higher name side of complexity Formula, the probability duplicated after Hash mapping also can be smaller.
Wherein, the length of resource identification is at least 20 bytes.May be million or thousand because whole resource quantities are more Ten thousand quantity, therefore, the name of resource identification need complexity enough, and length long enough, so, it is obtained after Hash mapping Resource impact value with regard to 0~2 can be evenly distributed in32-1In the range of.
The embodiment of the present invention also provides a kind of CDN resource location methods, based on the above-mentioned storage strategy to resource, works as user During to CDN acquisition request resources, resource request is navigated to and stored corresponding to the resource request on the server of resource.
Fig. 9 is the flow chart of the CDN resource location methods shown in one embodiment of the invention.As shown in figure 9, the CDN resources Localization method includes:
Step S91, resource identification is extracted according to the resource request received;
Step S92, mapping calculation is carried out to resource identification according to default hash algorithm, obtains resource impact value;
Step S93, after resource impact value is found from annular region, inquired about by preset direction, obtain first service Device mapping value is first server mapping value, and annular region includes the default hash algorithm of basis by resource identification and the clothes of server The mapping result that business device mark is mapped, preset direction is clockwise or counterclockwise;
Step S94, resource request is sent to first server corresponding to first server mapping value, by first server Export resource corresponding to resource request.
Wherein, after resource impact value is found from annular region, inquired about by preset direction, obtain first server and reflect It is first server mapping value to penetrate value.Specific implementation is as follows:
Server mappings value list is previously stored with, after server mappings value is sorted by preset order, obtains server Value list is mapped, the preset order is order from small to large or from big to small.
First first server for meeting preparatory condition in server mappings value list is inquired about according to resource impact value to reflect Value is penetrated, the preparatory condition is more than or less than the first resource mapping value;Determine server corresponding to the server mappings value For the server of storage resource.
In the present embodiment, when receiving resource request, according to resource identification therein, search after Hash mapping with Server mappings value corresponding to resource impact value, so that it is determined that storing the server of the resource.So, positioned by the above method Resource, the server for storing the resource can be more rapidly and accurately found, service is increased or decreased in addition, working as in server group During device, can also get the resource to be asked by other servers, improve the success rate for obtaining resource, Consumer's Experience compared with It is good.
Figure 10 is the flow chart of the CDN resource location methods shown in another embodiment of the present invention.As shown in Figure 10, when first During server failure, this method also includes:
Step S101, preset direction inquiry over an annular region, it is second server to obtain second server mappings value Mapping value;
Step S102, when it is determined that second server corresponding to second server mapping value is effective, resource request is sent To second server, exported after the resource as corresponding to the upward primary server group of second server obtains resource request.
In the present embodiment, when dilatation in server group or capacity reducing, or during server fail, a certain clothes may be caused Be engaged in device failure, i.e., the former resource location deposited on that server frees change, therefore, it is necessary to by other servers again from Upper level server obtains the resource.So, the success rate for obtaining resource, better user experience are improved.
Figure 11 is the flow chart of the CDN resource location methods shown in another embodiment of the present invention.As shown in figure 11, server Including physical server and virtual server, server group includes at least two physical servers, and each physical server is corresponding The virtual server of predetermined number.When being virtual server corresponding to first server mapping value, this method also includes:
Step S111, the first physical server corresponding to first server mapping value is inquired about, it is defeated by the first physical server Go out resource corresponding to resource request;
Step S112, resource request is sent to the first physical server.
In the present embodiment, in order to improve the uniformity of resource distribution on each server in server group, introduce virtual Server.It is mapped to by increasing multiple virtual servers in annular region so that each physical server over an annular region The probability for being assigned to resource is more balanced.Therefore, in Resource orientation, if what is navigated to is virtual server, need Physical server corresponding to the virtual server is further searched for, resource is obtained from the physical server.
Following is apparatus of the present invention embodiment, can be used for performing the inventive method embodiment.
Figure 12 is the block diagram of the CDN resource allocation devices shown in the embodiment of the present invention, and the device can pass through software, hardware Or both be implemented in combination with it is some or all of as electronic equipment.As shown in figure 12, wherein, server group is included at least Two-server.The CDN resource allocation devices, including:
First acquisition module 121, for obtaining the resource identification of resource to be allocated and each server in server group Server identification;
Mapping block 122, for resource identification and server identification to be mapped into annular region according to default hash algorithm On;
Enquiry module 123, for being inquired about over an annular region by preset direction according to resource identification, it is determined that finding First server identification corresponding to server be used for deposit resource to be allocated corresponding to resource identification, preset direction is up time Pin direction or counter clockwise direction;
Distribute module 124, for by resource allocation to be allocated to corresponding to server.
In the present embodiment, when resource number is M, server number of units is N, theoretical when one server of dilatation or capacity reducing The upper original resource that can only make M/N accesses failure, significantly reduces resource failed ratio, solves CDN dilatations and capacity reducing mistake Original CDN resources access the problem of a large amount of failures in journey.
In another embodiment, server includes physical server and virtual server, and server group includes at least two Physical server, each physical server correspond to the virtual server of predetermined number,
Enquiry module, for when virtual server corresponding to first server identification found, inquiring about virtual clothes Physical server corresponding to business device, determine that physical server is used to deposit resource to be allocated corresponding to resource identification.
In the present embodiment, in order to improve the uniformity of resource distribution on each server in server group, introduce virtual Server.It is mapped to by increasing multiple virtual servers in annular region so that each physical server over an annular region The probability for being assigned to resource is more balanced.
Figure 13 is the block diagram of the CDN resource allocation devices shown in another embodiment of the present invention, as shown in figure 13, mapping block 122 include:
Calculating sub module 131, for being mapped according to default hash algorithm resource identification and virtual server mark Calculate, obtain virtual server mapping value corresponding to resource impact value corresponding to resource identification and virtual server mark;
Submodule 132 is arranged, for virtual server mapping value to be arranged according to preset order, obtains Virtual Service Device maps value list, and preset order is order from small to large or from big to small;
Enquiry module 123 includes:
Submodule 133 is inquired about, for first to be inquired about in virtual server mapping value list according to first resource mapping value Meet the first virtual server mapping value of preparatory condition, preparatory condition is more than or less than first resource mapping value;
Determination sub-module 134, for determining the first virtual server corresponding to the first virtual server mapping value, Yi Ji First physical server corresponding to one virtual server, the first physical server are used to deposit money to be allocated corresponding to resource identification Source.
In the present embodiment, after being calculated by default hash algorithm, all resource identifications and virtual server mark All it is switched to 0~232-1In the range of 16 bytes mapping value, and each resource identification and virtual server mark are right Answer unique mapping value.Therefore, by being ranked up according to preset order to virtual server mapping value, according to resource impact value Qualified virtual server mapping value is searched in list after sequence, is reflected so as to allocate resources to the virtual server Physical server corresponding to value is penetrated, to improve the uniformity of resource allocation on each physical server in server group, and Resource failed ratio is significantly reduced during CDN dilatations and capacity reducing.
In another embodiment, the first acquisition module 121, for obtaining Virtual Service corresponding to newly-increased physical server The newly-increased virtual server mark of device;
The calculating sub module 131 of mapping block 122, it is additionally operable to according to default hash algorithm to newly-increased virtual server mark Mapping calculation is carried out, obtains increasing virtual server mapping value newly corresponding to newly-increased virtual server mark;
The arrangement submodule 132 of mapping block 122, it is additionally operable to newly-increased virtual server mapping value being added to server and reflects Penetrate in value list, and the Servers-all mapping value in server mappings value list is rearranged according to preset order.
In the present embodiment, if corresponding 2048 virtual servers of every physical server, one is increased newly in server group Platform physical server, accordingly to increase by 2048 virtual servers, after mapping, this 2048 virtual servers can be uniform Distribution over an annular region, i.e., in virtual server mapping value list, so, was originally assigned to the money of other physical servers It source, also uniformly can again be assigned on newly-increased physical server, still ensure that in server group on each server The uniformity of resource distribution.Also, if total number resource is 7776930, increase newly after a physical server in server group Totally 8 servers, then the resource for actually there was only 7776930/8, about 97116 or so accesses failure, in CDN dilation process Significantly reduce resource failed ratio.
In another embodiment, the first acquisition module 121, for when an at least physical server failure in server group When, the failure virtual server for obtaining virtual server corresponding to the physical server of failure identifies;
The calculating sub module 131 of mapping block 122, it is additionally operable to according to default hash algorithm to failure virtual server mark Mapping calculation is carried out, obtain failing failure virtual server mapping value corresponding to virtual server mark;
The arrangement submodule 132 of mapping block 122, be additionally operable to will failure virtual server mapping value from server mappings value Deleted in list, and the Servers-all mapping value in server mappings value list is rearranged according to preset order.
In the present embodiment, if corresponding 2048 virtual servers of every physical server, one is reduced in server group Platform physical server, accordingly to reduce by 2048 virtual servers, because virtual server is to be evenly distributed to annulus before On domain, i.e., virtual server mapping value corresponding to each physical server is uniformly divided in virtual server maps value list Cloth, so, the resource of the physical server was originally assigned to, and also can uniformly be assigned to remaining physical server again On, still ensure that the load balancing of each server and the uniformity of resource distribution in server group.Also, if resource is total Number is 7776930, totally 8 servers in original server group, after reducing a physical server, is then actually only had The resource of 7776930/8, about 97116 or so accesses failure, and resource failed ratio is significantly reduced during CDN capacity reducings Example.
Figure 14 is the block diagram of the CDN resource allocation devices shown in another embodiment of the present invention, and as shown in figure 14, the device is also Including:
Second acquisition module 125, for obtaining the disk size of each physical server;
Determining module 126, the number for virtual server corresponding to determining each physical server according to disk size.
In the present embodiment, the number of virtual server corresponding to physical server is more, and resource is assigned to physics clothes The probability being engaged on device is bigger, and the number of its corresponding virtual server is set according to the storage capacity of server, resource is carried out Reasonable distribution so that resource can be efficiently stored.
In another embodiment, presetting hash algorithm includes MD5 algorithms.
Figure 15 is the block diagram of the CDN resource allocation devices shown in another embodiment of the present invention, and as shown in figure 15, the device is also Including:
Generation module 127, numbered for physical server corresponding to the numbering according to virtual server and virtual server Generate virtual server mark.
In another embodiment, virtual server mark includes:First preset characters string, by physical server number to pre- If value carries out the numbering of remainder values, the second preset characters string and the virtual server obtained after modulo operation.
In another embodiment, the length of resource identification is at least 20 bytes, and the length of virtual server mark is at least For 20 bytes.
In the present embodiment, in order to avoid the situation that the Virtual Service after Hash mapping its mapping value duplicates, set and close The virtual server mark of suitable complexity, when preset value is 100, physical server is may be such that when within 100, virtual clothes Device mapping value of being engaged in is not in repetition situation.In addition, virtual server mark is longer using length, the higher name side of complexity Formula, the probability duplicated after Hash mapping also can be smaller.
Similarly, since whole resource quantities are more, may be million or ten million quantity, therefore, the name of resource identification Enough complexity are needed, length long enough, so, the resource impact value that it is obtained after Hash mapping is with regard to that can be evenly distributed in 0~232-1In the range of.
Figure 16 is the block diagram of the CDN Resource orientation devices shown in the embodiment of the present invention, and the device can pass through software, hardware Or both be implemented in combination with it is some or all of as electronic equipment.As shown in figure 16, wherein, server group is included at least Two-server.The CDN Resource orientation devices, including:
Extraction module 161, for extracting resource identification according to the resource request received;
Mapping calculation module 162, for carrying out mapping calculation to resource identification according to default hash algorithm, obtain resource and reflect Penetrate value;
Enquiry module 163, after resource impact value is found from annular region, inquired about by preset direction, obtain One server mappings value is first server mapping value, and annular region includes the default hash algorithm of basis by resource identification and clothes The mapping result that the server identification of business device is mapped, preset direction is clockwise or counterclockwise;
Sending module 164, for resource request to be sent into first server corresponding to first server mapping value, by Resource corresponding to one server output resource request.
In the present embodiment, when receiving resource request, according to resource identification therein, search after Hash mapping with Server mappings value corresponding to resource impact value, so that it is determined that storing the server of the resource.So, positioned by the above method Resource, the server for storing the resource can be more rapidly and accurately found, service is increased or decreased in addition, working as in server group During device, can also get the resource to be asked by other servers, improve the success rate for obtaining resource, Consumer's Experience compared with It is good.
In another embodiment, enquiry module 163, preset direction inquiry over an annular region is additionally operable to, obtains second Server mappings value is second server mapping value;
Sending module 164, it is additionally operable to when it is determined that second server corresponding to second server mapping value is effective, by resource Request is sent to second server, is carried out after the resource as corresponding to the upward primary server group of second server obtains resource request Output.
In the present embodiment, when dilatation in server group or capacity reducing, or during server fail, a certain clothes may be caused Be engaged in device failure, i.e., the former resource location deposited on that server frees change, therefore, it is necessary to by other servers again from Upper level server obtains the resource.So, the success rate for obtaining resource, better user experience are improved.
In another embodiment, server includes physical server and virtual server, and server group includes at least two Physical server, each physical server correspond to the virtual server of predetermined number.
Enquiry module 163, it is additionally operable to when first server mapping value corresponds to virtual server, inquiry first server is reflected The first physical server corresponding to value is penetrated, the resource as corresponding to the first physical server output resource request;
Sending module 164, it is additionally operable to resource request being sent to the first physical server.
In the present embodiment, in order to improve the uniformity of resource distribution on each server in server group, introduce virtual Server.It is mapped to by increasing multiple virtual servers in annular region so that each physical server over an annular region The probability for being assigned to resource is more balanced.Therefore, in Resource orientation, if what is navigated to is virtual server, need Physical server corresponding to the virtual server is further searched for, resource is obtained from the physical server.
Figure 17 is the block diagram of the CDN system shown in the embodiment of the present invention, and the system can pass through software, hardware or both Be implemented in combination with it is some or all of as electronic equipment.As shown in figure 17, the CDN system includes:
CDN resource allocation devices 171 and at least one first server group 172, each first server group 172 are included extremely Few two-server, first server 1721 and second server 1722,
CDN resource allocation devices 171, for obtain resource to be allocated resource identification and server group 172 in each take The server identification of business device;Resource identification and server identification are mapped in annular region according to default hash algorithm;According to Resource identification is inquired about by preset direction over an annular region, it is determined that being serviced corresponding to first found server identification Device is used to deposit resource to be allocated corresponding to resource identification, and preset direction is clockwise or counterclockwise;Will be to be allocated Resource allocation server corresponding to;
Server 1721 or 1722, for depositing resource to be allocated according to the distribution of CDN resource allocation devices.
In the present embodiment, when resource number is M, server number of units is N, theoretical when one server of dilatation or capacity reducing The upper original resource that can only make M/N accesses failure, significantly reduces resource failed ratio, solves CDN dilatations and capacity reducing mistake Original CDN resources access the problem of a large amount of failures in journey.
In another embodiment, server includes physical server and virtual server, and server group 172 includes at least two Platform physical server, each physical server correspond to the virtual server of predetermined number,
CDN resource allocation devices 171, for when virtual server corresponding to first server identification found, Physical server corresponding to inquiring about virtual server, determine that physical server is used to deposit money to be allocated corresponding to resource identification Source.
In the present embodiment, in order to improve the uniformity of resource distribution on each server in server group, introduce virtual Server.It is mapped to by increasing multiple virtual servers in annular region so that each physical server over an annular region The probability for being assigned to resource is more balanced.
Figure 18 is the block diagram of the CDN system shown in another embodiment of the present invention, as shown in figure 18, in another embodiment, First server group includes first server 1721, and system also includes:CDN Resource orientations device 173,
CDN Resource orientations device 173, for according to the resource request extraction first resource mark received;According to default Hash algorithm identifies to first resource and carries out mapping calculation, obtains first resource mapping value;First is found from annular region After resource impact value, inquired about over an annular region by preset direction, obtain first server mappings value and reflected for first server Penetrate value;Resource request is sent to first server 1721 corresponding to first server mapping value, it is defeated by first server 1721 Go out resource corresponding to resource request;
First server 1721, export resource corresponding to resource request.
In the present embodiment, when receiving resource request, according to resource identification therein, search after Hash mapping with Server mappings value corresponding to resource impact value, so that it is determined that storing the server of the resource.So, positioned by the above method Resource, the server for storing the resource can be more rapidly and accurately found, service is increased or decreased in addition, working as in server group During device, can also get the resource to be asked by other servers, improve the success rate for obtaining resource, Consumer's Experience compared with It is good.
Figure 19 is the block diagram of the CDN system shown in another embodiment of the present invention, and as shown in figure 19, first server group is also wrapped Second server 1722 is included, system also includes at least one second server group 174 positioned at first server group last layer, often Individual second server group 174 includes at least two-server,
Second server group 174, all resources included for storage content distributing network system;
CDN Resource orientations device 173, for when first server 1721 fails, over an annular region by preset direction Inquiry, it is second server mapping value to obtain second server mappings value;
When it is determined that second server 1722 is effective corresponding to second server mapping value, resource request is sent to second Server 1722, exported after the resource as corresponding to the upward primary server group of second server 1722 obtains resource request;
Second server 1722, for being exported after obtaining resource corresponding to resource request to second server group 174.
In the present embodiment, when dilatation in server group or capacity reducing, or during server fail, a certain clothes may be caused Be engaged in device failure, i.e., the former resource location deposited on that server frees change, therefore, it is necessary to by other servers again from Upper level server obtains the resource.So, the success rate for obtaining resource, better user experience are improved.
Each embodiment is described by the way of progressive in this specification, what each embodiment stressed be and its The difference of its embodiment, same or analogous part cross-reference between each embodiment.For system embodiment For, because it is substantially corresponding with embodiment of the method, so description is fairly simple, referring to the portion of embodiment of the method in place of correlation Defend oneself bright.
The method and system of the present invention may be achieved in many ways.For example, can by software, hardware, firmware or Software, hardware, firmware any combinations come realize the present invention method and system.The said sequence of the step of for methods described Order described in detail above is not limited to merely to illustrate, the step of method of the invention, it is special unless otherwise Do not mentionlet alone bright.In addition, in certain embodiments, the present invention can be also embodied as recording program in the recording medium, these programs Including the machine readable instructions for realizing the method according to the invention.Thus, the present invention also covering storage is used to perform basis The recording medium of the program of the method for the present invention.
Description of the invention provides for the sake of example and description, and is not exhaustively or by the present invention It is limited to disclosed form.Many modifications and variations are obvious for the ordinary skill in the art.Select and retouch State embodiment and be to more preferably illustrate the principle and practical application of the present invention, and one of ordinary skill in the art is managed The present invention is solved so as to design the various embodiments with various modifications suitable for special-purpose.

Claims (19)

1. a kind of CDN resource allocation methods, it is characterised in that methods described includes:
Obtain the resource identification of resource to be allocated and the server identification of each server in server group;
The resource identification and the server identification are mapped in annular region according to default hash algorithm;
Inquired about according to the resource identification in the annular region by preset direction, it is determined that first found services Server corresponding to device mark is used to deposit resource to be allocated corresponding to the resource identification, and the preset direction is side clockwise To or counterclockwise;
By the resource allocation to be allocated to the corresponding server.
2. according to the method for claim 1, it is characterised in that methods described also includes:
When being virtual server corresponding to first server identification found, thing corresponding to the virtual server is inquired about Server is managed, determines that the physical server is used to deposit resource to be allocated corresponding to the resource identification.
3. according to the method for claim 2, it is characterised in that the basis preset hash algorithm by the resource identification and The server identification is mapped in annular region, including:
Mapping calculation is carried out to the resource identification and virtual server mark according to default hash algorithm, obtains the money Virtual server mapping value corresponding to resource impact value corresponding to the mark of source and virtual server mark;
The virtual server mapping value is arranged according to preset order, obtains virtual server mapping value list, it is described Preset order is order from small to large or from big to small;
Inquired about according to the resource identification in the annular region by preset direction, it is determined that first found services Server corresponding to device mark is used to deposit resource to be allocated corresponding to the resource identification, including:
Meet the first of preparatory condition according to first in the first resource mapping value inquiry virtual server mapping value list Virtual server mapping value, the preparatory condition are more than or less than the first resource mapping value;
Determine the first virtual server corresponding to the first virtual server mapping value, and first virtual server pair The first physical server answered, first physical server are used to deposit resource to be allocated corresponding to the resource identification.
4. according to the method for claim 3, it is characterised in that when a newly-increased at least physical services in the server group During device, methods described also includes:
Obtain the newly-increased virtual server mark of virtual server corresponding to newly-increased physical server;
The basis presets hash algorithm and the resource identification and the server identification is mapped in annular region, also wraps Include:
Mapping calculation is carried out to the newly-increased virtual server mark according to default hash algorithm, obtains the newly-increased Virtual Service Virtual server mapping value is increased newly corresponding to device mark;
The newly-increased virtual server mapping value is added in the server mappings value list, and by the server mappings Servers-all mapping value in value list rearranges according to the preset order;
And/or
When an at least physical server failure in the server group, methods described also includes:
Obtain the failure virtual server mark of virtual server corresponding to the physical server of failure;
The basis presets hash algorithm and the resource identification and the server identification is mapped in annular region, also wraps Include:
Mapping calculation is carried out to the failure virtual server mark according to default hash algorithm, obtains the failure Virtual Service Failure virtual server mapping value corresponding to device mark;
The failure virtual server mapping value is deleted from the server mappings value list, and by the virtual server Servers-all mapping value in mapping value list rearranges according to the preset order.
5. according to the method for claim 1, it is characterised in that methods described also includes:
Obtain the disk size of each physical server;
The number of virtual server according to corresponding to the disk size determines each physical server.
6. according to the method any one of claim 3-5, it is characterised in that
Methods described also includes:
It is described virtual according to physical server numbering generation corresponding to the numbering of the virtual server and the virtual server Server identification;
The virtual server mark includes:First preset characters string, by the physical server numbering preset value is taken The numbering of the remainder values, the second preset characters string and the virtual server that are obtained after modular arithmetic;
And/or
The length of the resource identification is at least 20 bytes;
And/or
The length of the virtual server mark is at least 20 bytes.
7. a kind of CDN resource location methods, it is characterised in that methods described includes:
Resource identification is extracted according to the resource request received;
Mapping calculation is carried out to the resource identification according to default hash algorithm, obtains resource impact value;
After the resource impact value is found from annular region, inquired about by preset direction, obtain first server mappings value For first server mapping value, the annular region includes the default hash algorithm of basis by the resource identification and the server The mapping result that is mapped of server identification, the preset direction is clockwise or counterclockwise;
The resource request is sent to first server corresponding to the first server mapping value, by the first server Export resource corresponding to the resource request.
8. according to the method for claim 7, it is characterised in that
When the first server fails, methods described also includes:
The preset direction inquiry, obtains second server mappings value and is mapped for second server in the annular region Value;
When it is determined that second server corresponding to the second server mapping value is effective, the resource request is sent to described Second server, carry out after the resource as corresponding to the upward primary server group of the second server obtains the resource request defeated Go out;
And/or
When being virtual server corresponding to the first server mapping value, methods described also includes:
The first physical server corresponding to the first server mapping value is inquired about, as described in first physical server output Resource corresponding to resource request;
The resource request is sent to first physical server.
9. a kind of CDN resource allocation devices, it is characterised in that described device includes:
First acquisition module, for obtaining the resource identification of resource to be allocated and the server mark of each server in server group Know;
Mapping block, for the resource identification and the server identification to be mapped into annular region according to default hash algorithm On;
Enquiry module, for being inquired about according to the resource identification in the annular region by preset direction, it is determined that searching To first server identification corresponding to server be used to deposit resource to be allocated corresponding to the resource identification, it is described default Direction is clockwise or counterclockwise;
Distribute module, for by the resource allocation to be allocated to corresponding to the server.
10. device according to claim 9, it is characterised in that the enquiry module, for when first clothes found Be engaged in corresponding to device mark when being virtual server, inquire about the virtual server corresponding to physical server, determine the physics Server is used to deposit resource to be allocated corresponding to the resource identification.
11. device according to claim 10, it is characterised in that the mapping block includes:
Calculating sub module, for being mapped according to default hash algorithm the resource identification and virtual server mark Calculate, obtain virtual server mapping corresponding to resource impact value corresponding to the resource identification and virtual server mark Value;
Submodule is arranged, for the virtual server mapping value to be arranged according to preset order, obtains virtual server Value list is mapped, the preset order is order from small to large or from big to small;
The enquiry module includes:
Submodule is inquired about, for meeting according to first in the first resource mapping value inquiry virtual server mapping value list First virtual server mapping value of preparatory condition, the preparatory condition are more than or less than the first resource mapping value;
Determination sub-module, for determining the first virtual server corresponding to the first virtual server mapping value, and it is described First physical server corresponding to first virtual server, first physical server are corresponding for depositing the resource identification Resource to be allocated.
12. device according to claim 11, it is characterised in that
First acquisition module, for obtaining the newly-increased virtual server of virtual server corresponding to newly-increased physical server Mark;
The calculating sub module of the mapping block, be additionally operable to according to default hash algorithm the newly-increased virtual server is identified into Row mapping calculation, obtain increasing virtual server mapping value newly corresponding to the newly-increased virtual server mark;
The arrangement submodule of the mapping block, it is additionally operable to the newly-increased virtual server mapping value being added to the server Map value list in, and by the Servers-all mapping value in the server mappings value list according to the preset order again Arrangement;
And/or
First acquisition module, for when an at least physical server failure in the server group, obtaining failure The failure virtual server mark of virtual server corresponding to physical server;
The calculating sub module of the mapping block, be additionally operable to identify the failure virtual server according to default hash algorithm into Row mapping calculation, obtain failure virtual server mapping value corresponding to the failure virtual server mark;
The arrangement submodule of the mapping block, it is additionally operable to the failure virtual server mapping value from the server mappings Deleted in value list, and by the Servers-all mapping value in the server mappings value list according to the preset order again Arrangement.
13. device according to claim 9, it is characterised in that described device also includes:
Second acquisition module, for obtaining the disk size of each physical server;
Determining module, the number for virtual server corresponding to determining each physical server according to the disk size.
14. according to the device any one of claim 11-13, it is characterised in that described device also includes:
Generation module, numbered for physical server corresponding to the numbering according to the virtual server and the virtual server Generate the virtual server mark;
The virtual server mark includes:First preset characters string, by the physical server numbering preset value is taken The numbering of the remainder values, the second preset characters string and the virtual server that are obtained after modular arithmetic;
And/or
The length of the resource identification is at least 20 bytes;
And/or
The length of the virtual server mark is at least 20 bytes.
15. a kind of CDN Resource orientations device, it is characterised in that described device includes:
Extraction module, for extracting resource identification according to the resource request received;
Mapping calculation module, for carrying out mapping calculation to the resource identification according to default hash algorithm, obtain resource impact Value;
Enquiry module, after the resource impact value is found from annular region, inquired about by preset direction, obtain first Server mappings value is first server mapping value, and the annular region includes the default hash algorithm of basis by the resource identification And the mapping result that the server identification of the server is mapped, the preset direction are clockwise or square counterclockwise To;
Sending module, for the resource request to be sent into first server corresponding to the first server mapping value, by The first server exports resource corresponding to the resource request.
16. device according to claim 15, it is characterised in that
The enquiry module, the preset direction inquiry in the annular region is additionally operable to, obtains second server mappings It is worth for second server mapping value;
The sending module, it is additionally operable to when it is determined that second server corresponding to the second server mapping value is effective, by institute State resource request and be sent to the second server, obtaining the resource by the upward primary server group of the second server please Exported after resource corresponding to asking;
And/or the enquiry module, it is additionally operable to when being virtual server corresponding to the first server mapping value, inquiry First physical server corresponding to the first server mapping value, the resource request is exported by first physical server Corresponding resource;
The sending module, it is additionally operable to the resource request being sent to first physical server.
17. a kind of CDN system, it is characterised in that the system includes:CDN resource allocation devices and at least one first service Device group, each first server group include at least two-server,
The CDN resource allocation devices, for obtain resource to be allocated resource identification and the server group in each service The server identification of device;The resource identification and the server identification are mapped to by annular region according to default hash algorithm On;Inquired about according to the resource identification in the annular region by preset direction, it is determined that first found services Server corresponding to device mark is used to deposit resource to be allocated corresponding to the resource identification, and the preset direction is side clockwise To or counterclockwise;By the resource allocation to be allocated to the corresponding server;
The server, for depositing the resource to be allocated according to the distribution of the CDN resource allocation devices.
18. system according to claim 17, it is characterised in that the server includes physical server and Virtual Service Device, the server group correspond to the virtual server of predetermined number including at least two physical servers, each physical server,
The CDN resource allocation devices, for when virtual server corresponding to first server identification found, inquiry Physical server corresponding to the virtual server, determine that the physical server is used to deposit to treat corresponding to the resource identification Distribute resource.
19. the system according to claim 17 or 18, it is characterised in that the first server group includes first service Device, the system also include:CDN Resource orientation devices,
The CDN Resource orientations device, for according to the resource request extraction first resource mark received;According to described default Hash algorithm identifies to the first resource and carries out mapping calculation, obtains first resource mapping value;Found from annular region After the first resource mapping value, inquired about in the annular region by preset direction, obtaining first server mappings value is First server mapping value;The resource request is sent to first server corresponding to the first server mapping value, by The first server exports resource corresponding to the resource request;
The first server, export resource corresponding to the resource request;
And/or
The first server group also includes second server, and the system also includes being located at the first server group last layer At least one second server group, each second server group includes at least two-server,
The second server group, all resources included for storing the content distribution network system;
The CDN Resource orientations device, for when the first server fails, over an annular region by the preset direction Inquiry, it is second server mapping value to obtain second server mappings value;
When it is determined that second server corresponding to the second server mapping value is effective, the resource request is sent to described Second server, carry out after the resource as corresponding to the upward primary server group of the second server obtains the resource request defeated Go out;
The second server, it is defeated for being carried out after obtaining resource corresponding to the resource request to the second server group Go out.
CN201711009988.8A 2017-10-25 2017-10-25 A kind of CDN resource allocations, localization method and device and CDN system Pending CN107749887A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711009988.8A CN107749887A (en) 2017-10-25 2017-10-25 A kind of CDN resource allocations, localization method and device and CDN system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711009988.8A CN107749887A (en) 2017-10-25 2017-10-25 A kind of CDN resource allocations, localization method and device and CDN system

Publications (1)

Publication Number Publication Date
CN107749887A true CN107749887A (en) 2018-03-02

Family

ID=61253219

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711009988.8A Pending CN107749887A (en) 2017-10-25 2017-10-25 A kind of CDN resource allocations, localization method and device and CDN system

Country Status (1)

Country Link
CN (1) CN107749887A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108769111A (en) * 2018-04-17 2018-11-06 平安科技(深圳)有限公司 A kind of server connection method, computer readable storage medium and terminal device
CN109101195A (en) * 2018-08-07 2018-12-28 郑州云海信息技术有限公司 A kind of method, apparatus and readable storage medium storing program for executing of the read-write of memcached company-data
CN109787862A (en) * 2019-01-17 2019-05-21 无锡华云数据技术服务有限公司 Detection method, device, electronic equipment and the storage medium of invalid resource
CN109981782A (en) * 2019-03-28 2019-07-05 山东浪潮云信息技术有限公司 Remote storage abnormality eliminating method and system for cluster fissure
CN110363469A (en) * 2019-06-18 2019-10-22 北京你财富计算机科技有限公司 The method, apparatus and electronic equipment that movable product is filled automatically in a kind of distribution platform
CN110457128A (en) * 2019-07-11 2019-11-15 阿里巴巴集团控股有限公司 Method for allocating tasks, device and system
CN111756789A (en) * 2019-12-30 2020-10-09 广州极飞科技有限公司 Request information distribution method and device, storage medium and electronic equipment

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108769111A (en) * 2018-04-17 2018-11-06 平安科技(深圳)有限公司 A kind of server connection method, computer readable storage medium and terminal device
CN109101195A (en) * 2018-08-07 2018-12-28 郑州云海信息技术有限公司 A kind of method, apparatus and readable storage medium storing program for executing of the read-write of memcached company-data
CN109787862A (en) * 2019-01-17 2019-05-21 无锡华云数据技术服务有限公司 Detection method, device, electronic equipment and the storage medium of invalid resource
CN109787862B (en) * 2019-01-17 2019-09-13 无锡华云数据技术服务有限公司 Detection method, device, electronic equipment and the storage medium of invalid resource
CN109981782A (en) * 2019-03-28 2019-07-05 山东浪潮云信息技术有限公司 Remote storage abnormality eliminating method and system for cluster fissure
CN109981782B (en) * 2019-03-28 2022-03-22 浪潮云信息技术股份公司 Remote storage exception handling method and system for cluster split brain
CN110363469A (en) * 2019-06-18 2019-10-22 北京你财富计算机科技有限公司 The method, apparatus and electronic equipment that movable product is filled automatically in a kind of distribution platform
CN110457128A (en) * 2019-07-11 2019-11-15 阿里巴巴集团控股有限公司 Method for allocating tasks, device and system
CN110457128B (en) * 2019-07-11 2023-12-22 创新先进技术有限公司 Task allocation method, device and system
CN111756789A (en) * 2019-12-30 2020-10-09 广州极飞科技有限公司 Request information distribution method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN107749887A (en) A kind of CDN resource allocations, localization method and device and CDN system
CN106899680B (en) The fragment treating method and apparatus of multi-tiling chain
Zhang et al. Proactive workload management in hybrid cloud computing
KR101383905B1 (en) method and apparatus for processing server load balancing with the result of hash function
US20130182713A1 (en) State management using a large hash table
US11778068B2 (en) Systems and methods for processing requests for content of a content distribution network
CN106031130A (en) Content delivery network architecture with edge proxy
CN102710419B (en) User authentication method and device
US10530845B1 (en) Shuffle sharded load balancing
CN102882973A (en) Distributed load balancing system and distributed load balancing method based on peer to peer (P2P) technology
CN104834722A (en) CDN (Content Delivery Network)-based content management system
CN107846454A (en) A kind of resource regulating method, device and CDN system
CN108933829A (en) A kind of load-balancing method and device
US11516116B2 (en) Domain name system multipathing distributed applications
CN112100185B (en) Indexing system and method for block chain data balance load
US9106482B1 (en) Systems and methods for proxy-less load balancing
CN105872082B (en) Fine granularity resource response system based on container cluster load-balancing algorithm
JP2024506818A (en) Cache indexing using fingerprint-based data addresses
US20130185378A1 (en) Cached hash table for networking
CN108399099A (en) File security stores and content protecting method
US11019139B2 (en) Ranked session affinity to improve load balancing efficiency for stateful requests
Gao et al. Compact, popularity-aware and adaptive hybrid data placement schemes for heterogeneous cloud storage
US10481963B1 (en) Load-balancing for achieving transaction fault tolerance
US11310309B1 (en) Arc jump: per-key selection of an alternative server when implemented bounded loads
US11652746B1 (en) Resilient consistent hashing for a distributed cache

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