Movatterモバイル変換


[0]ホーム

URL:


WO2014101894A1 - Method and device for determining caching policy - Google Patents

Method and device for determining caching policy
Download PDF

Info

Publication number
WO2014101894A1
WO2014101894A1PCT/CN2013/091185CN2013091185WWO2014101894A1WO 2014101894 A1WO2014101894 A1WO 2014101894A1CN 2013091185 WCN2013091185 WCN 2013091185WWO 2014101894 A1WO2014101894 A1WO 2014101894A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
value
hash
router
popularity
Prior art date
Application number
PCT/CN2013/091185
Other languages
French (fr)
Chinese (zh)
Inventor
刘树成
Original Assignee
华为技术有限公司
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 华为技术有限公司filedCritical华为技术有限公司
Publication of WO2014101894A1publicationCriticalpatent/WO2014101894A1/en

Links

Classifications

Definitions

Landscapes

Abstract

Embodiments of the present invention provide a method and a device for determining a caching policy. In the method, a statistical node receives information, reported by a router, that first data is requested, and calculates, according to a hash function, metadata of the first data, and a first degree of popularity of the first data, an identifier value of a router storing the first data; a determining router receives, from a user equipment, a packet used for requesting the first data, and calculates, according to the hash function, an identifier of the router storing the first data; and the user equipment uses the metadata of the first data as a function input value, and performs a hash operation by using the hash function to obtain a first hash value, so that more copies of requested content with a higher degree of popularity are cached while fewer copies of requested content with a lower degree of popularity are cached, which avoids the problem in the prior art that all content is cached or only the latest requested content is cached, thereby implementing cooperative caching among routers in a cooperative area, and improving the caching efficiency of the routers.

Description

