The content of the invention
In order to overcome above-mentioned deficiency of the prior art, the present invention provides a kind of distributed caching method and device, to solveCertainly above mentioned problem.
To achieve these goals, the technical scheme that present pre-ferred embodiments are provided is as follows:
Present pre-ferred embodiments provide a kind of distributed caching method, applied to the service being connected with router communicationDevice, the router includes the first memory for buffer network resource, and the server storage has at least one target to provideSource, methods described includes:
Obtain the real-time network speed and hardware parameter of each router;
Router of the real-time network speed less than threshold value is chosen from all-router as CDN (ContentDelivery Network, content distributing network) cache node;
The data cached of target resource is sent to the CDN cache nodes, so that other electronic equipments can be from the CDNCache node obtains the data cached of the target resource.
In the preferred embodiment, the positional information and CDN that above-mentioned server record has each CDN cache nodes are changedThe identification information of the target resource cached in node;Methods described also includes:
The server receives the acquisition request that electronic equipment is sent for the target resource, wherein, the acquisition pleaseAsk the positional information including the electronic equipment and the identification information of target resource;
According to the identification information of the target resource, choose nearest from the electronic equipment from the CDN cache nodesAt least one CDN cache node as target CDN cache nodes notify the electronic equipment, make the electronic equipment from describedTarget CDN cache nodes obtain the data cached of the target resource.
In the preferred embodiment, above-mentioned server storage has the corresponding user account of CDN cache nodes, describedMethod also includes:
The server obtains the flow information when CDN cache nodes provide data cached for the electronic equipment,Corresponding fund transfer operation is performed to the corresponding account of the CDN cache nodes according to the flow information.
In the preferred embodiment, the above method also includes:
The server obtains the Internet resources that the router is transmitted in the first preset duration in advance;
According to transmission duration, the number of transmissions of the disparate networks resource in first preset duration, obtain all kinds of describedThe transmission proportion of Internet resources;
The maximum at least one Internet resources of transmission proportion are chosen from all kinds of Internet resources as target resource simultaneouslyGenerate transmission log.
In the preferred embodiment, the above method also includes:
The server obtains click volume of the disparate networks resource in the second preset duration in advance, to be used as transfer ratioWeight;
The maximum at least one Internet resources of transmission proportion are chosen from all kinds of Internet resources as target resource simultaneouslyGenerate transmission log.
In the preferred embodiment, the above method also includes:
According to the significance level of the target resource, data cached in each CDN cache nodes is updated, wherein instituteSignificance level is stated to close with the transfer ratio heavy phase.
In the preferred embodiment, the above method also includes:
The hardware parameter also includes the remaining memory capacity of router, described to send target to the CDN cache nodesThe data cached capacity of resource is less than the remaining memory capacity.
Presently preferred embodiments of the present invention also provides a kind of distributed caching method, applied to the route with server communicationDevice, the router includes first memory, and methods described includes:
Real-time network speed and hardware parameter are sent to server, so that the server is joined according to the real-time network speed and hardwareNumber issues target resource;
The target resource that the server is sent is received, so that other electronic equipments can obtain target from the routerResource it is data cached.
Presently preferred embodiments of the present invention also provides a kind of distributed caching device, applied to the route with server communicationDevice, the router includes distributed caching device, and described device includes:
Information sending module, for sending real-time network speed and hardware parameter to the server, so that the server rootTarget resource is issued according to the real-time network speed and hardware parameter;
Data reception module, for receiving the target resource that the server is sent, so that other electronic equipments can be fromThe router obtains the data cached of target resource.
Presently preferred embodiments of the present invention also provides a kind of distributed caching device, applied to the service with router communicationDevice, the router includes the first memory for buffer network resource, and the server storage has at least one target to provideSource, described device includes:
Data obtaining module, real-time network speed and hardware parameter for obtaining each router, wherein, the hardware parameterIdentity information including each router;
Selecting module, for choosing the real-time network speed from all-router less than threshold value according to the identity informationRouter is used as CDN cache nodes;
Data transmission blocks, for sending the data cached of target resource to the CDN cache nodes, so that other electronicsEquipment can obtain the data cached of the target resource from the CDN cache nodes.
In terms of existing technologies, the distributed caching method and device that the present invention is provided at least have following beneficial effectReally:Methods described, with the caching of target resource on the router for be provided with first memory, is entered by making full use of idle bandwidthAnd alleviate network node pressure, improve the speed that user obtains target resource.Specifically, methods described obtains each by serverThe real-time network speed and hardware parameter of individual router;The router that the real-time network speed is chosen from all-router less than threshold value is madeFor CDN cache nodes;The data cached of target resource is sent to the CDN cache nodes, so that other electronic equipments can be fromThe CDN cache nodes obtain the data cached of the target resource.
To enable the above objects, features and advantages of the present invention to become apparent, present pre-ferred embodiments cited below particularly,And coordinate appended accompanying drawing, it is described in detail below.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, completeSite preparation is described.Obviously, described embodiment is only a part of embodiment of the present invention, rather than whole embodiments.It is logicalThe component for the embodiment of the present invention being often described and illustrated herein in the accompanying drawings can be arranged and designed with a variety of configurations.
Therefore, the detailed description of embodiments of the invention below to providing in the accompanying drawings is not intended to limit claimedThe scope of the present invention, but be merely representative of the present invention selected embodiment.Based on embodiments of the invention, people in the artThe every other embodiment that member is obtained on the premise of creative work is not made, belongs to the scope of protection of the invention.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang YiIt is defined in individual accompanying drawing, then it further need not be defined and explained in subsequent accompanying drawing.
Below in conjunction with the accompanying drawings, some embodiments of the present invention are elaborated.It is following in the case where not conflictingFeature in embodiment and embodiment can be mutually combined.
Fig. 1 is refer to, is server 200, router 100 and electronic equipment 400 that present pre-ferred embodiments are providedInteraction schematic diagram.In the present embodiment, the server 200, router 100 and the formation interactive system of electronic equipment 400,The server 200 is communicated to connect with least one router 100 by network 300, the router 100 and electronic equipment400 communication connections.Wherein, the server 200 is used to choose under user from the historic transmission record of the router 100 of userThe secondary Internet resources that may be obtained, and using the Internet resources as the target resource pushed to electronic equipment 400, so that routeDevice 100 caches the data cached of the target resource.User can obtain the router by electronic equipment 400 from router 100100 target resources cached it is data cached, to reduce the pressure of backbone network node, and then accelerate to obtain target resourceSpeed.
Further, the Internet resources may be, but not limited to, video, audio and webpage etc., it will be appreciated that ground, describedTarget resource is the Internet resources that user needs to obtain.The electronic equipment 400 may be, but not limited to, intelligent television, intelligenceMobile phone, PC (Personal Computer, PC), tablet personal computer, personal digital assistant (personal digitalAssistant, PDA), mobile internet surfing equipment (mobile Internet device, MID) etc., be not especially limited here.
It refer to the block diagram for the router 100 that Fig. 2 provides for present pre-ferred embodiments.The preferable reality of the present inventionApply example and a kind of router 100 is also provided, the router 100 can include first processor 110, the first communication unit 120, theOne memory 130 and the first distributed caching device 510.The first processor 110, the first communication unit 120 andDirectly or indirectly it is electrically connected between one memory 130 each element, to realize the transmission or interaction of data.For example, theseElement can be realized by one or more communication bus or signal wire be electrically connected with each other.The first distributed caching dressPutting 510 can be stored in first memory 130, and the first distributed caching device 510 is called by first processor 110,The speed for obtaining resource can be lifted.
The first memory 130 may be, but not limited to, random access memory (Random Access Memory,RAM), read-only storage (Read Only Memory, ROM), programmable read only memory (Programmable Read-OnlyMemory, PROM), Erasable Programmable Read Only Memory EPROM (Erasable Programmable Read-Only Memory,EPROM), Electrically Erasable Read Only Memory (Electric Erasable Programmable Read-OnlyMemory, EEPROM) etc..In the present embodiment, the first memory 130 can be used for the identity letter for storing router 100The target resource that breath, positional information and server 200 are sent it is data cached etc., user can be made to pass through electronic equipment 400The data cached of target resource is obtained from the router 100.Certainly, the memory can be also used for storage program, describedOne processor 110 performs the program after execute instruction is received.
The first processor 110 can be central processing unit (Central Processing Unit, CPU), at networkManage device (Network Processor, NP) etc.;Can also be digital signal processor (DSP), application specific integrated circuit (ASIC),It is field programmable gate array (FPGA) or other PLDs, discrete gate or transistor logic, discrete hardPart component, it is possible to achieve or disclosed each method, step and logic diagram in the execution embodiment of the present invention.
First communication unit is used for the communication connection that the first mobile terminal and server 200 are set up by network 300,And pass through the transceiving data of network 300.Such as, the first communication unit can be used for the Real-time Network for uploading the router 100Acquisition request of acquisition target resource that speed, upstream bandwidth, hardware parameter, user send etc..Wherein, the network 300 can be withIt is, but is not limited to cable network, wireless network, is not especially limited here.
Fig. 3 is refer to, the block diagram of the server 200 provided for present pre-ferred embodiments.In the present embodiment,The server 200 can include second processor 210, the second communication unit 220, second memory 230 and and secondDistributed caching device 520.The second processor 210, the second communication unit 220 and second memory 230 each elementBetween be directly or indirectly electrically connected with, to realize the transmission or interaction of data.For example, these elements can pass through one each otherBar or a plurality of communication bus or signal wire, which are realized, to be electrically connected with.The second distributed caching device 520 can be stored in secondIn memory 230, the second distributed caching device 520 is called by second processor 210, the speed for obtaining resource can be liftedDegree.
Specifically, each component can each component corresponding with router 100 be identical or class in the server 200Seemingly, such as, the second processor 210 can be above-mentioned central processing unit.For the specific kind of each component of server 200Class, is no longer illustrated one by one here.
In the present embodiment, the server 200 may be, but not limited to, Cloud Server, distributed server, cluster clothesBusiness device etc., is not especially limited herein.
It is understood that the structure shown in Fig. 2 and Fig. 3 is only a kind of structural representation, the shown He of router 100Server 200 can also include than more or less components shown in figure.Each component shown in figure can be using hardware, softPart or its combination are realized.
First embodiment:
Fig. 4 is refer to, one of schematic flow sheet of distributed caching method provided for present pre-ferred embodiments.This realityThe distributed caching method for applying example offer can apply to interactive system shown in Fig. 1.Server 200 in the interactive systemIt is previously stored with least one above-mentioned target resource.
The idiographic flow and step of the distributed caching method shown in Fig. 4 are described in detail below.In this implementationIn example, the distributed caching method may comprise steps of:
Step S610, obtains the real-time network speed and hardware parameter of each router 100.
In the present embodiment, methods described can also include determining that target is provided by server 200 before step S610The step of source.For example, the server 200 obtains the network money that the router 100 is transmitted in the first preset duration in advanceSource;According to transmission duration, the number of transmissions of the disparate networks resource in first preset duration, all kinds of network moneys are obtainedThe transmission proportion in source;The maximum at least one Internet resources of transmission proportion are chosen from all kinds of Internet resources to provide as targetSource simultaneously generates transmission log.
Understandably, first preset duration can be configured as the case may be, be not especially limited here.InstituteIdentity information, positional information of router 100 etc. can be included by stating hardware parameter.The transmission proportion can be regarded as Internet resourcesBurning hot degree.Such as, the Internet resources are web page news, if propagation amount (ratio of the Internet news in the first preset durationSuch as reprint quantity, click volume) it is bigger, corresponding transmission proportion is bigger.
In the present embodiment, the server 200 can obtain disparate networks resource in advance in the second preset durationClick volume, to be used as push proportion;Then chosen from all kinds of Internet resources and push the maximum at least one network of proportionResource is as target resource and generates transmission log.
Step S620, chooses router 100 of the real-time network speed less than threshold value as CDN from all-router 100Cache node.
In the present embodiment, the CDN cache nodes are used for the data cached of caching of target resource.Server 200 can be withSelection of the real-time network speed less than the router 100 of threshold value is realized by the identity information of router 100.When the router 100During as CDN cache nodes, the router 100 just can be used for other users, realize resource-sharing.Wherein, the threshold valueIt can as the case may be configured, be not especially limited here.
Step S630, sends the data cached of target resource, so that other electronic equipments 400 to the CDN cache nodesThe data cached of the target resource can be obtained from the CDN cache nodes.
In the present embodiment, the data cached capacity that target resource is sent to the CDN cache nodes is slow less than the CDNDeposit the remaining memory capacity of node.
Specifically, such as described electronic equipment 400 is intelligent television, and the intelligent television is connected with router 100.Work as userNeed to see that server 200 can be obtained before user's viewing program by internet when watching program by the intelligent televisionWhen the click volume of interior various types of programs for the previous period, and one or several programs of the amount of will click on highest are cached as target resourceOn one or more CDN cache nodes.It is corresponding with user when the program that user sees program corresponding for the target resourceRouter 100 just from be cached with the program CDN cache nodes obtain target resource.That is, user is reduced in viewing programWhen the network bandwidth, and then improve the transmission speed of target resource.
Further, in the present embodiment, the server 200 records the positional information and CDN for having each CDN cache nodesChange the identification information of the target resource cached in node;Methods described can also include step S640 and step S650.
In the present embodiment, methods described can also include the significance level according to the target resource, and each CDN is cachedData cached in node is updated.Wherein described significance level is closed with the transfer ratio heavy phase.
Specifically, router 100 is original data cached by deleting, and loads newly data cached, can follow up in timeThe target resource obtained required for user.It is wherein, new that data cached to can be understood as significance level in target resource maximumOne or more target resources.And server 200 can make the newest of the required acquisition of the advance cache user of CDN cache nodesTarget resource.When user obtains target resource, it directly can cache section from CDN and obtain buffered target resource, and thenThe network bandwidth of the user when obtaining target resource is reduced, lifting obtains the speed of Internet resources.
Step S640, the server 200 receives the acquisition request that electronic equipment 400 is sent for the target resource,Wherein, it is described to obtain the identification information that request includes the positional information and target resource of the electronic equipment 400.
In the present embodiment, when user obtains target resource by electronic equipment 400, electronic equipment 400 will be according to userThe target resource of required acquisition sends to router 100 and obtains request, and then router 100 again sends acquisition request extremelyServer 200.When router 100 sends acquisition request, can in request is obtained addition router 100 identity of itselfInformation.And the identification information can be regarded as the category flag of target resource.
Step S650, according to the identification information of the target resource, chooses from the electronics from the CDN cache nodesAt least one nearest CDN cache node of equipment 400 notifies the electronic equipment 400 as target CDN cache nodes, makes describedElectronic equipment 400 obtains the data cached of the target resource from the target CDN cache nodes.
In the present embodiment, electronics can be shortened by choosing target CDN cache nodes using the selection mode in step S650Equipment 400 obtains the path of target resource, and then improves the speed for obtaining target resource.Specifically, server 200 is prestoredHave the positional information of electronic equipment 400, then chosen from the CDN cache nodes it is nearest from the electronic equipment 400 toA few CDN cache node is used as target CDN cache nodes.Electronic equipment 400 is obtained from target CDN cache nodes and cachedTarget resource it is data cached.
Specifically, such as, it is slower when detecting download speed when user is by 400 foradownloaded video program of electronic equipment, clothesBusiness device 200 can regard the video frequency program as target resource.Meanwhile, server 200 gathers the hard of the router 100 of other usersThe data such as part parameter, upstream bandwidth, real-time network speed, positional information, the hardware parameter can include the surplus of first memory 130Remaining memory capacity.If the router 100 of other users meets bandwidth and is in idle state (such as, real-time network speed is less than threshold value),Remaining memory capacity enough, and away from the condition such as the user is nearer, then can choose one from the router 100 for meeting above-mentioned conditionIt is individual or multiple as target CDN cache nodes, and the router 100 of user is notified, so that router 100 connects selected meshMark CDN cache nodes.
The target CDN cache nodes can according to upstream bandwidth to acceleration in need Internet resources (i.e. target resource)Stored, to ensure, the resource in need preferentially accelerated, which can be evenly distributed, stores and transmit.When user is obtaining resourceWhen, just it can get corresponding resource from the target CDN cache nodes for the target resource that is stored with.The target CDN cache nodesThe video frequency program can be handled by the way of burst storage, transmission.The router 100 of user is saved by being cached from target CDNPoint obtains the data cached of the video frequency program.That is, by increasing number of network node, and then the transmission speed of Internet resources is improvedDegree.
In the present embodiment, the server 200 can be stored with the corresponding user account of CDN cache nodes, the sideMethod can also include:The server 200 obtain the CDN cache nodes for the electronic equipment 400 provide data cached whenFlow information, corresponding fund transfer operation is performed to the corresponding account of the CDN cache nodes according to the flow information.Wherein, the fund can be regarded as ideal money, described when user obtains data cached from the router 100 of other usersIdeal money can be used for paying the expense for obtaining data cached produced flow for user.
Specifically, if for example, user needs to obtain target resource from the router 100 of other users, user is needed to itHis user pays certain ideal money and could used.Specific charge method, such as, and the target money that can be obtained according to userThe data cached flow in source is charged.Certainly, if other users need to use the router 100 of the user to obtain network moneyDuring source, the data cached flow that the user can also be according to acquired in other users is charged, i.e., the user account is filledIt is worth ideal money, corresponding ideal money is reduced to corresponding other users account.
In addition, user can be by being previously provided with the electronic equipment 400 of control module, the shared money of control router 100Source module is turned on and off.Understandably, such as, the electronic equipment 400 is smart mobile phone, and the smart mobile phone is pre-setThere is the application program matched with the router 100.User can be sent to router 100 by the application program and be closed or be beatenOpen the control command of sharing functionality.Such as, router 100 closes sharing functionality so that other users can not make according to control commandWith the router 100.
Certainly, in order that more users participate in sharing functionality, after user's registration, (such as, Internet resources are provided for manufacturerBusiness) ideal money (such as, red packet) can be sent to the corresponding account of user.When the user opens sharing function, manufacturerIdeal money can be sent to user account, wherein, the traffic volume of the ideal money can be according to other users from the user'sData cached flow acquired in router 100 is provided, such as more by the shared flow of router 100, manufacturerThe ideal money amount for issuing the user account is more.
If Internet resources are when larger distance is transmitted, such as transprovincial transmission.Traditional CDN of the prior art andCloud CDN needs the server 200 that established mirror image in the province where user, and this will add the cost of network resource provider.AndThe method that the present embodiment is provided is left unused bandwidth by using each router 100, and each router 100 is similar to miniature dataCenter, when user wants transprovincial acquisition target resource, directly can be obtained from the router 100 for meeting above-mentioned condition,The method that i.e. the present embodiment is provided reduces the cost of network resource provider.
Second embodiment:
Fig. 6 is refer to, the three of the schematic flow sheet of the distributed caching method provided for present pre-ferred embodiments.At thisIn implementation, methods described can be used for the router 100 with being communicated in above-described embodiment with server 200, the router 100Include first memory 130, methods described can include:
Step S710, sends real-time network speed and hardware parameter to server 200, so that the server 200 is according to describedReal-time network speed and hardware parameter issue target resource.
Step S720, receives the target resource that the server 200 is sent, so that other electronic equipments 400 can be from instituteState router 100 and obtain the data cached of target resource.
In the present embodiment, the router 100 stores target resource by router 100, so that user is from being cached withThe router 100 of target resource obtains target resource, and then reduces the network bandwidth of the user when obtaining target resource, and lifting is obtainedTake the transmission speed of Internet resources.
3rd embodiment:
Fig. 7 is refer to, is the block diagram for the first distributed caching device 510 that present pre-ferred embodiments are provided.In the present embodiment, the first distributed caching device 510 can include information sending module 511 and data reception module512.The first distributed caching device 510 can be stored in first memory 130, called by first processor 110Information sending module 511 and data reception module 512 perform corresponding operating, to improve the speed for obtaining Internet resources.
Further, information sending module 511, for sending real-time network speed and hardware parameter to the server 200, withThe server 200 is set to issue target resource according to the real-time network speed and hardware parameter.In detail, described information sending module511 can be used for performing the step S710 shown in Fig. 6.
Data reception module 512, for receiving the target resource that the server 200 is sent, so that other electronic equipments400 can obtain the data cached of target resource from the router 100.In detail, the data reception module 512 can be usedIn the step S720 shown in execution Fig. 6.
Fourth embodiment:
Fig. 8 is refer to, is the square frame block diagram for the second distributed caching device 520 that present pre-ferred embodiments are provided.InstituteData obtaining module 521, selecting module 522 and data transmission blocks can be included by stating the second distributed caching device 520523.Second processor 210 is by calling data obtaining module 521, selecting module 522 and data in second memory 230Sending module 523, realizes the acceleration to network resource transmission.
Further, described information acquisition module 521, real-time network speed and hardware ginseng for obtaining each router 100Number.Specifically, described information acquisition module 521 can be used for performing the step S610 shown in Fig. 4, and specific operation content canReferring to the description to the step S610 shown in Fig. 4, repeat no more here.
The selecting module 522, the router of threshold value is less than for choosing the real-time network speed from all-router 100100 are used as CDN cache nodes.Specifically, the selecting module 522 can be used for performing the step S620 shown in Fig. 4, specificallyOperation content can be found in the description to the step S620 shown in Fig. 4, repeat no more here.
The data transmission blocks 523, for sending the data cached of target resource to the CDN cache nodes, so thatOther electronic equipments 400 can obtain the data cached of the target resource from the CDN cache nodes.Specifically, the numberIt can be used for performing the step S630 shown in Fig. 4 according to sending module 523, specific operation content can be found in shown in Fig. 4Step S630 description, repeat no more here.
In summary, this present invention provides a kind of distributed caching method and device.Methods described is obtained by serverThe real-time network speed and hardware parameter of each router;The router that the real-time network speed is less than threshold value is chosen from all-routerIt is used as CDN cache nodes;The data cached of target resource is sent to the CDN cache nodes, so that other electronic equipments can be withThe data cached of the target resource is obtained from the CDN cache nodes.Methods described by making full use of idle bandwidth, withCaching of target resource on the router of first memory is provided with, and then alleviates network node pressure, user is improved and obtains targetThe speed of resource.In addition, this method can also reduce the cost of network resource provider.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this areaFor art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiiesChange, equivalent substitution, improvement etc., should be included in the scope of the protection.