一种确定緩存策略的方法及设备 本申请要求于 2012年 12月 31 日提交中国专利局、 申请号为 CN Method and device for determining cache strategy This application claims to be submitted to the Chinese Patent Office on December 31, 2012, and the application number is CN
201210290587.7、 发明名称为 "一种确定緩存策略的方法及设备" 的中国 专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域The priority of the Chinese Patent Application, which is incorporated herein by reference. Technical field
本发明属于网络技术领域, 尤其涉及一种确定緩存策略的方法及设 备。 The present invention belongs to the field of network technologies, and in particular, to a method and a device for determining a cache policy.
背景技术 随着网络规模和技术的不断进步, 一方面, 图片, web页面, 办公文 档以及多媒体音视频等的获取成为互联网的主要应用, 网络流量也随之急 剧增加, 另一方面, 路由器的性能得到增强, 除了基本转发功能外, 还具 备一定的计算和緩存能力。 由于路由器相对于原始的内容服务提供者更靠 近用户侧, 因此利用路由器的緩存能力可以快速响应用户对内容的请求, 并减少网络带宽的消耗。BACKGROUND With the continuous improvement of network scale and technology, on the one hand, the acquisition of pictures, web pages, office documents, multimedia audio and video becomes the main application of the Internet, and the network traffic also increases sharply. On the other hand, the performance of the router Enhanced, in addition to basic forwarding, it also has some computing and caching capabilities. Since the router is closer to the user side than the original content service provider, the router's caching capability can quickly respond to user requests for content and reduce network bandwidth consumption.
目前大部分的技术方案中, 路由器緩存之间不存在协作。 位于用户到 原始内容提供者路径上的各个路由器独自根据其收到的内容的流行度来 决定是否要緩存该内容, 并截获用户请求命中本地路由器緩存的情况向用 户返回内容或者转发该请求。 采用该方式, 用户仅能利用路径上的緩存, 无法找到网络中其他緩存。 同时, 由于单个路由器的緩存是有限的, 无协 作的方式使得单个路由器对收到的所有内容分片都要判断是否需要緩存, 其动态性较高, 本地緩存命中率较低。 最后, 由于各个路由器单独决定是 否緩存, 对于流行度很高的内容分片来说存在大量的冗余緩存, 使得整个 网络的緩存利用率下降。 现有技术中解决协作区域内緩存路由器相互协作緩存内容的问题主 要是可以分为集中式和分布式两类。 集中式方案是根据内容提供者的需 求, 利用一个集中式设备来指定各个路由器緩存应该緩存的内容。 并不考 虑该本地在本地流行度, 其所有的请求都要通过集中式设备查找緩存的位 置, 负载过大。 典型的分布式方案是通过哈希函数确定每个緩存路由器需 要负责緩存的内容的范围。 每个内容在协作区域内最多緩存一份, 流行度 高的内容会导致负责的緩存路由器负载过大。 发明内容 本发明实施例的目的在于提供一种确定緩存策略的方法, 解决路由 器緩存之间不存在协作所导致的网络緩存利用率低、 路由器存在大量的冗 余緩存及路由器负载过大等的问题。In most current technical solutions, there is no collaboration between router caches. Each router located on the user's original content provider path decides whether to cache the content based on the popularity of the content it receives, and intercepts the user request to hit the local router cache to return content to the user or forward the request. In this way, the user can only use the cache on the path and cannot find other caches on the network. At the same time, since the cache of a single router is limited, the non-cooperative way makes a single router judge whether it needs to be cached for all the content fragments received, and its dynamicness is high, and the local cache hit rate is low. Finally, because each router decides whether to cache separately, there is a large amount of redundant cache for content patches with high popularity, which reduces the cache utilization of the entire network. In the prior art, the problem of solving the cached content of the cache routers in the collaboration area is mainly divided into two types: centralized and distributed. The centralized solution uses a centralized device to specify what each router cache should cache based on the needs of the content provider. Regardless of the local popularity in the local, all of its requests are to find the location of the cache through the centralized device, and the load is too large. A typical distributed approach is to determine the range of content that each cache router needs to be cached through a hash function. Each content is cached at most in the collaboration area, and high-population content can cause the responsible cache router to be overloaded. SUMMARY OF THE INVENTION An object of the embodiments of the present invention is to provide a method for determining a cache policy, which solves the problem of low network cache utilization caused by no cooperation between router caches, a large number of redundant caches of routers, and excessive router load. .
第一方面, 一种路由器緩存协作的方法, 所述方法包括: In a first aspect, a method for router cache cooperation, the method includes:
统计节点根据接收区域内的 m个路由器分别上报的表示第一数据被 请求的信息, m≥l ; The statistical node reports the information that the first data is requested according to the m routers in the receiving area, m≥l;
以所述第一数据的元数据为函数输入值, 使用哈希函数进行哈希运 算, 得到第一哈希值; Inputting a value by using the metadata of the first data as a function, and performing a hash operation using a hash function to obtain a first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< n。 Performing a modulo n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the total number of routers in the area, m< n .
结合第一方面, 在第一方面的第一种可能的实现方式中, 当第一数据 的第一流行度等级的绝对值大于或等于 2时, 所述方法还包括: With reference to the first aspect, in a first possible implementation manner of the first aspect, when the absolute value of the first popularity level of the first data is greater than or equal to 2, the method further includes:
以所述第一路由器的标识为函数输入值, 使用所述哈希函数进行哈希 运算, 得到第二哈希值; Entering a value by using the identifier of the first router as a function, and performing a hash operation using the hash function to obtain a second hash value;
对所述第二哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第二路由器的标识值。 Performing a modulo n operation on the second hash value to obtain an identification value of a second router for buffering part or all of the data in the first data.
结合第一方面, 在第一方面的第二种可能的实现方式中, 所述 m个路 由器分别上报的表示第一数据被请求的信息为所述 m个路由器分别上报 的所述第一数据的流行度, 所述方法还包括:With reference to the first aspect, in a second possible implementation manner of the first aspect, the information that the m routers respectively report that the first data is requested is reported by the m routers The popularity of the first data, the method further includes:
根据所述 m个路由器分别上报的所述第一数据的流行度,确定所述第 一数据的总流行度; Determining a total popularity of the first data according to a popularity of the first data reported by the m routers;
根据所述第一数据的总流行度查询等级对应关系, 确定所述第一数据 的总流行度的第一流行度等级; Determining, according to the total popularity query level correspondence of the first data, a first popularity level of the total popularity of the first data;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 And determining, by each value of i, an identifier value of the i+1th router for buffering part or all of the data in the first data.
结合第一方面第二种可能的实现方式, 在第一方面的第三种可能的实 现方式中, 所述等级对应关系包括所述总流行度和所述流行度等级的对应 关系, 或, 所述等级对应关系包括流行度取值区域和所述流行度等级的对 应关系, 且所述总流行度在所述流行度取值区域之内。 With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner of the foregoing aspect, the level correspondence relationship includes a correspondence between the total popularity level and the popularity level, or The hierarchical correspondence includes a correspondence between the popularity value area and the popularity level, and the total popularity is within the popularity value area.
结合第一方面或者第一方面的第一种可能的实现方式或者第一方面 的第二种可能的实现方式或者第一方面的第三种可能的实现方式, 在第一 方面的第四种可能的实现方式中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA In combination with the first aspect or the first possible implementation of the first aspect or the second possible implementation of the first aspect or the third possible implementation of the first aspect, the fourth possibility in the first aspect In the implementation manner, the hash function includes: MD5, SHA1, BKDRHash, or FNVIA
第二方面, 一种确定緩存策略的方法, 所述方法包括: A second aspect, a method for determining a cache policy, the method comprising:
判决路由器从用户设备接收用于请求第一数据的报文; The decision router receives a message for requesting the first data from the user equipment;
以所述第一数据的元数据为函数输入值, 使用哈希函数进行哈希运 算, 得到第一哈希值; Inputting a value by using the metadata of the first data as a function, and performing a hash operation using a hash function to obtain a first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< η。 结合第二方面, 在第二方面的第一种可能的实现方式中, 所述方法还 包括:Performing a modulo n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the total number of routers in the area, m< η . With reference to the second aspect, in a first possible implementation manner of the second aspect, the method further includes:
接收统计节点发送的所述第一数据的第一流行度等级; Receiving a first popularity level of the first data sent by the statistics node;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 And determining, by each value of i, an identifier value of the i+1th router for buffering part or all of the data in the first data.
结合第二方面或者第二方面的第一种可能的实现方式, 在第二方面的 第二种可能的实现方式中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash 或 FN VI A。 In conjunction with the second aspect or the first possible implementation of the second aspect, in a second possible implementation of the second aspect, the hash function includes: MD5, SHA1, BKDRHash, or FN VI A.
第三方面, 一种确定緩存策略的方法, 所述方法包括: A third aspect, a method for determining a caching policy, the method comprising:
用户设备以第一数据的元数据为函数输入值, 使用哈希函数进行哈希 运算, 得到第一哈希值; The user equipment inputs a value by using metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< n。 Performing a modulo n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the total number of routers in the area, m< n .
结合第三方面, 在第三方面的第一种可能的实现方式中, 所述方法还 包括: In conjunction with the third aspect, in a first possible implementation manner of the third aspect, the method further includes:
所述用户设备获取所述第一数据的最大流行度等级; Obtaining, by the user equipment, a maximum popularity level of the first data;
当所述最大流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the maximum popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; 确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。Performing a modulo n operation on the (i+1)th hash value to obtain a buffer for the first data An identifier value of the i+1th router of part or all of the data, where l ≤ i ≤ jl, i is an integer; determining, for each value of i, a portion for buffering some or all of the data in the first data The identity value of the i+1 router.
结合第三方面或者第三方面的第一种可能的实现方式, 在第三方面的 第二种可能的实现方式中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash 或 FN VI A。 In conjunction with the third aspect or the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the hash function includes: MD5, SHA1, BKDRHash, or FN VI A.
第四方面,一种确定緩存策略的设备,所述确定緩存策略的设备包括: 第一接收单元,用于统计节点根据接收区域内的 m个路由器分别上报 的表示第一数据被请求的信息, m≥l ; A device for determining a cache policy, where the device for determining a cache policy includes: a first receiving unit, configured to: report, by the statistic node, the information that the first data is requested according to the m routers in the receiving area, M≥l;
第一运算单元, 用于以所述第一数据的元数据为函数输入值, 使用哈 希函数进行哈希运算, 得到第一哈希值; a first operation unit, configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
第一模运算单元, 用于对所述第一哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为所述 区域内路由器的总数, m≤n。 a first modulo operation unit, configured to perform a modulo n operation on the first hash value, to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the area The total number of internal routers, m ≤ n.
结合第四方面, 在第四方面的第一种可能的实现方式中, 所述的确定 緩存策略的设备还包括: With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the device for determining a cache policy further includes:
第二运算单元, 用于当第一数据的第一流行度等级的绝对值大于或等 于 2时, 以所述第一路由器的标识为函数输入值, 使用所述哈希函数进行 哈希运算, 得到第二哈希值; a second operation unit, configured to: when the absolute value of the first popularity level of the first data is greater than or equal to 2, input a value by using the identifier of the first router as a function, and perform a hash operation by using the hash function, Obtaining a second hash value;
第二模运算单元, 用于对所述第二哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第二路由器的标识值。 And a second modulo operation unit, configured to perform a modulo operation on the second hash value to obtain an identifier value of the second router for buffering part or all of the data in the first data.
结合第四方面, 在第四方面的第二种可能的实现方式中, 所述 m个路 由器分别上报的表示第一数据被请求的信息为所述 m个路由器分别上报 的所述第一数据的流行度, 所述确定緩存策略的设备还包括: With reference to the fourth aspect, in a second possible implementation manner of the fourth aspect, the information that is sent by the m routers to indicate that the first data is requested is the first data that is reported by the m routers The device for determining a cache policy further includes:
第一确定单元,用于根据所述 m个路由器分别上报的所述第一数据的 流行度, 确定所述第一数据的总流行度; a first determining unit, configured to determine, according to a popularity of the first data reported by the m routers, a total popularity of the first data;
第二确定单元, 用于根据所述第一数据的总流行度查询等级对应关 系, 确定所述第一数据的总流行度的第一流行度等级; 所述确定緩存策略的设备还包括:a second determining unit, configured to determine, according to the total popularity query level correspondence relationship of the first data, a first popularity level of the total popularity of the first data; The device for determining a cache policy further includes:
第三运算单元, 用于当所述第一流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述哈 希函数进行哈希运算, 得到第 i+1哈希值; a third operation unit, configured to: when the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, j≥2, input the value by using the identifier of the i-th router as a function, and use the hash The function performs a hash operation to obtain an i+1th hash value;
第三模运算单元, 用于第对所述第 i+1哈希值进行模 n运算, 得到用 于緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; a third modulo operation unit, configured to perform a modulo n operation on the (i+1)th hash value, to obtain an identifier value of the i+1th router for buffering part or all of the data in the first data, where l<i<jl, i is an integer;
第三确定单元, 用于确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。 And a third determining unit, configured to determine an identifier value of the i+1th router corresponding to each value of the i for buffering part or all of the data in the first data.
结合第四方面的第二种可能的实现方式, 在第四方面的第三种可能的 实现方式中, 所述等级对应关系包括所述总流行度和所述流行度等级的对 应关系, 或, 所述等级对应关系包括流行度取值区域和所述流行度等级的 对应关系, 且所述总流行度在所述流行度取值区域之内。 With reference to the second possible implementation manner of the fourth aspect, in a third possible implementation manner of the fourth aspect, the level correspondence relationship includes a correspondence between the total popularity level and the popularity level, or The level correspondence includes a correspondence between the popularity value area and the popularity level, and the total popularity is within the popularity value area.
结合第四方面或者第四方面的第一种可能的实现方式或者第四方面 的第二种可能的实现方式或者第四方面的第三种可能的实现方式, 所述哈 希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA With reference to the fourth aspect, or the first possible implementation manner of the fourth aspect, or the second possible implementation manner of the fourth aspect, or the third possible implementation manner of the fourth aspect, the hash function includes: MD5, SHA1, BKDRHash or FNVIA
第五方面,一种确定緩存策略的设备,所述确定緩存策略的设备包括: 第二接收单元, 用于判决路由器从用户设备接收用于请求第一数据的 报文; A device for determining a cache policy, the device for determining a cache policy, comprising: a second receiving unit, configured to: determine, by the router, a message for requesting the first data from the user equipment;
第四运算单元, 用于以所述第一数据的元数据为函数输入值, 使用哈 希函数进行哈希运算, 得到第一哈希值; a fourth operation unit, configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
第四模运算单元, 用于对所述第一哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为所述 区域内路由器的总数, m≤n。 a fourth modulo operation unit, configured to perform a modulo n operation on the first hash value, to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the area The total number of internal routers, m ≤ n.
结合第五方面, 在第五方面的第一种可能的实现方式中, 所述确定緩 存策略的设备还包括: With reference to the fifth aspect, in a first possible implementation manner of the fifth aspect, the device for determining a cache policy further includes:
第三接收单元, 用于接收统计节点发送的所述第一数据的第一流行度 等级; 所述确定緩存策略的设备还包括:a third receiving unit, configured to receive a first popularity level of the first data sent by the statistics node; The device for determining a cache policy further includes:
第五运算单元, 用于当所述第一流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述哈 希函数进行哈希运算, 得到第 i+1哈希值; a fifth operation unit, configured to: when the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, j≥2, input the value by using the identifier of the i-th router as a function, and use the hash The function performs a hash operation to obtain an i+1th hash value;
第五模运算单元, 用于对所述第 i+1哈希值进行模 n运算, 得到用于 緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; a fifth modulo operation unit, configured to perform a modulo n operation on the (i+1)th hash value, to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where <i<jl, i is an integer;
第四确定单元, 用于确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。 And a fourth determining unit, configured to determine an identifier value of the i+1th router corresponding to each value of the i for buffering part or all of the data in the first data.
结合第五方面或者第五方面的第一种可能的实现方式, 所述哈希函数 包括: MD5、 SHA1、 BKDRHash或 FNVIA。 In conjunction with the fifth aspect or the first possible implementation manner of the fifth aspect, the hash function includes: MD5, SHA1, BKDRHash, or FNVIA.
第六方面,一种确定緩存策略的设备,所述确定緩存策略的设备包括: 第六运算单元, 用于用户设备以第一数据的元数据为函数输入值, 使 用哈希函数进行哈希运算, 得到第一哈希值; A device for determining a cache policy, the device for determining a cache policy, comprising: a sixth operation unit, configured to: the user equipment inputs a value by using metadata of the first data as a function, and performs a hash operation by using a hash function. , get the first hash value;
第六模运算单元, 用于对所述第一哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为所述 区域内路由器的总数, m≤n。 a sixth modulo operation unit, configured to perform a modulo n operation on the first hash value, to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the area The total number of internal routers, m ≤ n.
结合第六方面, 在第六方面的第一种可能的实现方式中, 所述确定緩 存策略的设备还包括: With reference to the sixth aspect, in a first possible implementation manner of the sixth aspect, the device for determining a cache policy further includes:
获取单元, 用于所述用户设备获取所述第一数据的最大流行度等级; 所述确定緩存策略的设备还包括: An acquiring unit, configured to acquire, by the user equipment, a maximum popularity level of the first data, where the device for determining a cache policy further includes:
第七运算单元, 用于当所述最大流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述哈 希函数进行哈希运算, 得到第 i+1哈希值; a seventh operation unit, configured to: when the absolute value of the maximum popularity level is greater than or equal to j, and j is a positive integer, j≥2, input the value by using the identifier of the i-th router as a function, and use the hash function Perform a hash operation to obtain an i+1th hash value;
第七模运算子单元, 用于对所述第 i+1哈希值进行模 n运算, 得到用 于緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; a seventh modulo operation subunit, configured to perform a modulo n operation on the (i+1)th hash value, to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l<i<jl, i is an integer;
第五确定单元, 用于确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。a fifth determining unit, configured to determine, corresponding to each value of i, for buffering the first data The identification value of the i+1th router of some or all of the data.
结合第六方面或者第六方面的第一种可能的实现方式, 在第六方面的 第二种可能的实现方式中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash 或 FN VI A。 In conjunction with the sixth aspect, or the first possible implementation manner of the sixth aspect, in a second possible implementation manner of the sixth aspect, the hash function includes: MD5, SHA1, BKDRHash, or FN VI A.
与现有技术相比, 本发明实施例提供一种确定緩存策略的方法, 所述 方法中通过统计节点接收路由器上报的第一数据被请求的信息, 根据哈希 函数、 第一数据的元数据和第一数据的第一流行度等级计算存储所述第一 数据的路由器的标识值; 通过判决路由器从用户设备接收用于请求第一数 据的报文, 根据哈希函数计算出存储所述第一数据的路由器标识; 所述用 户设备以第一数据的元数据为函数输入值, 使用哈希函数进行哈希运算, 得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的 请求内容緩存少份, 避免现有技术中对所有内容都緩存或者仅緩存最新请 求的内容, 从而实现协作区域内路由器相互协作緩存, 提高路由器緩存的 效率。 附图说明 为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例中所 需要使用的附图作筒单地介绍, 显而易见地, 下面描述中的附图仅仅是本 发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动 性的前提下, 还可以根据这些附图获得其他的附图。 Compared with the prior art, the embodiment of the present invention provides a method for determining a cache policy, where the statistical node receives the information requested by the first data reported by the router, according to the hash function and the metadata of the first data. And determining, by the first popularity level of the first data, an identifier value of the router storing the first data; receiving, by the determining router, a message for requesting the first data from the user equipment, and calculating, storing, according to the hash function a router identifier of a data; the user equipment inputs a value by using metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value, so that the content of the request with a high popularity level is cached, The content of the request with a low popularity level is cached less, and the content of the latest request is cached or only the latest requested content is cached in the prior art, so that the routers in the collaboration area cooperate with each other to cache and improve the efficiency of the router cache. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative labor.
图 1是本发明实施例一提供的一种确定緩存策略的方法流程图; 图 2是本发明实施例二提供的一种确定緩存策略的方法流程图; 图 3是本发明实施例三提供的一种确定緩存策略的方法流程图; 图 4是本发明实施例四提供的一种路由器緩存协作的方法示意图; 图 5是本发明实施例四提供的一种统计节点緩存协作的方法流程图; 图 6是本发明实施例四提供的一种路由器緩存协作的方法流程图; 图 7是本发明实施例四提供的一种统计节点緩存协作的方法流程图; 图 8是本发明实施例五提供的一种确定緩存策略的设备结构图; 图 9是本发明实施例五提供的一种确定緩存策略的设备结构图; 图 10是本发明实施例五提供的一种确定緩存策略的设备结构图; 图 11是本发明实施例六提供的一种确定緩存策略的设备结构图; 图 12是本发明实施例六提供的一种确定緩存策略的设备结构图; 图 13是本发明实施例七提供的一种确定緩存策略的设备结构图; 图 14是本发明实施例七提供的一种确定緩存策略的设备结构图; 图 15是本发明实施例八提供的一种统计节点的装置结构图; 图 16是本发明实施例九提供的一种路由器的装置结构图;1 is a flowchart of a method for determining a cache policy according to Embodiment 1 of the present invention; FIG. 2 is a flowchart of a method for determining a cache policy according to Embodiment 2 of the present invention; FIG. 4 is a schematic diagram of a method for router cache cooperation according to Embodiment 4 of the present invention; FIG. 5 is a flowchart of a method for statistical node cache collaboration according to Embodiment 4 of the present invention; 6 is a flowchart of a method for router cache cooperation provided by Embodiment 4 of the present invention; FIG. 7 is a flowchart of a method for statistical node cache collaboration according to Embodiment 4 of the present invention; FIG. 8 is a flowchart of Embodiment 5 of the present invention. a device structure diagram for determining a caching strategy; FIG. 9 is a structural diagram of a device for determining a cache policy according to Embodiment 5 of the present invention; FIG. 10 is a structural diagram of a device for determining a cache policy according to Embodiment 5 of the present invention; FIG. 12 is a structural diagram of a device for determining a cache policy according to Embodiment 6 of the present invention; FIG. 13 is a structural diagram of a device for determining a cache policy according to Embodiment 7 of the present invention; FIG. 14 is a structural diagram of a device for determining a cache policy according to Embodiment 7 of the present invention; FIG. 15 is a structural diagram of a device for providing a statistical node according to Embodiment 8 of the present invention; Device structure diagram of a router;
图 17是本发明实施例十提供的一种用户设备的装置结构图。 FIG. 17 is a structural diagram of a device of a user equipment according to Embodiment 10 of the present invention.
具体实施方式 为了使本发明的目的、 技术方案及优点更加清楚明白, 以下结合附图 及实施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体 实施例仅仅用以解释本发明, 并不用于限定本发明。DETAILED DESCRIPTION OF THE EMBODIMENTS The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在 本发明的精神和原则之内所作的任何修改、 等同替换和改进等, 均应包含 在本发明的保护范围之内。 The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. Within the scope.
实施例一 Embodiment 1
参考图 1 , 图 1是本发明实施例一提供的一种确定緩存策略的方法流 程图。 如图 1所示, 所述方法包括如下步骤: Referring to FIG. 1, FIG. 1 is a flow chart of a method for determining a cache policy according to Embodiment 1 of the present invention. As shown in FIG. 1, the method includes the following steps:
步骤 101 , 统计节点根据接收区域内的 m个路由器分别上报的表示第 一数据被请求的信息, m≥l ; Step 101: The statistical node reports, according to the m routers in the receiving area, information indicating that the first data is requested, m≥l;
步骤 102, 以所述第一数据的元数据为函数输入值, 使用哈希函数进 行哈希运算, 得到第一哈希值; Step 102: Enter a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value.
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FN VIA。 所 述元数据是第一数据的名字, 是携带在所述第一数据被请求的信息中的。 The hash function includes: MD5, SHA1, BKDRHash, or FN VIA. The metadata is the name of the first data and is carried in the information in which the first data is requested.
具体的, 假设哈希函数为 Hash, 则 Hash (第一数据的元数据 ) =第一 哈希值。 步骤 103 , 对所述第一哈希值进行模 n运算, 得到用于緩存所述第一 数据中的部分或全部数据的第一路由器的标识, 所述 n为所述区域内路由 器的总数, m≤n。Specifically, assuming that the hash function is Hash, then Hash (metadata of the first data) = first hash value. Step 103: Perform a modulo-n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is a total number of routers in the area, m ≤ n.
具体的, 第一哈希值 moden=第一路由器标识。 Specifically, the first hash value moden=the first router identifier.
作为一种可选的实施例, 当第一数据的第一流行度等级的绝对值大于 或等于 2时, 所述方法还包括: As an optional embodiment, when the absolute value of the first popularity level of the first data is greater than or equal to 2, the method further includes:
以所述第一路由器的标识为函数输入值, 使用所述哈希函数进行哈希 运算, 得到第二哈希值; Entering a value by using the identifier of the first router as a function, and performing a hash operation using the hash function to obtain a second hash value;
对所述第二哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第二路由器的标识值。 Performing a modulo n operation on the second hash value to obtain an identification value of a second router for buffering part or all of the data in the first data.
具体的, 第二次计算时, Hash (第一路由器的标识) =第二哈希值, 第二哈希值 1110(1611=第二路由器标识。 Specifically, in the second calculation, Hash (identification of the first router) = second hash value, and second hash value 1110 (1611 = second router identifier).
具体的, 请求内容 C1的流行等级 i=2, 假设 Hash ( CI ) modeN=路由 器 1 , Hash ( 1 ) modeN=路由器 2, 则计算出路由器 1和路由器 2负责緩 存 Cl。 Specifically, the popularity level of the request content C1 is i=2. Assuming Hash (CI) modeN=router 1, Hash (1) modeN=router 2, it is calculated that router 1 and router 2 are responsible for buffering Cl.
作为另一种可选的实施例,所述 m个路由器分别上报的表示第一数据 被请求的信息为所述 m个路由器分别上报的所述第一数据的流行度,所述 方法还包括: As another optional embodiment, the information that is reported by the m routers to indicate that the first data is requested is the popularity of the first data that is reported by the m routers, and the method further includes:
根据所述 m个路由器分别上报的所述第一数据的流行度,确定所述第 一数据的总流行度; Determining a total popularity of the first data according to a popularity of the first data reported by the m routers;
根据所述第一数据的总流行度查询等级对应关系, 确定所述第一数据 的总流行度的第一流行度等级; Determining, according to the total popularity query level correspondence of the first data, a first popularity level of the total popularity of the first data;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; 确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ; And determining, by each value of i, an identifier value of the (i+1)th router for buffering part or all of the data in the first data.
其中, 所述等级对应关系包括所述总流行度和所述流行度等级的对应 关系, 或, 所述等级对应关系包括流行度取值区域和所述流行度等级的对 应关系, 且所述总流行度在所述流行度取值区域之内。 The level correspondence includes a correspondence between the total popularity and the popularity level, or the level correspondence includes a correspondence between a popularity value area and the popularity level, and the total relationship The popularity is within the popularity value area.
具体的, 假设第一级流行等级 i=l的阀值为每统计周期收到 100个请 求, 即 i=l对应的流行度 X的范围为 0-100; 第二级流行等级 i=2的阀值为 每统计周期收到 150个请求, 即 i=2对应的流行度 X的范围为 100-150。 Specifically, it is assumed that the threshold value of the first-level popularity level i=l is 100 requests per statistical period, that is, the range of the popularity X corresponding to i=l is 0-100; the second-level popular level is i=2. The threshold is 150 requests per statistical period, ie the popularity X corresponding to i=2 ranges from 100-150.
具体的, 假设根据流行度大小排序前 30%的请求内容, 流行等级设置 为 1 ; 排序为前 30%至 50%的请求内容, 流行等级设置为 2。 Specifically, it is assumed that the top 30% of the requested content is sorted according to the popularity level, the popularity level is set to 1; the top 30% to 50% of the requested content is ranked, and the popularity level is set to 2.
具体的, 第三次运算时, Hash (第二路由器的标识) =第三哈希值, 第三哈希值 moden=第三路由器标识; 第四次运算时, Hash (第三路由器 的标识) =第四哈希值, 第四哈希值 moden=第四路由器标识, 依此类推, 第 j次运算时, Hash(第 j-1路由器的标识)=第 j哈希值,第 j哈希值 moden= 第 j路由器标识。 Specifically, in the third operation, Hash (identification of the second router) = third hash value, third hash value moden = third router identifier; Hash (identification of the third router) in the fourth operation = fourth hash value, fourth hash value moden = fourth router identifier, and so on, the jth operation, Hash (identification of the j-1th router) = jth hash value, jth hash The value moden= the jth router ID.
本发明实施例提供一种确定緩存策略的方法, 所述方法中通过统计节 点接收路由器上报的第一数据被请求的信息, 根据哈希函数、 第一数据的 元数据和第一数据的第一流行度等级计算存储所述第一数据的路由器的 标识值; 通过判决路由器从用户设备接收用于请求第一数据的报文, 根据 哈希函数计算出存储所述第一数据的路由器标识; 所述用户设备以第一数 据的元数据为函数输入值,使用哈希函数进行哈希运算,得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的请求内容緩存少 份, 避免现有技术中对所有内容都緩存或者仅緩存最新请求的内容, 从而 实现协作区域内路由器相互协作緩存, 提高路由器緩存的效率。 An embodiment of the present invention provides a method for determining a cache policy. In the method, a statistical node receives information requested by a first data reported by a router, and according to a hash function, metadata of the first data, and first data. The popularity level calculates an identifier value of the router storing the first data; receiving, by the decision router, a message for requesting the first data from the user equipment, and calculating a router identifier for storing the first data according to the hash function; The user equipment inputs a value by using the metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value, so that the content of the content with a high popularity level is cached, and the content of the request with a low popularity level is cached. In the prior art, the content of the latest request is cached or only the latest requested content is cached, so that the routers in the collaboration area cooperate with each other to cache and improve the efficiency of the router cache.
实施例二 Embodiment 2
参考图 2, 图 2是本发明实施例二提供的一种确定緩存策略的方法流 程图。 如图 2所示, 所述方法包括如下步骤: Referring to FIG. 2, FIG. 2 is a flow chart of a method for determining a cache policy according to Embodiment 2 of the present invention. As shown in FIG. 2, the method includes the following steps:
步骤 201 , 判决路由器从用户设备接收用于请求第一数据的报文; 步骤 202, 以所述第一数据的元数据为函数输入值, 使用哈希函数进 行哈希运算, 得到第一哈希值;Step 201: The determining router receives, from the user equipment, a packet for requesting the first data. Step 202: Enter a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value.
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 所 述元数据是第一数据的名字, 是携带在所述第一数据被请求的信息中的。 The hash function includes: MD5, SHA1, BKDRHash, or FNVIA. The metadata is the name of the first data and is carried in the information in which the first data is requested.
具体的, 假设哈希函数为 Hash, 则 Hash (第一数据的元数据 ) =第一 哈希值。 Specifically, assuming the hash function is Hash, Hash (metadata of the first data) = first hash value.
步骤 203 , 对所述第一哈希值进行模 n运算, 得到用于緩存所述第一 数据中的部分或全部数据的第一路由器的标识, 所述 n为所述区域内路由 器的总数, m≤n。 Step 203: Perform a modulo-n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is a total number of routers in the area, m ≤ n.
具体的, 第一哈希值 moden=第一路由器标识。 Specifically, the first hash value moden=the first router identifier.
作为一种可选的实施例, 所述方法还包括: As an optional embodiment, the method further includes:
接收统计节点发送的所述第一数据的第一流行度等级; Receiving a first popularity level of the first data sent by the statistics node;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 And determining, by each value of i, an identifier value of the i+1th router for buffering part or all of the data in the first data.
具体的, 第二次计算时, Hash (第一路由器的标识) =第二哈希值, 第二哈希值 1110(1611=第二路由器标识。 Specifically, in the second calculation, Hash (identification of the first router) = second hash value, and second hash value 1110 (1611 = second router identifier).
具体的, 第三次运算时, Hash (第二路由器的标识) =第三哈希值, 第三哈希值 moden=第三路由器标识; 第四次运算时, Hash (第三路由器 的标识) =第四哈希值, 第四哈希值 moden=第四路由器标识, 依此类推, 第 j次运算时, Hash(第 j-1路由器的标识)=第 j哈希值,第 j哈希值 moden= 第 j路由器标识。 Specifically, in the third operation, Hash (identification of the second router) = third hash value, third hash value moden = third router identifier; Hash (identification of the third router) in the fourth operation = fourth hash value, fourth hash value moden = fourth router identifier, and so on, the jth operation, Hash (identification of the j-1th router) = jth hash value, jth hash The value moden= the jth router ID.
本发明实施例提供一种确定緩存策略的方法, 所述方法中通过统计节 点接收路由器上报的第一数据被请求的信息, 根据哈希函数、 第一数据的 元数据和第一数据的第一流行度等级计算存储所述第一数据的路由器的 标识值; 通过判决路由器从用户设备接收用于请求第一数据的报文, 根据 哈希函数计算出存储所述第一数据的路由器标识; 所述用户设备以第一数 据的元数据为函数输入值,使用哈希函数进行哈希运算,得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的请求内容緩存少 份, 避免现有技术中对所有内容都緩存或者仅緩存最新请求的内容, 从而 实现协作区域内路由器相互协作緩存, 提高路由器緩存的效率。An embodiment of the present invention provides a method for determining a cache policy, where the method passes a statistical section. Receiving, by the point receiving, the information requested by the first data reported by the router, calculating, according to the hash function, the metadata of the first data, and the first popularity level of the first data, an identifier value of the router storing the first data; Receiving, by the user equipment, a message for requesting the first data, and calculating, by using a hash function, a router identifier storing the first data; the user equipment inputting a value by using metadata of the first data as a function, using a hash function The hash operation is performed to obtain the first hash value, so that the content of the content with high popularity level is cached, and the content of the content with low popularity level is cached less, so as to avoid caching all the content in the prior art or only caching the latest request. Content, thereby enabling routers in the collaboration area to cooperate with each other to cache, improving the efficiency of router caching.
实施例三 Embodiment 3
参考图 3 , 图 3是本发明实施例三提供的一种确定緩存策略的方法流 程图。 所述方法包括以下步骤: Referring to FIG. 3, FIG. 3 is a flow chart of a method for determining a cache policy according to Embodiment 3 of the present invention. The method includes the following steps:
步骤 301 , 用户设备以第一数据的元数据为函数输入值, 使用哈希函 数进行哈希运算, 得到第一哈希值; Step 301: The user equipment inputs a value by using metadata of the first data as a function, and performs a hash operation by using a hash function to obtain a first hash value.
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 具体的, Hash (第一数据的元数据) =第一哈希值。 The hash function includes: MD5, SHA1, BKDRHash, or FNVIA. Specifically, Hash (metadata of the first data) = first hash value.
步骤 302, 对所述第一哈希值进行模 n运算, 得到用于緩存所述第一 数据中的部分或全部数据的第一路由器的标识, 所述 n为所述区域内路由 器的总数, m≤n。 Step 302: Perform a modulo-n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is a total number of routers in the area, m ≤ n.
具体的, 第一哈希值 moden=第一路由器标识。 Specifically, the first hash value moden=the first router identifier.
作为一种可选的实施例, 所述方法还包括: As an optional embodiment, the method further includes:
所述用户设备获取所述第一数据的最大流行度等级; Obtaining, by the user equipment, a maximum popularity level of the first data;
当所述最大流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the maximum popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。Determining, for each value of i, for buffering some or all of the data in the first data The identity value of the i+1th router.
具体的, 第二次计算时, Hash (第一路由器的标识) =第二哈希值, 第二哈希值 1110(1611=第二路由器标识。 Specifically, in the second calculation, Hash (identification of the first router) = second hash value, and second hash value 1110 (1611 = second router identifier).
具体的, 第三次运算时, Hash (第二路由器的标识) =第三哈希值, 第三哈希值 moden=第三路由器标识; 第四次运算时, Hash (第三路由器 的标识) =第四哈希值, 第四哈希值 moden=第四路由器标识, 依此类推, 第 j次运算时, Hash(第 j-1路由器的标识)=第 j哈希值,第 j哈希值 moden= 第 j路由器标识。 Specifically, in the third operation, Hash (identification of the second router) = third hash value, third hash value moden = third router identifier; Hash (identification of the third router) in the fourth operation = fourth hash value, fourth hash value moden = fourth router identifier, and so on, the jth operation, Hash (identification of the j-1th router) = jth hash value, jth hash The value moden= the jth router ID.
本发明实施例提供一种确定緩存策略的方法, 所述方法中通过统计节 点接收路由器上报的第一数据被请求的信息, 根据哈希函数、 第一数据的 元数据和第一数据的第一流行度等级计算存储所述第一数据的路由器的 标识值; 通过判决路由器从用户设备接收用于请求第一数据的报文, 根据 哈希函数计算出存储所述第一数据的路由器标识; 所述用户设备以第一数 据的元数据为函数输入值,使用哈希函数进行哈希运算,得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的请求内容緩存少 份, 避免现有技术中对所有内容都緩存或者仅緩存最新请求的内容, 从而 实现协作区域内路由器相互协作緩存, 提高路由器緩存的效率。 An embodiment of the present invention provides a method for determining a cache policy. In the method, a statistical node receives information requested by a first data reported by a router, and according to a hash function, metadata of the first data, and first data. The popularity level calculates an identifier value of the router storing the first data; receiving, by the decision router, a message for requesting the first data from the user equipment, and calculating a router identifier for storing the first data according to the hash function; The user equipment inputs a value by using the metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value, so that the content of the content with a high popularity level is cached, and the content of the request with a low popularity level is cached. In the prior art, the content of the latest request is cached or only the latest requested content is cached, so that the routers in the collaboration area cooperate with each other to cache and improve the efficiency of the router cache.
实施例四 Embodiment 4
假设本发明实施例提供的协作区域如图 4所示, 本实施例中统计节点 负责在统计周期结束后统计各路由器上报的数据请求的流行度, 根据流行 度将每个数据请求信息划分一定的流行度等级, 并将流行度等级下发到各 路由器, 由各路由器计算负责緩存每个数据请求的路由器标识, 即分布式 方式。 Assume that the collaboration area provided by the embodiment of the present invention is as shown in FIG. 4. In this embodiment, the statistics node is responsible for counting the popularity of the data requests reported by each router after the statistics period ends, and dividing each data request information according to the popularity. The popularity level is sent to each router, and each router calculates the router identifier responsible for buffering each data request, that is, the distributed mode.
作为另一种可选的方式, 本实施例还可由统计节点计算负责緩存每个 数据请求的路由器标识,将计算后的标识下发到各路由器,即集中式方式。 As an alternative, the statistic node can also calculate the router identifier that is responsible for buffering each data request, and send the calculated identifier to each router, that is, the centralized mode.
以下以分布式方式为例, 该协作区域内包括 n=3台具有緩存能力的路 由器, 2个用户设备和一个统计节点(统计节点可设置在某个路由器上)。 以下实施例中总共涉及 10个文件分片, 每个的大小为 2M, 每个路由器的 緩存能力为 4M, 即 2个文件分片。 路由器 1为本区域与其他区域的连接 点。 以下实施例中, 协作区域中采用的哈希算法是 FNV1A。 协作区域内 支持的最大流行度等级 K=2。 统计周期为 5分钟, 第一级流行度等级阀值 为每统计周期收到 100个请求, 第二级流行度等级阀值为每统计周期收到 150个请求。 以下实施例中用户设备的程序, 路由器和统计节点均已完成 初始化的工作。 用户设备通过网络工具(比如, PING ) 已获知到所有路由 器的距离。 用户设备 1到路由器 3,1,2的距离依次增加, 用户设备 2到路 由器 1,3,2的距离依次增加。The following is a distributed mode. The collaboration area includes n=3 routers with cache capability, 2 user devices, and one statistics node (statistical nodes can be set on a router). In the following embodiment, a total of 10 file fragments are involved, each of which is 2M in size, for each router. The cache capacity is 4M, which is 2 file fragments. Router 1 is the connection point between the area and other areas. In the following embodiment, the hash algorithm employed in the cooperation area is FNV1A. The maximum popularity level supported in the collaboration area is K=2. The statistical period is 5 minutes, the first-level popularity level threshold receives 100 requests per statistical period, and the second-level popularity level threshold receives 150 requests per statistical period. In the following embodiments, the program of the user equipment, the router and the statistical node have completed the initialization work. The user device knows the distance to all routers through a network tool (for example, PING). The distance from the user equipment 1 to the routers 3, 1, 2 increases sequentially, and the distance from the user equipment 2 to the routers 1, 3, 2 increases sequentially.
当协作区域内路由器刚开始运行时, 接收用户设备请求某个内容时, 所有的路由器都没有緩存内容, 系统启动时, 所有内容的流行度等级都默 认为 1。 When the router in the collaboration area starts running, when all the receiving user equipment requests a certain content, all the routers do not have the cached content. When the system starts, the popularity level of all the content is assumed to be 1.
用户设备 1执行如图 5所示步骤, 路由器执行如图 6所示步骤, 统计 节点执行如图 7所示步骤。 The user equipment 1 performs the steps shown in FIG. 5, and the router performs the steps shown in FIG. 6, and the statistical node performs the steps shown in FIG.
步骤 501 , 用户设备加入协作区域, 从统计节点获取所述协作区域内 使用的哈希函数, 路由器总数 n, 路由器标识, 协作区域内支持的最大流 行度等级 K; Step 501: The user equipment joins the collaboration area, and obtains, by the statistics node, a hash function used in the collaboration area, the total number of routers n, the router identifier, and the maximum degree of flow level K supported in the collaboration area;
步骤 502, 用户设备 1的程序收到上层对内容 C1请求; Step 502: The program of the user equipment 1 receives an upper layer request for the content C1;
步骤 503 , 执行 K=2次哈希运算, η=3; Step 503, performing K=2 hash operations, η=3;
Hash(Cl的元数据) mode n= 1 , 由路由器 1负责 Hash (Cl metadata) mode n= 1 , is responsible for router 1
Hash(l) mode n = 3 , 有路由器 3负责 Hash(l) mode n = 3 , there is router 3 responsible
步骤 504, 当前有两个可能负责緩存的路由器; Step 504, there are currently two routers that may be responsible for caching;
步骤 505 , 向距离更近的路由器 3进行请求; Step 505, making a request to the router 3 that is closer;
该请求递交到路由器 3 , 执行 The request is submitted to the router 3, executed
步骤 602, 收到请求; Step 602, receiving a request;
步骤 603 , 请求的目的是自己; Step 603, the purpose of the request is itself;
步骤 604, 第一次收到该内容, 在流行度 (X)统计表中创建表项并进行 更新; Step 604: The content is received for the first time, and an entry is created and updated in the popularity (X) statistics table;
步骤 605 , 根据流行度等级进行 i=l次哈希运算, (默认等级为 1 ) ; Hash(Cl的元数据) mode n = 1;Step 605, performing i=l hash operations according to the popularity level, (the default level is 1); Hash (Cl metadata) mode n = 1;
步骤 606, 不由本路由器负责; Step 606, not being responsible for the router;
步骤 608, 通知用户设备查询失败; Step 608, notifying the user that the device fails to be queried;
用户设备 1收到路由器 3的回复 User device 1 receives a reply from router 3
步骤 506, 收到的不是数据内容 Step 506, the data content is not received.
步骤 504, 当前还有 1个可能负责緩存的路由器 Step 504, there is currently one router that may be responsible for caching.
步骤 505, 向距离更近的路由器 1进行请求 Step 505, requesting the router 1 that is closer
该请求递交到路由器 1, 执行 The request is submitted to router 1, executing
步骤 602, 收到请求 Step 602, receiving the request
步骤 603, 请求的目的是自己 Step 603, the purpose of the request is itself
步骤 604, 第一次收到该内容, 在流行度 (X)统计表中创建表项并进行 更新 Step 604, the content is received for the first time, and the entry is created and updated in the popularity (X) statistics table.
步骤 605, 根据流行等级进行 i=l次哈希运算, (默认等级为 1 ) Step 605, performing i=l hash operations according to the popularity level, (the default level is 1)
Hash(Cl的元数据) moden = 1, 由本路由器负责Hash (Cl metadata) moden = 1, is responsible for this router
步骤 606, 由本路由器负责 Step 606, the router is responsible for
步骤 607, 本地没有緩存 Step 607, there is no local cache
步骤 608, 通知用户设备查询失败 Step 608, notifying the user that the device fails to query
用户设备 1收到路由器 1的回复 User device 1 receives a reply from router 1
步骤 506, 收到的不是数据内容 Step 506, the data content is not received.
步骤 504, 已向所有可能负责緩存的路由器进行了请求 Step 504, a request has been made to all routers that may be responsible for caching
步骤 507, 向原始内容提供者请求 Step 507, requesting from the original content provider
该请求被路由到本区域的出口, 即路由器 1 The request is routed to the exit of the zone, ie router 1
步骤 602, 收到请求 Step 602, receiving the request
步骤 603, 请求的目的不是自己 Step 603, the purpose of the request is not itself
步骤 610, 请求的目的是域外 Step 610, the purpose of the request is outside the domain
步骤 611, 第一次收到该内容, 在流行度 (X)统计表中创建表项并进行 更新 Step 611, the content is received for the first time, and the entry is created and updated in the popularity (X) statistics table.
步骤 612, 根据路由器表进行转发 当第一个统计周期结束后, 此时, 所有路由器都没有緩存, 仅以路由 器 1为例说明。Step 612, forwarding according to the router table When the first statistical period is over, all routers are not cached at this time. Router 1 is used as an example.
步骤 602, 统计周期结束, 应该进行本地流行度 (X)通告 Step 602, the statistical period ends, and the local popularity (X) notification should be performed.
步骤 609, 将本地緩存中有的内容的流行度 (X)通告给统计节点, 同时 由于路由器 1是本区域和其他区域的连接点, 因此还需要将自己转发到其 他区域的内容的流行度 (X)进行通告, 假设在此统计周期内仅有内容 C1 , In step 609, the popularity (X) of the content in the local cache is advertised to the statistical node, and since the router 1 is the connection point between the local area and other areas, the popularity of the content that needs to be forwarded to other areas is also required ( X) Announce, assuming that there is only content C1 in this statistical period,
C2, C5 , C6, C7, C10被请求, 由于没有緩存, 因此都会原始内容提供 者获取。C2, C5, C6, C7, C10 are requested, and since they are not cached, they are obtained by the original content provider.
步骤 610,遍历所有本应该有本地负责, 但本地没有进行緩存的内容, 假设在路由器 1应该緩存包括 CI , C7, 由于本地没有緩存, 因此需要向 原始内容提供者获取一份, 然后进行本地緩存; Step 610, traversing all content that should be locally responsible, but not locally cached, assuming that the router 1 should be cached including CI, C7, since there is no local cache, it is necessary to obtain a copy from the original content provider, and then perform local cache. ;
第一个统计周期结束后, 统计节点会收到路由器 1通告的本地流行度 After the first statistical period is over, the statistics node will receive the local popularity notified by Router 1.
(X) , 执行(X), execution
步骤 702, 统计周期结束, 应该进行流行度 (X)汇总下发; Step 702, the statistical period ends, and the popularity (X) should be summarized and issued;
步骤 703 , 汇总收到的流行度 (X) , CI , C2, C5 , C6, C7, C10 ; 步骤 704, 根据流行度阀值, C10的流行等级为 k=2, CI , C2, C5 , C6, C7的流行等级均为 k=l , , 其余全部调整为 0; Step 703, summarizing the received popularity (X), CI, C2, C5, C6, C7, C10; Step 704, according to the popularity threshold, the popularity level of C10 is k=2, CI, C2, C5, C6 , C7's popularity level is k = l, and the rest are all adjusted to 0;
步骤 705 , 将流行等级发生变化的内容的流行度 (X)发送给应该负责的 路由器。 Step 705: Send the popularity (X) of the content whose popularity level changes to the router that should be responsible.
路由器收到统计节点下发的新的流行等级, 以路由器 1为例, 开始时 路由器已经緩存 C1和 C7, 由于 C10的流行等级提高, 路由器 1需要负责 緩存, 执行; The router receives the new traffic class from the statistics node. Take Router 1 as an example. At the beginning, the router has cached C1 and C7. Because the popularity level of C10 is increased, Router 1 needs to be responsible for caching and execution.
步骤 602, 收到统计节点发送的流行等级; Step 602: Receive a popularity level sent by the statistics node.
步骤 615 , C10是新添加的需要本路由器负责的内容; Step 615, C10 is newly added content that needs to be responsible for the router;
步骤 616, 需要判断是否需要緩存 C10; Step 616, it is necessary to determine whether it is necessary to cache C10;
步骤 617, 将 C10在本地的流行度 (xcl。)与 C1和 C7的流行度 (xC7)进 行比较, 由于 C10的流行度 (xcl。)比 C7高, 需要进行替换;Step 617, comparing C10 local popularity (xcl .) with C1 and C7 popularity (xC7 ), since C10 popularity (xcl .) is higher than C7, need to be replaced;
步骤 618, 向原始路由器获取并緩存 C10。 实施例五Step 618: Acquire and cache C10 from the original router. Embodiment 5
参考图 8, 图 8是本发明实施例五提供的一种确定緩存策略的设备结 构图。 如图 8所示, 所述设备包括如下单元: Referring to FIG. 8, FIG. 8 is a structural diagram of a device for determining a cache policy according to Embodiment 5 of the present invention. As shown in FIG. 8, the device includes the following units:
第一接收单元 801 , 用于统计节点根据接收区域内的 m个路由器分别 上报的表示第一数据被请求的信息, m≥l ; The first receiving unit 801 is configured to: the information that the statistical node reports that the first data is requested according to the m routers in the receiving area, m≥l;
第一运算单元 802, 用于以所述第一数据的元数据为函数输入值, 使 用哈希函数进行哈希运算, 得到第一哈希值; a first operation unit 802, configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA 第一模运算单元 803 , 用于对所述第一哈希值进行模 n运算, 得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。 The hash function includes: MD5, SHA1, BKDRHash, or FNVIA, a first modulo operation unit 803, configured to perform a modulo n operation on the first hash value, to obtain a portion for buffering the first data. Or the identifier of the first router of all data, where n is the total number of routers in the area, m ≤ n.
作为一种可选的实施例, 参考图 9, 图 9是本发明实施例五提供的一 种确定緩存策略的设备结构图。 如图 9所示, As an alternative embodiment, referring to FIG. 9, FIG. 9 is a structural diagram of a device for determining a cache policy according to Embodiment 5 of the present invention. As shown in Figure 9,
第一接收单元 901 , 用于统计节点根据接收区域内的 m个路由器分别 上报的表示第一数据被请求的信息, m≥l ; The first receiving unit 901 is configured to:, according to the m routers in the receiving area, the information indicating that the first data is requested, m≥l;
第一运算单元 902, 用于以所述第一数据的元数据为函数输入值, 使 用哈希函数进行哈希运算, 得到第一哈希值; The first operation unit 902 is configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA 第一模运算单元 903 , 用于对所述第一哈希值进行模 n运算, 得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。 The hash function includes: MD5, SHA1, BKDRHash, or FNVIA, a first modulo operation unit 903, configured to perform a modulo n operation on the first hash value, to obtain a portion for buffering the first data. Or the identifier of the first router of all data, where n is the total number of routers in the area, m ≤ n.
所述确定緩存策略的设备还包括: The device for determining a cache policy further includes:
第二运算单元 904, 用于当第一数据的第一流行度等级的绝对值大于 或等于 2时, 以所述第一路由器的标识为函数输入值, 使用所述哈希函数 进行哈希运算, 得到第二哈希值; The second operation unit 904 is configured to: when the absolute value of the first popularity level of the first data is greater than or equal to 2, input the value by using the identifier of the first router as a function, and perform a hash operation by using the hash function. , get the second hash value;
第二模运算单元 905 , 用于对所述第二哈希值进行模 n运算, 得到用 于緩存所述第一数据中的部分或全部数据的第二路由器的标识值。 The second modulo operation unit 905 is configured to perform a modulo operation on the second hash value to obtain an identifier value of a second router for buffering part or all of the data in the first data.
作为另一种可选的实施例, 参考图 10, 图 10是本发明实施例五提供 的一种确定緩存策略的设备结构图。 如图 10所示,As another alternative embodiment, reference is made to FIG. 10, which is provided in Embodiment 5 of the present invention. A device structure diagram that determines the caching strategy. As shown in Figure 10,
第一接收单元 1001 , 用于统计节点根据接收区域内的 m个路由器分 别上报的表示第一数据被请求的信息, m≥l ; The first receiving unit 1001 is configured to:, according to the m routers in the receiving area, the information indicating that the first data is requested, m≥l;
第一运算单元 1002, 用于以所述第一数据的元数据为函数输入值,使 用哈希函数进行哈希运算, 得到第一哈希值; The first operation unit 1002 is configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA 第一模运算单元 1003 , 用于对所述第一哈希值进行模 n运算,得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。 The hash function includes: an MD5, a SHA1, a BKDRHash, or an FNVIA first modulo operation unit 1003, configured to perform a modulo n operation on the first hash value to obtain a portion for buffering the first data. Or the identifier of the first router of all data, where n is the total number of routers in the area, m ≤ n.
所述 m个路由器分别上报的表示第一数据被请求的信息为所述 m个 路由器分别上报的所述第一数据的流行度, 所述确定緩存策略的设备还包 括: The information indicating that the first data is requested by the m routers is the popularity of the first data reported by the m routers, and the device for determining the cache policy further includes:
第一确定单元 1004, 用于根据所述 m个路由器分别上报的所述第一 数据的流行度, 确定所述第一数据的总流行度; a first determining unit 1004, configured to determine, according to a popularity of the first data reported by the m routers, a total popularity of the first data;
第二确定单元 1005 ,用于根据所述第一数据的总流行度查询等级对应 关系, 确定所述第一数据的总流行度的第一流行度等级; a second determining unit 1005, configured to determine, according to the total popularity query level correspondence of the first data, a first popularity level of the total popularity of the first data;
所述确定緩存策略的设备还包括: The device for determining a cache policy further includes:
第三运算单元 1006,用于当所述第一流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述 哈希函数进行哈希运算, 得到第 i+1哈希值; The third operation unit 1006 is configured to: when the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, j≥2, input the value by using the identifier of the i-th router as a function, and use the The hash function performs a hash operation to obtain an i+1th hash value;
第三模运算单元 1007, 对所述第 i+1哈希值进行模 n运算, 得到用于 緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; The third modulo operation unit 1007 performs a modulo n operation on the (i+1)th hash value to obtain an identifier value of the i+1th router for buffering part or all of the data in the first data, where l< i<jl,i is an integer;
第三确定单元 1008, 确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。 The third determining unit 1008 determines, for each value of the i, an identifier value of the i+1th router for buffering part or all of the data in the first data.
其中, 所述等级对应关系包括所述总流行度和所述流行度等级的对应 关系, 或, 所述等级对应关系包括流行度取值区域和所述流行度等级的对 应关系, 且所述总流行度在所述流行度取值区域之内。 本发明实施例提供一种确定緩存策略的设备, 所述设备中通过统计节 点接收路由器上报的第一数据被请求的信息, 根据哈希函数、 第一数据的 元数据和第一数据的第一流行度等级计算存储所述第一数据的路由器的 标识值; 通过判决路由器从用户设备接收用于请求第一数据的报文, 根据 哈希函数计算出存储所述第一数据的路由器标识; 所述用户设备以第一数 据的元数据为函数输入值,使用哈希函数进行哈希运算,得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的请求内容緩存少 份, 避免现有技术中对所有内容都緩存或者仅緩存最新请求的内容, 从而 实现协作区域内路由器相互协作緩存, 提高路由器緩存的效率。The level correspondence includes a correspondence between the total popularity and the popularity level, or the level correspondence includes a correspondence between a popularity value area and the popularity level, and the total relationship The popularity is within the popularity value area. An embodiment of the present invention provides a device for determining a cache policy, where the device receives information requested by a first data reported by a router through a statistical node, according to a hash function, metadata of the first data, and first data. The popularity level calculates an identifier value of the router storing the first data; receiving, by the decision router, a message for requesting the first data from the user equipment, and calculating a router identifier for storing the first data according to the hash function; The user equipment inputs a value by using the metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value, so that the content of the content with a high popularity level is cached, and the content of the request with a low popularity level is cached. In the prior art, the content of the latest request is cached or only the latest requested content is cached, so that the routers in the collaboration area cooperate with each other to cache and improve the efficiency of the router cache.
实施例六 Embodiment 6
参考图 11 , 图 11是本发明实施例六提供的一种确定緩存策略的设备 结构图。 如图 11所示, 所述设备包括: Referring to FIG. 11, FIG. 11 is a structural diagram of a device for determining a cache policy according to Embodiment 6 of the present invention. As shown in FIG. 11, the device includes:
第二接收单元 1101 ,用于判决路由器从用户设备接收用于请求第一数 据的报文; a second receiving unit 1101, configured to determine, by the router, a message for requesting the first data from the user equipment;
第四运算单元 1102, 用于以所述第一数据的元数据为函数输入值,使 用哈希函数进行哈希运算, 得到第一哈希值; a fourth operation unit 1102, configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 第四模运算单元 1103 , 用于对所述第一哈希值进行模 n运算,得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。 The hash function includes: MD5, SHA1, BKDRHash, or FNVIA. a fourth modulo operation unit 1103, configured to perform a modulo n operation on the first hash value, to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the The total number of routers in the area, m ≤ n.
作为一种可选的实施例, 如图 12所示, 图 12是本发明实施例六提供 的一种确定緩存策略的设备结构图。 如图 12所示, 所述设备包括: As an alternative embodiment, as shown in FIG. 12, FIG. 12 is a structural diagram of a device for determining a cache policy according to Embodiment 6 of the present invention. As shown in FIG. 12, the device includes:
第二接收单元 1201 ,用于判决路由器从用户设备接收用于请求第一数 据的报文; a second receiving unit 1201, configured to determine, by the router, a message for requesting the first data from the user equipment;
第四运算单元 1202, 用于以所述第一数据的元数据为函数输入值,使 用哈希函数进行哈希运算, 得到第一哈希值; The fourth operation unit 1202 is configured to input a value by using the metadata of the first data as a function, and perform a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 第四模运算单元 1203 , 用于对所述第一哈希值进行模 n运算,得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。The hash function includes: MD5, SHA1, BKDRHash, or FNVIA. a fourth modulo operation unit 1203, configured to perform a modulo n operation on the first hash value, to obtain And an identifier of the first router that buffers part or all of the data in the first data, where n is the total number of routers in the area, m≤n.
第三接收单元 1204,用于接收统计节点发送的所述第一数据的第一流 行度等级; The third receiving unit 1204 is configured to receive a first level of the first level of the first data sent by the statistical node;
所述确定緩存策略的设备还包括: The device for determining a cache policy further includes:
第五运算单元 1205 ,用于当所述第一流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述 哈希函数进行哈希运算, 得到第 i+1哈希值; The fifth operation unit 1205 is configured to: when the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, j≥2, input the value by using the identifier of the i-th router as a function, and use the The hash function performs a hash operation to obtain an i+1th hash value;
第五模运算单元 1206, 用于对所述第 i+1哈希值进行模 n运算, 得到 用于緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其 中 l<i<j-l,i为整数; a fifth modulo operation unit 1206, configured to perform a modulo n operation on the (i+1)th hash value, to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l<i<jl, i is an integer;
第四确定单元 1207, 用于确定 i的每个取值对应的用于緩存所述第一 数据中的部分或全部数据的第 i+1路由器的标识值。 The fourth determining unit 1207 is configured to determine an identifier value of the i+1th router that is used to buffer part or all of the data in the first data corresponding to each value of i.
本发明实施例提供一种确定緩存策略的设备, 所述设备中通过统计节 点接收路由器上报的第一数据被请求的信息, 根据哈希函数、 第一数据的 元数据和第一数据的第一流行度等级计算存储所述第一数据的路由器的 标识值; 通过判决路由器从用户设备接收用于请求第一数据的报文, 根据 哈希函数计算出存储所述第一数据的路由器标识; 所述用户设备以第一数 据的元数据为函数输入值,使用哈希函数进行哈希运算,得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的请求内容緩存少 份, 避免现有技术中对所有内容都緩存或者仅緩存最新请求的内容, 从而 实现协作区域内路由器相互协作緩存, 提高路由器緩存的效率。 An embodiment of the present invention provides a device for determining a cache policy, where the device receives information requested by a first data reported by a router through a statistical node, according to a hash function, metadata of the first data, and first data. The popularity level calculates an identifier value of the router storing the first data; receiving, by the decision router, a message for requesting the first data from the user equipment, and calculating a router identifier for storing the first data according to the hash function; The user equipment inputs a value by using the metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value, so that the content of the content with a high popularity level is cached, and the content of the request with a low popularity level is cached. In the prior art, the content of the latest request is cached or only the latest requested content is cached, so that the routers in the collaboration area cooperate with each other to cache and improve the efficiency of the router cache.
实施例七 Example 7
参考图 13 , 图 13是本发明实施例七提供的一种确定緩存策略的设备 结构图。 如图 13所示, 所述设备包括: Referring to FIG. 13, FIG. 13 is a structural diagram of a device for determining a cache policy according to Embodiment 7 of the present invention. As shown in FIG. 13, the device includes:
第六运算单元 1301 , 用于用户设备以第一数据的元数据为函数输入 值, 使用哈希函数进行哈希运算, 得到第一哈希值; The sixth operation unit 1301 is configured to: the user equipment inputs a value by using the metadata of the first data as a function, and performs a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 第六模运算单元 1302, 用于对所述第一哈希值进行模 n运算,得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。The hash function includes: MD5, SHA1, BKDRHash, or FNVIA. a sixth modulo operation unit 1302, configured to perform a modulo n operation on the first hash value, to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the The total number of routers in the area, m ≤ n.
作为一种可选的实施例, 图 14是本发明实施例七提供的一种确定緩 存策略的设备结构图。 如图 14所示, 所述设备包括: As an alternative embodiment, FIG. 14 is a structural diagram of a device for determining a cache policy according to Embodiment 7 of the present invention. As shown in FIG. 14, the device includes:
第六运算单元 1401 , 用于用户设备以第一数据的元数据为函数输入 值, 使用哈希函数进行哈希运算, 得到第一哈希值; a sixth operation unit 1401, configured to: the user equipment inputs a value by using metadata of the first data as a function, and performs a hash operation by using a hash function to obtain a first hash value;
其中, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 第六模运算单元 1402, 用于对所述第一哈希值进行模 n运算,得到用 于緩存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为 所述区域内路由器的总数, m≤n。 The hash function includes: MD5, SHA1, BKDRHash, or FNVIA. a sixth modulo operation unit 1402, configured to perform a modulo n operation on the first hash value, to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the The total number of routers in the area, m ≤ n.
获取单元 1403 ,用于所述用户设备获取所述第一数据的最大流行度等 级; An obtaining unit 1403, configured to acquire, by the user equipment, a maximum popularity level of the first data;
所述确定緩存策略的设备还包括: The device for determining a cache policy further includes:
第七运算单元 1404,用于当所述最大流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述 哈希函数进行哈希运算, 得到第 i+1哈希值; a seventh operation unit 1404, configured to: when the absolute value of the maximum popularity level is greater than or equal to j, and j is a positive integer, j≥2, input the value by using the identifier of the i-th router as a function, and use the hash The function performs a hash operation to obtain an i+1th hash value;
第七模运算单元 1405 , 用于对所述第 i+1哈希值进行模 n运算, 得到 用于緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其 中 l≤i≤j-l,i为整数; a seventh modulo operation unit 1405, configured to perform a modulo n operation on the (i+1)th hash value, to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l ≤ i ≤ jl, i is an integer;
第五确定单元 1406, 用于确定 i的每个取值对应的用于緩存所述第一 数据中的部分或全部数据的第 i+1路由器的标识值。 The fifth determining unit 1406 is configured to determine an identifier value of the i+1th router that is used to buffer part or all of the data in the first data corresponding to each value of i.
其中, 所述用户设备可以是计算机或者手机等。 The user equipment may be a computer or a mobile phone or the like.
本发明实施例提供一种确定緩存策略的设备, 所述设备中通过统计节 点接收路由器上报的第一数据被请求的信息, 根据哈希函数、 第一数据的 元数据和第一数据的第一流行度等级计算存储所述第一数据的路由器的 标识值; 通过判决路由器从用户设备接收用于请求第一数据的报文, 根据 哈希函数计算出存储所述第一数据的路由器标识; 所述用户设备以第一数 据的元数据为函数输入值,使用哈希函数进行哈希运算,得到第一哈希值, 使得流行度等级高的请求内容緩存多份, 流行等级低的请求内容緩存少 份, 避免现有技术中对所有内容都緩存或者仅緩存最新请求的内容, 从而 实现协作区域内路由器相互协作緩存, 提高路由器緩存的效率。An embodiment of the present invention provides a device for determining a cache policy, where the device receives information requested by a first data reported by a router through a statistical node, according to a hash function, metadata of the first data, and first data. The popularity level calculates an identifier value of the router storing the first data; receiving, by the decision router, a message for requesting the first data from the user equipment, and calculating a router identifier for storing the first data according to the hash function; User equipment in the first number The metadata of the data is a function input value, and the hash function is used to perform the hash operation, and the first hash value is obtained, so that the content of the request with high popularity level is cached, and the content of the content with low popularity level is cached less, avoiding the existing one. In the technology, all the content is cached or only the latest requested content is cached, so that the routers in the collaboration area cooperate with each other to cache and improve the efficiency of the router cache.
实施例八 Example eight
参考图 15 , 图 15是本发明实施例八提供的一种统计节点的装置结构 图。 参考图 15 , 图 15是本发明实施例提供的一种统计节点 1500, 本发明 具体实施例并不对所述设备的具体实现做限定。 所述统计节点 1500包括: 处理器 (processor) 1501 , 通信接口 (Communications Interface)1502, 存 储器 (memory)1503 , 总线 1504。 Referring to FIG. 15, FIG. 15 is a structural diagram of a device for a statistical node according to Embodiment 8 of the present invention. Referring to FIG. 15, FIG. 15 is a statistic node 1500 according to an embodiment of the present invention. The specific embodiment of the present invention does not limit the specific implementation of the device. The statistical node 1500 includes: a processor 1501, a communications interface 1502, a memory 1503, and a bus 1504.
处理器 1501 , 通信接口 1502, 存储器 1503通过总线 1504完成相互 间的通信。 The processor 1501, the communication interface 1502, and the memory 1503 complete communication with each other via the bus 1504.
通信接口 1502, 用于与路由器进行通信; a communication interface 1502, configured to communicate with a router;
处理器 1501 , 用于执行程序。 The processor 1501 is configured to execute a program.
具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。 处理器 1501可能是一个中央处理器 CPU,或者是特定集成电路 ASIC ( Application Specific Integrated Circuit ) , 或者是被配置成实施本发明实 施例的一个或多个集成电路。 In particular, the program can include program code, the program code including computer operating instructions. The processor 1501 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
存储器 1503 , 用于存放程序。 存储器 1503可能包含高速 RAM存储 器, 也可能还包括非易失性存储器 ( non-volatile memory ) 。 程序具体可 以包括: The memory 1503 is used to store the program. The memory 1503 may include a high speed RAM memory and may also include a non-volatile memory. The program can specifically include:
统计节点根据接收区域内的 m个路由器分别上报的表示第一数据被 请求的信息,m≥l ;The statistical node reports the information that the first data is requested according to the m routers in the receiving area,m ≥ l;
以所述第一数据的元数据为函数输入值, 使用哈希函数进行哈希运 算, 得到第一哈希值; Inputting a value by using the metadata of the first data as a function, and performing a hash operation using a hash function to obtain a first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< η。 当第一数据的第一流行度等级的绝对值大于或等于 2时, 所述方法还 包括:Performing a modulo n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the total number of routers in the area, m< η . When the absolute value of the first popularity level of the first data is greater than or equal to 2, the method further includes:
以所述第一路由器的标识为函数输入值, 使用所述哈希函数进行哈希 运算, 得到第二哈希值; Entering a value by using the identifier of the first router as a function, and performing a hash operation using the hash function to obtain a second hash value;
对所述第二哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第二路由器的标识值。 Performing a modulo n operation on the second hash value to obtain an identification value of a second router for buffering part or all of the data in the first data.
所述 m个路由器分别上报的表示第一数据被请求的信息为所述 m个 路由器分别上报的所述第一数据的流行度, 所述方法还包括: The information indicating that the first data is requested by the m routers is the popularity of the first data reported by the m routers, and the method further includes:
根据所述 m个路由器分别上报的所述第一数据的流行度,确定所述第 一数据的总流行度; Determining a total popularity of the first data according to a popularity of the first data reported by the m routers;
根据所述第一数据的总流行度查询等级对应关系, 确定所述第一数据 的总流行度的第一流行度等级; Determining, according to the total popularity query level correspondence of the first data, a first popularity level of the total popularity of the first data;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 And determining, by each value of i, an identifier value of the i+1th router for buffering part or all of the data in the first data.
所述等级对应关系包括所述总流行度和所述流行度等级的对应关系, 或, 所述等级对应关系包括流行度取值区域和所述流行度等级的对应关 系, 且所述总流行度在所述流行度取值区域之内。 The level correspondence includes a correspondence between the total popularity and the popularity level, or the level correspondence includes a correspondence between a popularity value area and the popularity level, and the total popularity Within the popularity value area.
所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA The hash function includes: MD5, SHA1, BKDRHash or FNVIA
实施例九 Example nine
参考图 16,图 16是本发明实施例九提供的一种路由器的装置结构图。 参考图 16, 图 16是本发明实施例提供的一种路由器 1600, 本发明具体实 施例并不对所述设备的具体实现做限定。 所述路由器 1600包括: 处理器 (processor) 1601 , 通信接口 (Communications Interface) 1602, 存 储器 (memory) 1603 , 总线 1604。Referring to FIG. 16, FIG. 16 is a structural diagram of a device of a router according to Embodiment 9 of the present invention. Referring to FIG. 16, FIG. 16 is a router 1600 according to an embodiment of the present invention. The specific implementation of the device does not limit the specific implementation of the device. The router 1600 includes: A processor 1601, a communication interface 1602, a memory 1603, and a bus 1604.
处理器 1601 , 通信接口 1602, 存储器 1603通过总线 1604完成相互 间的通信。 The processor 1601, the communication interface 1602, and the memory 1603 complete communication with each other via the bus 1604.
通信接口 1602, 用于与用户设备和统计节点进行通信; a communication interface 1602, configured to communicate with a user equipment and a statistical node;
处理器 1601 , 用于执行程序。 The processor 1601 is configured to execute a program.
具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。 处理器 1601可能是一个中央处理器 CPU,或者是特定集成电路 ASIC ( Application Specific Integrated Circuit ) , 或者是被配置成实施本发明实 施例的一个或多个集成电路。 In particular, the program can include program code, the program code including computer operating instructions. The processor 1601 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
存储器 1603 , 用于存放程序。 存储器 1603可能包含高速 RAM存储 器, 也可能还包括非易失性存储器 ( non-volatile memory ) 。 程序具体可 以包括: The memory 1603 is used to store the program. Memory 1603 may include high speed RAM memory and may also include non-volatile memory. The program can specifically include:
判决路由器从用户设备接收用于请求第一数据的报文; The decision router receives a message for requesting the first data from the user equipment;
以所述第一数据的元数据为函数输入值, 使用哈希函数进行哈希运 算, 得到第一哈希值; Inputting a value by using the metadata of the first data as a function, and performing a hash operation using a hash function to obtain a first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< η。 Performing a modulo n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the total number of routers in the area, m< η .
所述方法还包括: The method further includes:
接收统计节点发送的所述第一数据的第一流行度等级; Receiving a first popularity level of the first data sent by the statistics node;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j and j is a positive integer, j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。Determining, for each value of i, for buffering some or all of the data in the first data The identity value of the i+1th router.
所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 The hash function includes: MD5, SHA1, BKDRHash or FNVIA.
实施例十 Example ten
参考图 17 , 图 17是本发明实施例十提供的一种用户设备的装置结构 图。 参考图 17 , 图 17是本发明实施例提供的一种用户设备 1700, 本发明 具体实施例并不对所述设备的具体实现做限定。 所述用户设备 1700包括: 处理器 (processor) 1701 , 通信接口(Communications Interface) 1702, 存 储器 (memory) 1703 , 总线 1704。 Referring to FIG. 17, FIG. 17 is a structural diagram of a device of a user equipment according to Embodiment 10 of the present invention. Referring to FIG. 17, FIG. 17 is a user equipment 1700 according to an embodiment of the present invention. The specific implementation of the present invention does not limit the specific implementation of the device. The user equipment 1700 includes: a processor 1701, a communications interface 1702, a memory 1703, and a bus 1704.
处理器 1701 , 通信接口 1702, 存储器 1703通过总线 1704完成相互 间的通信。 The processor 1701, the communication interface 1702, and the memory 1703 complete communication with each other via the bus 1704.
通信接口 1702, 用于与路由器进行通信; a communication interface 1702, configured to communicate with a router;
处理器 1701 , 用于执行程序。 The processor 1701 is configured to execute a program.
具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。 处理器 1701可能是一个中央处理器 CPU,或者是特定集成电路 ASIC ( Application Specific Integrated Circuit ) , 或者是被配置成实施本发明实 施例的一个或多个集成电路。 In particular, the program can include program code, the program code including computer operating instructions. The processor 1701 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
存储器 1703 , 用于存放程序。 存储器 1703可能包含高速 RAM存储 器, 也可能还包括非易失性存储器 ( non-volatile memory ) 。 程序具体可 以包括: The memory 1703 is used to store the program. The memory 1703 may include a high speed RAM memory and may also include a non-volatile memory. The program can specifically include:
用户设备以第一数据的元数据为函数输入值, 使用哈希函数进行哈希 运算, 得到第一哈希值; The user equipment inputs a value by using metadata of the first data as a function, and performs a hash operation using a hash function to obtain a first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< η。 Performing a modulo n operation on the first hash value to obtain an identifier of a first router for buffering part or all of the data in the first data, where n is the total number of routers in the area, m< η .
所述方法还包括: The method further includes:
所述用户设备获取所述第一数据的最大流行度等级; Obtaining, by the user equipment, a maximum popularity level of the first data;
当所述最大流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: 以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值;When the absolute value of the maximum popularity level is greater than or equal to j, and j is a positive integer, j≥2, the method further includes: Entering a value by using the identifier of the i-th router as a function, and performing a hash operation using the hash function to obtain an i+1th hash value;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Performing a modulo n operation on the (i+1)th hash value to obtain an identifier value of an i+1th router for buffering part or all of the data in the first data, where l≤i≤jl, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 And determining, by each value of i, an identifier value of the i+1th router for buffering part or all of the data in the first data.
以上所述仅为本发明的优选实施方式, 并不构成对本发明保护范围的 限定。 任何在本发明之内所作的任何修改、 等同替换和改进等, 均应包含 在本发明要求包含范围之内。 The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of the present invention. Any modifications, equivalent substitutions and improvements made within the scope of the invention are intended to be included within the scope of the invention.

Claims

权 利 要 求 书 claims
1、 一种确定緩存策略的方法, 其特征在于, 所述方法包括: 统计节点根据接收区域内的 m个路由器分别上报的表示第一数据被 请求的信息, m≥l ;1. A method for determining a cache strategy, characterized in that the method includes: the statistical node reports information indicating that the first data is requested based on m routers in the receiving area, m≥l;
以所述第一数据的元数据为函数输入值, 使用哈希函数进行哈希运 算, 得到第一哈希值; Using the metadata of the first data as the function input value, use a hash function to perform a hash operation to obtain the first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< η。 Perform a modulo n operation on the first hash value to obtain the identity of the first router used to cache part or all of the first data, where n is the total number of routers in the area, m<n .
2、 根据权利要求 1所述的方法, 其特征在于, 当第一数据的第一流 行度等级的绝对值大于或等于 2时, 所述方法还包括: 2. The method according to claim 1, wherein when the absolute value of the first popularity level of the first data is greater than or equal to 2, the method further includes:
以所述第一路由器的标识为函数输入值, 使用所述哈希函数进行哈希 运算, 得到第二哈希值; Taking the identification of the first router as the function input value, using the hash function to perform a hash operation to obtain a second hash value;
对所述第二哈希值进行模 η运算, 得到用于緩存所述第一数据中的部 分或全部数据的第二路由器的标识值。 Perform a modulo n operation on the second hash value to obtain the identification value of the second router used to cache part or all of the first data.
3、 根据权利要求 1所述的方法, 其特征在于, 所述 m个路由器分别 上报的表示第一数据被请求的信息为所述 m个路由器分别上报的所述第 一数据的流行度, 所述方法还包括: 3. The method according to claim 1, characterized in that, the information indicating that the first data is requested reported by the m routers respectively is the popularity of the first data reported by the m routers respectively, so The above methods also include:
根据所述 m个路由器分别上报的所述第一数据的流行度,确定所述第 一数据的总流行度; Determine the total popularity of the first data according to the popularity of the first data reported by the m routers respectively;
根据所述第一数据的总流行度查询等级对应关系, 确定所述第一数据 的总流行度的第一流行度等级; Determine the first popularity level of the total popularity of the first data according to the total popularity query level correspondence relationship of the first data;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, and j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Taking the identifier of the i-th router as the function input value, using the hash function to perform a hash operation, the i+1-th hash value is obtained;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; 确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 Perform a modulo n operation on the i+1th hash value to obtain the identification value of the i+1th router used to cache part or all of the data in the first data, where l≤i≤jl, i is an integer ; Determine the identification value of the i+1th router used to cache part or all of the first data corresponding to each value of i.
4、 根据权利要求 3所述的方法, 其特征在于, 所述等级对应关系包 括所述总流行度和所述流行度等级的对应关系, 或, 所述等级对应关系包 括流行度取值区域和所述流行度等级的对应关系, 且所述总流行度在所述 流行度取值区域之内。 4. The method according to claim 3, characterized in that, the level correspondence includes a correspondence between the total popularity and the popularity level, or, the level correspondence includes a popularity value area and The corresponding relationship between the popularity levels, and the total popularity is within the popularity value area.
5、 根据权利要求 1至 4中任一项所述的方法, 其特征在于, 所述哈 希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA 5. The method according to any one of claims 1 to 4, characterized in that the hash function includes: MD5, SHA1, BKDRHash or FNVIA
6、 一种确定緩存策略的方法, 其特征在于, 所述方法包括: 判决路由器从用户设备接收用于请求第一数据的报文; 6. A method for determining a caching policy, characterized in that the method includes: determining that the router receives a message requesting the first data from the user equipment;
以所述第一数据的元数据为函数输入值, 使用哈希函数进行哈希运 算, 得到第一哈希值; Using the metadata of the first data as the function input value, use a hash function to perform a hash operation to obtain the first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m≤ri。 Perform a modulo n operation on the first hash value to obtain the identity of the first router used to cache part or all of the data in the first data, where n is the total number of routers in the area, m≤ri .
7、 根据权利要求 6所述的方法, 其特征在于, 所述方法还包括: 接收统计节点发送的所述第一数据的第一流行度等级; 7. The method according to claim 6, wherein the method further includes: receiving the first popularity level of the first data sent by the statistics node;
当所述第一流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, and j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Taking the identification of the i-th router as the function input value, using the hash function to perform a hash operation, the i+1-th hash value is obtained;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j- l ,i为整数; Perform a modulo n operation on the i+1th hash value to obtain the identification value of the i+1th router used to cache part or all of the first data, where l≤i≤j- l,i is an integer;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 Determine the identification value of the i+1th router for caching part or all of the first data corresponding to each value of i.
8、 根据权利要求 6或 7所述的方法, 其特征在于, 所述哈希函数包 括: MD5、 SHA1、 BKDRHash或 FNVIA。 8. The method according to claim 6 or 7, characterized in that the hash function includes: MD5, SHA1, BKDRHash or FNVIA.
9、 一种确定緩存策略的方法, 其特征在于, 所述方法包括: 用户设备以第一数据的元数据为函数输入值, 使用哈希函数进行哈希 运算, 得到第一哈希值; 9. A method for determining a caching strategy, characterized in that the method includes: The user equipment uses the metadata of the first data as the function input value, uses the hash function to perform a hash operation, and obtains the first hash value;
对所述第一哈希值进行模 n运算, 得到用于緩存所述第一数据中的部 分或全部数据的第一路由器的标识, 所述 n为所述区域内路由器的总数, m< η。 Perform a modulo n operation on the first hash value to obtain the identity of the first router used to cache part or all of the first data, where n is the total number of routers in the area, m<n .
10、 根据权利要求 9所述的方法, 其特征在于, 所述方法还包括: 所述用户设备获取所述第一数据的最大流行度等级; 10. The method according to claim 9, characterized in that, the method further includes: the user equipment obtains the maximum popularity level of the first data;
当所述最大流行度等级的绝对值大于或等于 j ,且 j为正整数, j≥2时, 所述方法还包括: When the absolute value of the maximum popularity level is greater than or equal to j, and j is a positive integer, and j≥2, the method further includes:
以第 i路由器的标识为函数输入值,使用所述哈希函数进行哈希运算, 得到第 i+1哈希值; Taking the identification of the i-th router as the function input value, using the hash function to perform a hash operation, the i+1-th hash value is obtained;
对所述第 i+1哈希值进行模 n运算, 得到用于緩存所述第一数据中的 部分或全部数据的第 i+1路由器的标识值, 其中 l≤i≤j-l,i为整数; Perform a modulo n operation on the i+1th hash value to obtain the identification value of the i+1th router used to cache part or all of the data in the first data, where l≤i≤j-l, i is an integer ;
确定 i的每个取值对应的用于緩存所述第一数据中的部分或全部数据 的第 i+1路由器的标识值。 Determine the identification value of the i+1th router for caching part or all of the first data corresponding to each value of i.
11、 根据权利要求 9或 10所述的方法, 其特征在于, 所述哈希函数 包括: MD5、 SHA1、 BKDRHash或 FNVIA。 11. The method according to claim 9 or 10, characterized in that the hash function includes: MD5, SHA1, BKDRHash or FNVIA.
12、 一种确定緩存策略的设备, 其特征在于, 所述确定緩存策略的设 备包括: 12. A device for determining a cache policy, characterized in that the device for determining a cache policy includes:
第一接收单元,用于根据接收区域内的 m个路由器分别上报的表示第 一数据被请求的信息, m≥l ; The first receiving unit is used to receive information indicating that the first data is requested according to the information reported by m routers in the area, m≥l;
第一运算单元, 用于以所述第一数据的元数据为函数输入值, 使用哈 希函数进行哈希运算, 得到第一哈希值; The first operation unit is configured to use the metadata of the first data as a function input value, use a hash function to perform a hash operation, and obtain the first hash value;
第一模运算单元, 用于对所述第一哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为所述 区域内路由器的总数, m≤n。 A first modular operation unit, configured to perform a modulo n operation on the first hash value to obtain the identity of the first router used to cache part or all of the first data, where n is the area. The total number of internal routers, m≤n.
13、 根据权利要求 12所述的确定緩存策略的设备, 其特征在于, 所 述确定緩存策略的设备还包括: 第二运算单元, 用于当第一数据的第一流行度等级的绝对值大于或等 于 2时, 以所述第一路由器的标识为函数输入值, 使用所述哈希函数进行 哈希运算, 得到第二哈希值; 13. The device for determining a cache policy according to claim 12, wherein the device for determining a cache policy further includes: The second operation unit is configured to use the hash function to perform a hash operation using the identifier of the first router as the function input value when the absolute value of the first popularity level of the first data is greater than or equal to 2, Get the second hash value;
第二模运算单元, 用于对所述第二哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第二路由器的标识值。 The second modular operation unit is configured to perform a modulo n operation on the second hash value to obtain the identification value of the second router used to cache part or all of the first data.
14、 根据权利要求 12所述的确定緩存策略的设备, 所述 m个路由器 分别上报的表示第一数据被请求的信息为所述 m个路由器分别上报的所 述第一数据的流行度, 所述确定緩存策略的设备还包括: 14. The device for determining a cache policy according to claim 12, the information indicating that the first data is requested reported by the m routers respectively is the popularity of the first data reported by the m routers respectively, so The above-mentioned devices for determining caching policies also include:
第一确定单元,用于根据所述 m个路由器分别上报的所述第一数据的 流行度, 确定所述第一数据的总流行度; A first determination unit configured to determine the total popularity of the first data based on the popularity of the first data reported by the m routers respectively;
第二确定单元, 用于根据所述第一数据的总流行度查询等级对应关 系, 确定所述第一数据的总流行度的第一流行度等级; The second determination unit is configured to query the level correspondence relationship according to the total popularity of the first data, and determine the first popularity level of the total popularity of the first data;
所述确定緩存策略的设备还包括: The device for determining the cache policy also includes:
第三运算单元, 用于当所述第一流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述哈 希函数进行哈希运算, 得到第 i+1哈希值; The third operation unit is used to use the identity of the i-th router as the function input value when the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, j≥2, and uses the hash The function performs a hash operation and obtains the i+1th hash value;
第三模运算单元, 用于对所述第 i+1哈希值进行模 n运算, 得到用于 緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; The third modular operation unit is used to perform a modulo n operation on the i+1th hash value to obtain the identification value of the i+1th router used to cache part or all of the first data, where l <i<j-l, i is an integer;
第三确定单元, 用于确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。 The third determination unit is used to determine the identification value of the i+1th router for caching part or all of the first data corresponding to each value of i.
15、 根据权利要求 14所述的确定緩存策略的设备, 其特征在于, 所 述等级对应关系包括所述总流行度和所述流行度等级的对应关系, 或, 所 述等级对应关系包括流行度取值区域和所述流行度等级的对应关系, 且所 述总流行度在所述流行度取值区域之内。 15. The device for determining a cache policy according to claim 14, wherein the level correspondence includes a correspondence between the total popularity and the popularity level, or, the level correspondence includes a popularity The corresponding relationship between the value area and the popularity level, and the total popularity is within the popularity value area.
16、 根据权利要求 12至 15中任一项所述的确定緩存策略的设备, 其 特征在于, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA 16. The device for determining a cache policy according to any one of claims 12 to 15, characterized in that the hash function includes: MD5, SHA1, BKDRHash or FNVIA
17、 一种确定緩存策略的设备, 其特征在于, 所述确定緩存策略的设 备包括:17. A device for determining a cache policy, characterized in that: the device for determining a cache policy Equipment includes:
第二接收单元, 用于从用户设备接收用于请求第一数据的报文; 第四运算单元, 用于以所述第一数据的元数据为函数输入值, 使用哈 希函数进行哈希运算, 得到第一哈希值; The second receiving unit is used to receive a message for requesting the first data from the user equipment; the fourth operation unit is used to use the metadata of the first data as a function input value and use a hash function to perform a hash operation. , get the first hash value;
第四模运算单元, 用于对所述第一哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为所述 区域内路由器的总数, m≤n。 The fourth modular operation unit is used to perform a modulo n operation on the first hash value to obtain the identity of the first router used to cache part or all of the data in the first data, where n is the area. The total number of internal routers, m≤n.
18、 根据权利要求 17所述的确定緩存策略的设备, 其特征在于, 所 述确定緩存策略的设备还包括: 18. The device for determining a cache policy according to claim 17, wherein the device for determining a cache policy further includes:
第三接收单元, 用于接收统计节点发送的所述第一数据的第一流行度 等级; The third receiving unit is configured to receive the first popularity level of the first data sent by the statistics node;
所述确定緩存策略的设备还包括: The device for determining the cache policy also includes:
第五运算单元, 用于当所述第一流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述哈 希函数进行哈希运算, 得到第 i+1哈希值; The fifth operating unit is used to use the identity of the i-th router as the function input value when the absolute value of the first popularity level is greater than or equal to j, and j is a positive integer, j≥2, and uses the hash The function performs a hash operation and obtains the i+1th hash value;
第五模运算单元, 用于对所述第 i+1哈希值进行模 n运算, 得到用于 緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; The fifth modular operation unit is used to perform a modulo n operation on the i+1th hash value to obtain the identification value of the i+1th router used to cache part or all of the data in the first data, where l <i<j-l, i is an integer;
第四确定单元, 用于确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。 The fourth determination unit is used to determine the identification value of the i+1th router for caching part or all of the first data corresponding to each value of i.
19、根据权利要求 17或 18所述的确定緩存策略的设备,其特征在于, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 19. The device for determining a cache policy according to claim 17 or 18, wherein the hash function includes: MD5, SHA1, BKDRHash or FNVIA.
20、 一种确定緩存策略的设备, 其特征在于, 所述确定緩存策略的设 备包括: 20. A device for determining a cache policy, characterized in that the device for determining a cache policy includes:
第六运算单元, 用于以第一数据的元数据为函数输入值, 使用哈希函 数进行哈希运算, 得到第一哈希值; The sixth operation unit is used to use the metadata of the first data as the function input value, use the hash function to perform a hash operation, and obtain the first hash value;
第六模运算单元, 用于对所述第一哈希值进行模 n运算, 得到用于緩 存所述第一数据中的部分或全部数据的第一路由器的标识, 所述 n为所述 区域内路由器的总数, m≤n。 The sixth modular operation unit is used to perform a modulo n operation on the first hash value to obtain the identity of the first router used to cache part or all of the first data, where n is the The total number of routers in the area, m≤n.
21、 根据权利要求 20所述的确定緩存策略的设备, 其特征在于, 所 述确定緩存策略的设备还包括: 21. The device for determining a cache policy according to claim 20, characterized in that the device for determining a cache policy further includes:
获取单元, 用于获取所述第一数据的最大流行度等级; An acquisition unit, configured to acquire the maximum popularity level of the first data;
所述确定緩存策略的设备还包括: The device for determining the cache policy also includes:
第七运算单元, 用于当所述最大流行度等级的绝对值大于或等于 j , 且 j为正整数, j≥2时, 以第 i路由器的标识为函数输入值, 使用所述哈 希函数进行哈希运算, 得到第 i+1哈希值; The seventh operation unit is used to use the hash function using the identifier of the i-th router as the function input value when the absolute value of the maximum popularity level is greater than or equal to j, and j is a positive integer, j≥2. Perform a hash operation to obtain the i+1th hash value;
第七模运算单元, 用于对所述第 i+1哈希值进行模 n运算, 得到用于 緩存所述第一数据中的部分或全部数据的第 i+1路由器的标识值, 其中 l<i<j-l,i为整数; The seventh modular operation unit is used to perform a modulo n operation on the i+1th hash value to obtain the identification value of the i+1th router used to cache part or all of the first data, where l <i<j-l, i is an integer;
第五确定单元, 用于确定 i的每个取值对应的用于緩存所述第一数据 中的部分或全部数据的第 i+1路由器的标识值。 The fifth determination unit is used to determine the identification value of the i+1th router for caching part or all of the first data corresponding to each value of i.
22、根据权利要求 20或 21所述的确定緩存策略的设备,其特征在于, 所述哈希函数包括: MD5、 SHA1、 BKDRHash或 FNVIA。 22. The device for determining a cache policy according to claim 20 or 21, wherein the hash function includes: MD5, SHA1, BKDRHash or FNVIA.
PCT/CN2013/0911852012-12-312013-12-31Method and device for determining caching policyWO2014101894A1 (en)

Applications Claiming Priority (2)

Application NumberPriority DateFiling DateTitle
CN201210590587.72012-12-31
CN201210590587.7ACN103905332B (en)2012-12-312012-12-31A kind of method and apparatus for determining cache policy

Publications (1)

Publication NumberPublication Date
WO2014101894A1true WO2014101894A1 (en)2014-07-03

Family

ID=50996487

Family Applications (1)

Application NumberTitlePriority DateFiling Date
PCT/CN2013/091185WO2014101894A1 (en)2012-12-312013-12-31Method and device for determining caching policy

Country Status (2)

CountryLink
CN (1)CN103905332B (en)
WO (1)WO2014101894A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107911799A (en)*2017-05-182018-04-13北京聚通达科技股份有限公司A kind of method using Intelligent routing
CN110837499A (en)*2018-08-162020-02-25阿里巴巴集团控股有限公司Data access processing method and device, electronic equipment and storage medium
CN113726830A (en)*2020-05-252021-11-30网联清算有限公司Message identifier generation method and device

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106162218B (en)*2015-04-032020-11-06中兴通讯股份有限公司Program recording control method, system and management and popularity statistical server
CN106997351B (en)2016-01-222021-03-02斑马智行网络(香港)有限公司 A resource cache management method, system and device
CN108076350A (en)*2016-11-142018-05-25中国科学院声学研究所A kind of video service system and method based on router collaboration caching
CN106790421B (en)*2016-12-012020-11-24广东技术师范大学 A community-based two-step caching method for ICN
CN107733998B (en)*2017-09-222020-03-27北京邮电大学Cache content placing and providing method of cellular heterogeneous hierarchical network
CN115242817B (en)*2022-07-212023-10-24阿里巴巴(中国)有限公司Data access processing method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101247349A (en)*2008-03-132008-08-20华耀环宇科技(北京)有限公司Network flux fast distribution method
CN102402394A (en)*2010-09-132012-04-04腾讯科技(深圳)有限公司Data storage method and device based on Hash algorithm
CN102523256A (en)*2011-11-302012-06-27华为技术有限公司Content management method, device and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6341311B1 (en)*1998-05-292002-01-22Microsoft CorporationDirecting data object access requests in a distributed cache
US6754662B1 (en)*2000-08-012004-06-22Nortel Networks LimitedMethod and apparatus for fast and consistent packet classification via efficient hash-caching

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101247349A (en)*2008-03-132008-08-20华耀环宇科技(北京)有限公司Network flux fast distribution method
CN102402394A (en)*2010-09-132012-04-04腾讯科技(深圳)有限公司Data storage method and device based on Hash algorithm
CN102523256A (en)*2011-11-302012-06-27华为技术有限公司Content management method, device and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107911799A (en)*2017-05-182018-04-13北京聚通达科技股份有限公司A kind of method using Intelligent routing
CN107911799B (en)*2017-05-182021-03-23北京聚通达科技股份有限公司Method for utilizing intelligent route
CN110837499A (en)*2018-08-162020-02-25阿里巴巴集团控股有限公司Data access processing method and device, electronic equipment and storage medium
CN110837499B (en)*2018-08-162023-08-22阿里巴巴集团控股有限公司Data access processing method, device, electronic equipment and storage medium
CN113726830A (en)*2020-05-252021-11-30网联清算有限公司Message identifier generation method and device
CN113726830B (en)*2020-05-252023-09-12网联清算有限公司Message identifier generation method and device

Also Published As

Publication numberPublication date
CN103905332A (en)2014-07-02
CN103905332B (en)2017-06-09

Similar Documents

PublicationPublication DateTitle
WO2014101894A1 (en)Method and device for determining caching policy
US10666756B2 (en)Request management for hierarchical cache
CN113348658B (en) Efficient and flexible load balancing of cache clusters under latency constraints
CN105357246B (en)Caching method based on information centre&#39;s network and system
CN107404530B (en) Method and device for social network collaborative caching based on user interest similarity
WO2022068333A1 (en)Access request processing method and apparatus, electronic device, and computer-readable storage medium
CN109905480B (en)Probabilistic cache content placement method based on content centrality
CN105049254B (en)Data buffer storage replacement method based on content rating and popularity in a kind of NDN/CCN
CN111314224B (en) A Named Data Web Cache Method
CN105681438B (en) A Centralized Content-Centric Network Cache Decision-Making Method
WO2013155979A1 (en)Method and device for processing content routing
Yu et al.A caching strategy based on content popularity and router level for NDN
CN106533733A (en)CCN collaborative cache method and device based on network clustering and Hash routing
CN105357281A (en)Distributed content cache access control method and system for mobile access network
CN107276788B (en)Communication model construction method with cache base station based on sleep control
WO2011131042A1 (en)Method and apparatus for storing, searching index information
CN106899692A (en)A kind of content center network node data buffer replacing method and device
Serhane et al.CnS: A cache and split scheme for 5G-enabled ICN networks
CN110012071A (en)Caching method and device for Internet of Things
Liu et al.A novel cache replacement scheme against cache pollution attack in content-centric networks
WO2020007073A1 (en)Content caching method in information center network virtualization
US20130198330A1 (en)Cooperative catching method and apparatus for mobile communication system
CN106572168A (en)Content value caching-based content center network collaborative caching method and system
Li et al.Coordinated enroute multimedia object caching in transcoding proxies for tree networks
CN108351873B (en) A cache management method and device

Legal Events

DateCodeTitleDescription
121Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number:13868728

Country of ref document:EP

Kind code of ref document:A1

NENPNon-entry into the national phase

Ref country code:DE

122Ep: pct application non-entry in european phase

Ref document number:13868728

Country of ref document:EP

Kind code of ref document:A1


[8]ページ先頭

©2009-2025 Movatter.jp