


技术领域technical field
本发明涉及网络通信领域,特别涉及一种CDN访问优化方法及系统。The invention relates to the field of network communication, in particular to a CDN access optimization method and system.
背景技术Background technique
内容分发网络(Content Delivery Network,简称CDN)分发的内容包括静态资源和动态资源。对于静态资源,CDN一般是设置一个固定的缓存周期,根据缓存周期来更新静态资源;对于动态资源,CDN一般是通过一个设置好的访问路径来不停地访问源站服务器来获取动态资源。Content distributed by a Content Delivery Network (CDN for short) includes static resources and dynamic resources. For static resources, CDN generally sets a fixed cache period and updates static resources according to the cache period; for dynamic resources, CDN generally uses a set access path to continuously access the origin server to obtain dynamic resources.
然而,对于静态资源而言,若CDN设置的缓存周期过长,就容易导致静态资源得不到及时的更新;若CDN设置的缓存周期过短,则CDN需要频繁访问源站服务器,加大源站服务器的压力。对于动态资源而言,若设置的访问路径中某一CDN节点的负载较高,则会造成时延较长,影响用户访问的实时性要求。However, for static resources, if the cache period set by the CDN is too long, it is easy to cause the static resources to not be updated in time; if the cache period set by the CDN is too short, the CDN needs to visit the origin server frequently, increasing the pressure on the server. For dynamic resources, if the load of a certain CDN node in the set access path is high, it will cause a long delay and affect the real-time requirements of user access.
综上所述,目前CDN访问的效率较低。To sum up, the current CDN access efficiency is low.
发明内容SUMMARY OF THE INVENTION
本发明实施方式的目的在于提供一种CDN访问优化方法及系统,使得CDN访问的效率提高。The purpose of the embodiments of the present invention is to provide a CDN access optimization method and system, so as to improve the efficiency of CDN access.
为解决上述技术问题,本发明的实施方式提供了一种CDN访问优化方法,包括以下步骤:获取CDN节点缓存的资源类型、所述CDN节点的缓存命中率、所述CDN节点的负载参数和源站服务器的负载参数;若所述资源类型为静态资源,则根据所述CDN节点的缓存命中率和所述源站服务器的负载参数确定缓存周期,以使所述CDN节点根据所述缓存周期缓存静态资源;若所述资源类型为动态资源,则根据所述CDN节点的负载参数确定访问路径,以使所述CDN节点根据所述访问路径访问动态资源。In order to solve the above technical problems, embodiments of the present invention provide a CDN access optimization method, which includes the following steps: obtaining the resource type cached by the CDN node, the cache hit rate of the CDN node, the load parameter and source of the CDN node. The load parameter of the origin server; if the resource type is a static resource, the cache cycle is determined according to the cache hit rate of the CDN node and the load parameter of the origin server, so that the CDN node caches according to the cache cycle Static resources; if the resource type is a dynamic resource, an access path is determined according to the load parameter of the CDN node, so that the CDN node accesses the dynamic resource according to the access path.
本发明的实施方式还提供一种CDN访问优化系统,包括源站服务器、信息管理平台和CDN节点;所述信息管理平台用于:获取所述CDN节点缓存的资源类型、所述CDN节点的缓存命中率、所述CDN节点的负载参数和所述源站服务器的负载参数;若所述资源类型为静态资源类型,则根据所述CDN节点的缓存命中率和所述源站服务器的负载参数确定缓存周期,以使所述CDN节点根据所述缓存周期缓存静态资源;若所述资源类型为动态资源类型,则根据所述CDN节点的负载参数确定访问路径,以使所述CDN节点根据所述访问路径访问动态资源。Embodiments of the present invention also provide a CDN access optimization system, including an origin server, an information management platform, and a CDN node; the information management platform is used for: acquiring the resource type cached by the CDN node, the cache of the CDN node Hit rate, the load parameter of the CDN node and the load parameter of the origin server; if the resource type is a static resource type, it is determined according to the cache hit rate of the CDN node and the load parameter of the origin server cache period, so that the CDN node caches static resources according to the cache period; if the resource type is a dynamic resource type, the access path is determined according to the load parameter of the CDN node, so that the CDN node can cache the static resources according to the Access paths to access dynamic resources.
本发明实施方式相对于现有技术而言,对于静态资源,根据CDN节点的缓存命中率和源站服务器的负载参数来动态调整缓存周期,使确定的缓存周期更加符合CDN节点的缓存命中的情况和源站服务器的负载情况,既不会使CDN节点缓存周期过长导致更新不及时,也不会使CDN节点缓存周期过短源站服务器压力过大;对于动态资源,则根据CDN节点的负载参数来确定访问路径,由于传统的方法是根据相对固定的访问路径来访问和传输动态资源,当访问路径中存在负载较高的CDN节点时,就容易造成访问的时延变长,因此,根据CDN节点的负载参数来动态调整访问路径,可以使确定的访问路径更加符合CDN节点的负载情况,避免了因为访问路径中某个CDN节点的负载过高造成的访问时延变长的情况,提高访问的时效性。通过对CDN节点的静态资源和动态资源访问进行优化,提高了CDN访问的效率。Compared with the prior art, the embodiment of the present invention dynamically adjusts the cache period according to the cache hit rate of the CDN node and the load parameter of the origin server for static resources, so that the determined cache period is more in line with the cache hit of the CDN node. Depending on the load of the origin server, it will neither make the CDN node cache cycle too long to cause untimely updates, nor will the CDN node cache cycle be too short, and the origin server will be under too much pressure; for dynamic resources, it will be determined according to the load of the CDN node parameters to determine the access path. Since the traditional method is to access and transmit dynamic resources according to a relatively fixed access path, when there are CDN nodes with high load in the access path, it is easy to cause the access delay to become longer. Therefore, according to Dynamically adjust the access path based on the load parameters of the CDN node, which can make the determined access path more in line with the load of the CDN node, avoid the long access delay caused by the high load of a CDN node in the access path, and improve the Timeliness of access. By optimizing the static resource and dynamic resource access of CDN nodes, the efficiency of CDN access is improved.
另外,所述根据所述CDN节点的缓存命中率和所述源站服务器的负载参数确定缓存周期,包括:根据所述CDN节点的缓存命中率和所述源站服务器的负载参数计算CDN服务评分;根据所述CDN服务评分确定缓存周期。In addition, the determining the cache period according to the cache hit ratio of the CDN node and the load parameter of the origin server includes: calculating the CDN service score according to the cache hit ratio of the CDN node and the load parameter of the origin server ; Determine the cache period according to the CDN service score.
另外,所述根据所述CDN节点的缓存命中率和所述源站服务器的负载参数计算CDN服务评分,具体为:根据第一计算公式计算CDN服务评分:K=α*I-β*J;其中,K为所述CDN服务评分,I为所述源站服务器的负载参数,所述I与所述源站服务器的负载成反比,J为所述CDN节点的缓存命中率,所述J与所述CDN节点的缓存命中率成正比,α和β为预设的权重系数。In addition, calculating the CDN service score according to the cache hit rate of the CDN node and the load parameter of the origin server is specifically: calculating the CDN service score according to the first calculation formula: K=α*I-β*J; Among them, K is the CDN service score, I is the load parameter of the origin server, the I is inversely proportional to the load of the origin server, J is the cache hit rate of the CDN node, and J is the same as the The cache hit rate of the CDN node is proportional, and α and β are preset weight coefficients.
另外,所述根据所述CDN服务评分确定缓存周期,包括:若所述CDN服务评分大于第一阈值,则根据第二计算公式确定缓存周期:Tn+1=Tn-ΔT;其中,Tn+1为第n+1个周期的缓存周期,所述Tn为第n个周期的缓存周期,ΔT为预设时间变量值;若所述CDN服务评分小于第二阈值,则根据第三计算公式确定缓存周期:Tn+1=Tn+ΔT;若所述CDN服务评分大于或等于第二阈值且小于或等于第一阈值,则确定缓存周期为:Tn+1=Tn。In addition, the determining the cache period according to the CDN service score includes: if the CDN service score is greater than the first threshold, determining the cache period according to a second calculation formula: Tn+1 =Tn -ΔT; wherein Tn+1 is the cache cycle of the n+1th cycle, the Tn is the cache cycle of the nth cycle, and ΔT is a preset time variable value; if the CDN service score is less than the second threshold, the third The calculation formula determines the cache period: Tn+1 =Tn +ΔT; if the CDN service score is greater than or equal to the second threshold and less than or equal to the first threshold, the cache period is determined as: Tn+1 =Tn .
另外,所述CDN节点为N个,所述N为大于1的自然数;在所述根据所述CDN节点的负载参数确定访问路径之前,还包括:通过VPN方式建立N个所述CDN节点之间的连接。通过VPN方式建立N个CDN节点之间的连接,相当于在CDN节点之间建立起分隔的专用通道,可以使CDN节点在对动态资源进行数据透传时,提高传输的速度,同时也提高传输数据的安全性。In addition, the number of the CDN nodes is N, and the N is a natural number greater than 1; before determining the access path according to the load parameter of the CDN node, the method further includes: establishing a VPN between the N CDN nodes Connection. Establishing connections between N CDN nodes through VPN is equivalent to establishing separate dedicated channels between CDN nodes, which enables CDN nodes to transparently transmit data to dynamic resources, improve the transmission speed, and also improve the transmission speed. Data security.
另外,所述信息管理平台还用于:根据所述CDN节点的缓存命中率和所述源站服务器的负载参数计算CDN服务评分;根据所述CDN服务评分确定缓存周期。In addition, the information management platform is further configured to: calculate the CDN service score according to the cache hit rate of the CDN node and the load parameter of the origin server; and determine the cache period according to the CDN service score.
另外,所述信息管理平台还用于:根据以下第一计算公式计算CDN服务评分:K=α*I-β*J;其中,K为所述CDN服务评分,I为所述源站服务器的负载参数,所述I与所述源站服务器的负载成反比,J为所述CDN节点的缓存命中率,所述J与所述CDN节点的缓存命中率成正比,α和β为预设的权重系数。In addition, the information management platform is further configured to: calculate the CDN service score according to the following first calculation formula: K=α*I-β*J; wherein, K is the CDN service score, and I is the origin server’s Load parameter, the I is inversely proportional to the load of the origin server, J is the cache hit rate of the CDN node, the J is proportional to the cache hit rate of the CDN node, α and β are preset weight factor.
另外,所述信息管理平台还用于:若所述CDN服务评分大于第一阈值,则根据第二计算公式确定缓存周期:Tn+1=Tn-ΔT;其中,Tn+1为第n+1个周期的缓存周期,所述Tn为第n个周期的缓存周期,ΔT为预设时间变量值;若所述CDN服务评分小于第二阈值,则根据第三计算公式确定缓存周期:Tn+1=Tn+ΔT;若所述CDN服务评分大于或等于第二阈值且小于或等于第一阈值,则确定缓存周期为:Tn+1=TnIn addition, the information management platform is further configured to: if the CDN service score is greater than the first threshold, determine the cache period according to the second calculation formula: Tn+1 =Tn -ΔT; where Tn+1 is the first A cache period of n+1 periods, the Tn is the cache period of the nth period, and ΔT is a preset time variable value; if the CDN service score is less than the second threshold, the cache period is determined according to the third calculation formula : Tn+1 =Tn +ΔT; if the CDN service score is greater than or equal to the second threshold and less than or equal to the first threshold, the cache period is determined as: Tn+1 =Tn
另外,所述CDN节点为N个,所述N为大于1的自然数;所述信息管理平台还用于:通过VPN方式建立N个所述CDN节点之间的连接。In addition, the number of the CDN nodes is N, and the N is a natural number greater than 1; the information management platform is further configured to: establish a connection between the N CDN nodes by means of a VPN.
附图说明Description of drawings
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments.
图1是本发明第一实施方式提供的CDN访问优化方法的流程示意图;1 is a schematic flowchart of a CDN access optimization method provided by a first embodiment of the present invention;
图2是本发明第一实施方式提供的CDN访问优化方法中S102细化步骤的流程示意图;2 is a schematic flowchart of the refinement step S102 in the CDN access optimization method provided by the first embodiment of the present invention;
图3是本发明第一实施方式提供的CDN访问优化方法中S1022细化步骤的流程示意图;3 is a schematic flowchart of the refinement step S1022 in the CDN access optimization method provided by the first embodiment of the present invention;
图4是本发明第二实施方式提供的CDN访问优化系统的结构示意图。FIG. 4 is a schematic structural diagram of a CDN access optimization system provided by a second embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本发明各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the objectives, technical solutions and advantages of the present invention clearer, each embodiment of the present invention will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can appreciate that, in the various embodiments of the present invention, many technical details are set forth in order for the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be realized.
本发明的第一实施方式涉及一种CDN访问优化方法,通过获取CDN节点缓存的资源类型、CDN节点的缓存命中率、CDN节点的负载参数和源站服务器的负载参数;若资源类型为静态资源,则根据CDN节点的缓存命中率和源站服务器的负载参数确定缓存周期,以使CDN节点根据缓存周期缓存静态资源;若资源类型为动态资源,则根据CDN节点的负载参数确定访问路径,以使CDN节点根据访问路径访问动态资源。对于静态资源,根据CDN节点的缓存命中率和源站服务器的负载参数来重新计算确定缓存周期,使缓存周期更加符合CDN节点的缓存命中的情况和源站服务器的负载情况,既不会使CDN节点缓存周期过长导致更新不及时,也不会使CDN节点缓存周期过短源站服务器压力过大;对于动态资源,则根据CDN节点的负载参数来确定访问路径,使确定的访问路径更加符合CDN节点的负载情况,能更快速地进行访问并获取资源,提高访问的时效性。通过对CDN节点的静态资源和动态资源访问进行优化,提高了CDN访问的效率。The first embodiment of the present invention relates to a CDN access optimization method, by obtaining the resource type cached by the CDN node, the cache hit rate of the CDN node, the load parameter of the CDN node and the load parameter of the origin server; if the resource type is a static resource , the cache cycle is determined according to the cache hit rate of the CDN node and the load parameter of the origin server, so that the CDN node caches static resources according to the cache cycle; if the resource type is dynamic resource, the access path is determined according to the load parameter of the CDN node to Enable CDN nodes to access dynamic resources according to the access path. For static resources, the cache cycle is recalculated and determined according to the cache hit rate of the CDN node and the load parameters of the origin server, so that the cache cycle is more in line with the cache hit of the CDN node and the load of the origin server. The node cache period is too long and the update is not timely, and the CDN node cache period is too short, and the pressure on the origin server is too large; for dynamic resources, the access path is determined according to the load parameters of the CDN node, so that the determined access path is more in line with The load situation of CDN nodes can access and obtain resources more quickly, and improve the timeliness of access. By optimizing the static resource and dynamic resource access of CDN nodes, the efficiency of CDN access is improved.
应当说明的是,本发明实施方式的实施主体可以为与CDN节点相连的服务端,其中,服务端可以通过独立的服务器或者多个服务器组成的服务器集群来实现,以下以服务端为例进行说明。It should be noted that the implementation subject of the embodiment of the present invention may be a server connected to a CDN node, wherein the server may be implemented by an independent server or a server cluster composed of multiple servers. The following will take the server as an example for description. .
本发明实施方式提供的CDN访问优化方法的具体流程如图1所示,具体包括以下步骤:The specific process of the CDN access optimization method provided by the embodiment of the present invention is shown in FIG. 1 , and specifically includes the following steps:
S101:获取CDN节点缓存的资源类型、CDN节点的缓存命中率、CDN节点的负载参数和源站服务器的负载参数。S101: Acquire the resource type cached by the CDN node, the cache hit rate of the CDN node, the load parameter of the CDN node, and the load parameter of the origin server.
其中,CDN节点缓存的资源类型分为静态资源和动态资源。CDN节点的缓存命中率是指用户访问网络资源节点时,命中CDN缓存的概率。CDN节点的负载参数可以包括CDN节点的内存使用率、CPU占用率和用户并发数等参数,这里不做具体限制。源站服务器的负载参数可以包括源站服务器的内存使用率、CPU占用率和用户并发数等参数,这里也不做具体限制。Among them, the types of resources cached by CDN nodes are classified into static resources and dynamic resources. The cache hit rate of a CDN node refers to the probability of hitting the CDN cache when a user accesses a network resource node. The load parameters of the CDN node can include parameters such as the memory usage, CPU usage, and number of concurrent users of the CDN node, which are not specifically limited here. The load parameters of the origin server can include parameters such as the memory usage, CPU usage, and number of concurrent users of the origin server, which are not specifically limited here.
可选地,CDN节点的缓存命中率可以根据对CDN日志进行分析统计得到,也可以为其它的获取方法,这里不做具体限制。Optionally, the cache hit rate of the CDN node may be obtained by analyzing and statistic on the CDN log, or may be obtained by other methods, which are not specifically limited here.
可选地,源站服务器可以设置代理,通过代理将源站服务器的负载参数发送至服务端,服务端即可获取到源站服务器的负载参数;也可以是服务端直接从源站服务器获取源站服务器的负载参数。Optionally, the origin server can set up a proxy to send the load parameters of the origin server to the server through the proxy, and the server can obtain the load parameters of the origin server; or the server can obtain the source directly from the origin server. Load parameters of the station server.
S102:若资源类型为静态资源,则根据CDN节点的缓存命中率和源站服务器的负载参数确定缓存周期,以使CDN节点根据缓存周期缓存静态资源。S102: If the resource type is a static resource, determine the cache period according to the cache hit rate of the CDN node and the load parameter of the origin server, so that the CDN node caches the static resource according to the cache period.
其中,缓存周期是指CDN节点更新缓存资源的时间,即两次更新缓存资源的时间间隔。The cache period refers to the time when the CDN node updates the cache resources, that is, the time interval between two updates of the cache resources.
可选地,服务端可根据静态资源和动态资源的文件类型来判断资源类型。Optionally, the server may determine the resource type according to the file types of the static resource and the dynamic resource.
在一个具体的例子中,根据CDN节点的缓存命中率和源站服务器的负载参数确定缓存周期,如图2所示,具体可以包括以下步骤:In a specific example, the cache period is determined according to the cache hit rate of the CDN node and the load parameter of the origin server, as shown in Figure 2, which may specifically include the following steps:
S1021:根据CDN节点的缓存命中率和源站服务器的负载参数计算CDN服务评分。S1021: Calculate the CDN service score according to the cache hit rate of the CDN node and the load parameter of the origin server.
S1022:根据CDN服务评分确定缓存周期。S1022: Determine the cache period according to the CDN service score.
具体地,当CDN节点的缓存命中率较低时,说明原来的缓存周期过长,需要缩短缓存周期;当CDN节点的缓存命中率较高时,说明原来的缓存周期可能是合适的,也可能是过短的,需要结合源站服务器的负载参数来确定。当源站服务器的负载较高时,说明原来的缓存周期过短,需要缩短缓存周期;当源站服务器的负载较低时,说明原来的缓存周期可能是合适的,也可能是过长的,需要结合CDN节点的缓存命中率来确定。因此,服务端可以设置当CDN节点的缓存命中率较低时,对应较低的评分;当CDN节点的缓存命中率较高时,对应较高的评分;当源站服务器的负载较高时,对应较高的评分;当源站服务器的负载较低时,对应较低的评分;并且设置当总体评分低于第一预设值,使用一个较小的系数,例如80%,乘以原来的缓存周期来确定缓存周期;当总体评分高于第二预设值时,使用一个较大的系数,例如120%,乘以原来的缓存周期来确定缓存周期。其中,原来的缓存周期可以根据经验值给出。Specifically, when the cache hit rate of the CDN node is low, it indicates that the original cache period is too long, and the cache period needs to be shortened; when the cache hit rate of the CDN node is high, it indicates that the original cache period may be appropriate or may It is too short and needs to be determined in combination with the load parameters of the origin server. When the load of the origin server is high, it means that the original cache period is too short and the cache period needs to be shortened; when the load of the origin server is low, it means that the original cache period may be appropriate or too long. It needs to be determined in combination with the cache hit rate of the CDN node. Therefore, the server can set a lower score when the cache hit rate of the CDN node is low; when the cache hit rate of the CDN node is high, the corresponding score is higher; when the load of the origin server is high, the corresponding score is higher. Corresponds to a higher score; when the load of the origin server is low, corresponds to a lower score; and set when the overall score is lower than the first preset value, use a smaller coefficient, such as 80%, multiplied by the original The cache cycle is determined by the cache cycle; when the overall score is higher than the second preset value, a larger coefficient, such as 120%, is used to multiply the original cache cycle to determine the cache cycle. Among them, the original cache period can be given according to the empirical value.
可选地,可以根据以下第一计算公式计算CDN服务评分:Optionally, the CDN service score can be calculated according to the following first calculation formula:
K=α*I-β*J;K=α*I-β*J;
其中,K为所述CDN服务评分,I为所述源站服务器的负载参数,所述I与所述源站服务器的负载成反比,J为所述CDN节点的缓存命中率,所述J与所述CDN节点的缓存命中率成正比,α和β为预设的权重系数。Among them, K is the CDN service score, I is the load parameter of the origin server, the I is inversely proportional to the load of the origin server, J is the cache hit rate of the CDN node, and J is the same as the The cache hit rate of the CDN node is proportional, and α and β are preset weight coefficients.
在一个具体的例子中,当以第一计算公式计算CDN服务评分,S1022中,根据CDN服务评分确定缓存周期,如图3所示,可以包括以下步骤:In a specific example, when the first calculation formula is used to calculate the CDN service score, in S1022, the caching period is determined according to the CDN service score, as shown in FIG. 3, which may include the following steps:
S10221:若所述CDN服务评分大于第一阈值,则根据第二计算公式确定缓存周期:Tn+1=Tn-ΔT,其中,Tn+1为第n+1个周期的缓存周期,所述Tn为第n个周期的缓存周期,ΔT为预设时间变量值。S10221: If the CDN service score is greater than the first threshold, determine the cache period according to the second calculation formula: Tn+1 =Tn -ΔT, where Tn+1 is the cache period of the n+1th period, The Tn is the cache period of the nth cycle, and ΔT is a preset time variable value.
S10222:若所述CDN服务评分小于第二阈值,则根据第三计算公式确定缓存周期:Tn+1=Tn+ΔT。S10222: If the CDN service score is less than the second threshold, determine the cache period according to the third calculation formula: Tn+1 =Tn +ΔT.
S10223:若所述CDN服务评分大于或等于第二阈值且小于或等于第一阈值,则确定缓存周期为:Tn+1=Tn。S10223: If the CDN service score is greater than or equal to the second threshold and less than or equal to the first threshold, determine that the cache period is: Tn+1 =Tn .
S10221和S10222中,第一阈值和第二阈值可以根据实际情况进行设置,这里不做具体限定。In S10221 and S10222, the first threshold and the second threshold may be set according to actual conditions, which are not specifically limited here.
具体地,服务端根据CDN节点的缓存命中率和源站服务器的负载参数,采用第一计算公式得到CDN服务评分后,将CDN服务评分与第一阈值进行比较;若CDN服务评分大于第一阈值,由于源站服务器的负载参数与源站服务器的负载成反比,因此表明源站服务器的负载是比较低的,此时导致CDN服务评分大于第一阈值的原因为CDN节点的缓存命中率比较低,则服务端根据第二计算公式Tn+1=Tn-ΔT确定缓存周期,使缓存周期缩短,这样可以使CDN节点的缓存命中率提高。其中,ΔT可以根据实际需要进行设置,这里不做具体限定。若CDN服务评分小于第二阈值,由于CDN节点的缓存命中率与CDN服务平分成反比,因此表明CDN节点的缓存命中率比较高,此时导致CDN服务评分小于第二阈值的原因为源站服务器的负载较高,则服务端根据第三计算公式Tn+1=Tn+ΔT确定缓存周期,使缓存周期延长。若CDN服务评分大于或等于第二阈值且小于或等于第一阈值,则表明此时CDN节点的缓存命中率和源站服务器的负载都处于一个比较合理的范围内,则保持缓存周期不变,即Tn+1=Tn。Specifically, the server uses the first calculation formula to obtain the CDN service score according to the cache hit rate of the CDN node and the load parameter of the origin server, and then compares the CDN service score with the first threshold; if the CDN service score is greater than the first threshold , since the load parameter of the origin server is inversely proportional to the load of the origin server, it indicates that the load of the origin server is relatively low. At this time, the reason that the CDN service score is greater than the first threshold is that the cache hit rate of the CDN node is relatively low. , the server determines the cache period according to the second calculation formula Tn+1 =Tn -ΔT, so that the cache period is shortened, which can improve the cache hit rate of the CDN node. Wherein, ΔT can be set according to actual needs, which is not specifically limited here. If the CDN service score is less than the second threshold, since the cache hit rate of the CDN node is inversely proportional to the CDN service, it indicates that the cache hit rate of the CDN node is relatively high. The reason that the CDN service score is less than the second threshold is the origin server If the load is relatively high, the server determines the cache period according to the third calculation formula Tn+1 =Tn +ΔT, so as to prolong the cache period. If the CDN service score is greater than or equal to the second threshold and less than or equal to the first threshold, it indicates that the cache hit rate of the CDN node and the load of the origin server are both within a reasonable range, and the cache period remains unchanged. That is, Tn+1 =Tn .
S103:若资源类型为动态资源,则根据CDN节点的负载参数确定访问路径,以使CDN节点根据访问路径访问动态资源。S103: If the resource type is a dynamic resource, determine the access path according to the load parameter of the CDN node, so that the CDN node accesses the dynamic resource according to the access path.
可以理解的是,当CDN节点从源站服务器获取到动态资源并返回用户端时,会经过多个CDN节点进行数据透传,即CDN节点为N个,N为大于1的自然数。由于各个CDN节点的负载是不断变化的,若设置固定的访问路径,则在设置好的访问路径中进行数据透传时,若其中一个以上的CDN节点的负载较高时,则可能导致数据透传的时延较长,不利于用户端获取相应的动态资源的数据。因此,服务端根据CDN节点的负载参数来确定访问路径,可以使确定的访问路径不会因为某个CDN节点的负载过高而导致拥堵和时延过长。It can be understood that when a CDN node obtains dynamic resources from the origin server and returns it to the client, it will transparently transmit data through multiple CDN nodes, that is, there are N CDN nodes, and N is a natural number greater than 1. Since the load of each CDN node is constantly changing, if a fixed access path is set, when data transparent transmission is performed in the set access path, if the load of more than one CDN node is high, it may lead to data transparent transmission. The transmission delay is long, which is not conducive to the client to obtain the data of the corresponding dynamic resources. Therefore, the server determines the access path according to the load parameter of the CDN node, so that the determined access path will not cause congestion and long delay due to the high load of a certain CDN node.
可选地,当原来的访问路径中的某个CDN节点的负载较高时,服务端将该CDN节点替换为与该CDN节点最近的CDN节点确定访问路径;若与该CDN节点最近的CDN节点的负载也较高时,服务端将该CDN节点替换为该CDN节点次近的CDN节点确定访问路径,以此类推,直至确定出一个最优的访问路径,使CDN节点根据确定的访问路径来访问及传输动态资源。Optionally, when the load of a certain CDN node in the original access path is high, the server replaces the CDN node with the CDN node closest to the CDN node to determine the access path; if the CDN node closest to the CDN node determines the access path; When the load is also high, the server replaces the CDN node with the CDN node next to the CDN node to determine the access path, and so on, until an optimal access path is determined, so that the CDN node can Access and transfer dynamic resources.
进一步地,为了使动态资源的访问更加流畅,可以通过VPN方式建立N个CDN节点之间的连接。其中,VPN是虚拟专用网络(Virtual PrivateNetwork)的缩写,即在CDN节点之间建立起分隔的专用通道,这样,CDN节点在对动态资源进行数据透传时,提高传输的速度,同时也提高传输数据的安全性。Further, in order to make the access of dynamic resources smoother, connections between N CDN nodes can be established through VPN. Among them, VPN is the abbreviation of Virtual Private Network (Virtual Private Network), that is, a separate dedicated channel is established between CDN nodes. In this way, when CDN nodes transparently transmit data to dynamic resources, the transmission speed is improved, and the transmission speed is also improved. Data security.
与现有技术相比,本发明实施方式提供的CDN访问优化方法,对于静态资源,根据CDN节点的缓存命中率和源站服务器的负载参数来动态调整缓存周期,使确定的缓存周期更加符合CDN节点的缓存命中的情况和源站服务器的负载情况,既不会使CDN节点缓存周期过长导致更新不及时,也不会使CDN节点缓存周期过短源站服务器压力过大;对于动态资源,则根据CDN节点的负载参数来确定访问路径,使确定的访问路径更加符合CDN节点的负载情况,重新确定的访问路径能更快速地进行访问并获取资源,提高访问的时效性。通过对CDN节点的静态资源和动态资源访问进行优化,提高了CDN访问的效率。Compared with the prior art, in the CDN access optimization method provided by the embodiment of the present invention, for static resources, the cache period is dynamically adjusted according to the cache hit rate of the CDN node and the load parameter of the origin server, so that the determined cache period is more in line with the CDN. The cache hit of the node and the load of the origin server will neither make the CDN node cache period too long to cause untimely updates, nor will the CDN node cache period be too short, and the origin server will be under too much pressure; for dynamic resources, Then, the access path is determined according to the load parameters of the CDN node, so that the determined access path is more in line with the load condition of the CDN node, and the re-determined access path can access and obtain resources more quickly, and improve the timeliness of access. By optimizing the static resource and dynamic resource access of CDN nodes, the efficiency of CDN access is improved.
上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包含相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。The step division of the above various methods is only for the purpose of describing clearly. During implementation, it can be combined into one step or some steps can be split and decomposed into multiple steps, as long as they contain the same logical relationship, they are all within the protection scope of this patent. ;Adding insignificant modifications to the algorithm or process or introducing insignificant designs, but not changing the core design of the algorithm and process are all within the scope of protection of this patent.
本发明第二实施方式涉及一种CDN访问优化系统,如图4所示,包含:包括源站服务器201、信息管理平台202和CDN节点203;所述信息管理平台202用于:The second embodiment of the present invention relates to a CDN access optimization system, as shown in FIG. 4 , including: an origin server 201, an information management platform 202 and a CDN node 203; the information management platform 202 is used for:
获取CDN节点203缓存的资源类型、CDN节点203的缓存命中率、CDN节点203的负载参数和源站服务器201的负载参数;Obtain the resource type cached by the CDN node 203, the cache hit rate of the CDN node 203, the load parameter of the CDN node 203 and the load parameter of the origin server 201;
若资源类型为静态资源类型,则根据CDN节点203的缓存命中率和源站服务器201的负载参数确定缓存周期,以使CDN节点203根据缓存周期缓存静态资源;If the resource type is a static resource type, the cache period is determined according to the cache hit rate of the CDN node 203 and the load parameter of the origin server 201, so that the CDN node 203 caches the static resource according to the cache period;
若资源类型为动态资源类型,则根据CDN节点203的负载参数确定访问路径,以使CDN节点203根据访问路径访问动态资源。If the resource type is a dynamic resource type, the access path is determined according to the load parameter of the CDN node 203, so that the CDN node 203 accesses the dynamic resource according to the access path.
进一步地,信息管理平台202还用于:Further, the information management platform 202 is also used for:
根据CDN节点203的缓存命中率和源站服务器201的负载参数计算CDN服务评分;Calculate the CDN service score according to the cache hit rate of the CDN node 203 and the load parameter of the origin server 201;
根据CDN服务评分确定缓存周期。Determine the cache period based on the CDN service score.
进一步地,信息管理平台202还用于:Further, the information management platform 202 is also used for:
根据以下第一计算公式计算CDN服务评分:Calculate the CDN service score according to the following first calculation formula:
K=α*I-β*J;K=α*I-β*J;
其中,K为CDN服务评分,I为源站服务器201的负载参数,I与源站服务器201的负载成反比,J为CDN节点203的缓存命中率,J与CDN节点203的缓存命中率成正比,α和β为预设的权重系数。Among them, K is the CDN service score, I is the load parameter of the origin server 201, I is inversely proportional to the load of the origin server 201, J is the cache hit rate of the CDN node 203, and J is proportional to the cache hit rate of the CDN node 203 , α and β are preset weight coefficients.
进一步地,信息管理平台202还用于:Further, the information management platform 202 is also used for:
若CDN服务评分大于第一阈值,则根据以下第二计算公式确定缓存周期:If the CDN service score is greater than the first threshold, the cache period is determined according to the following second calculation formula:
Tn+1=Tn-ΔT;Tn+1 =Tn -ΔT;
其中,Tn+1为第n+1个周期的缓存周期,Tn为第n个周期的缓存周期,ΔT为预设时间变量值;Among them, Tn+1 is the cache period of the n+1th cycle, Tn is the cache period of the nth cycle, and ΔT is the preset time variable value;
若CDN服务评分小于第二阈值,则根据以下第三计算公式确定缓存周期:If the CDN service score is less than the second threshold, the cache period is determined according to the following third calculation formula:
Tn+1=Tn+ΔT;Tn+1 =Tn +ΔT;
若CDN服务评分大于或等于第二阈值且小于或等于第一阈值,则确定缓存周期为:Tn+1=Tn。If the CDN service score is greater than or equal to the second threshold and less than or equal to the first threshold, the cache period is determined to be: Tn+1 =Tn .
进一步地,CDN节点203为N个,N为大于1的自然数;Further, the number of CDN nodes 203 is N, and N is a natural number greater than 1;
信息管理平台202还用于:通过VPN方式建立N个CDN节点203之间的连接。The information management platform 202 is further configured to establish a connection between the N CDN nodes 203 by means of a VPN.
不难发现,本实施方式为与第一实施方式相对应的系统实施例,本实施方式可与第一实施方式互相配合实施。第一实施方式中提到的相关技术细节在本实施方式中依然有效,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第一实施方式中。It is not difficult to find that this embodiment is a system example corresponding to the first embodiment, and this embodiment can be implemented in cooperation with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and are not repeated here in order to reduce repetition. Correspondingly, the related technical details mentioned in this embodiment can also be applied to the first embodiment.
值得一提的是,本实施方式中所涉及到的各模块均为逻辑模块,在实际应用中,一个逻辑单元可以是一个物理单元,也可以是一个物理单元的一部分,还可以以多个物理单元的组合实现。此外,为了突出本发明的创新部分,本实施方式中并没有将与解决本发明所提出的技术问题关系不太密切的单元引入,但这并不表明本实施方式中不存在其它的单元。It is worth mentioning that each module involved in this embodiment is a logical module. In practical applications, a logical unit may be a physical unit, a part of a physical unit, or multiple physical units. A composite implementation of the unit. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.
本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those skilled in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present invention. scope.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911074795.XACN110830572B (en) | 2019-11-06 | 2019-11-06 | CDN access optimization method and system |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911074795.XACN110830572B (en) | 2019-11-06 | 2019-11-06 | CDN access optimization method and system |
| Publication Number | Publication Date |
|---|---|
| CN110830572Atrue CN110830572A (en) | 2020-02-21 |
| CN110830572B CN110830572B (en) | 2022-08-05 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201911074795.XAActiveCN110830572B (en) | 2019-11-06 | 2019-11-06 | CDN access optimization method and system |
| Country | Link |
|---|---|
| CN (1) | CN110830572B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112187656A (en)* | 2020-09-30 | 2021-01-05 | 安徽极玩云科技有限公司 | Management system of CDN node |
| CN112202906A (en)* | 2020-10-09 | 2021-01-08 | 安徽极玩云科技有限公司 | CDN access optimization method and system |
| CN112256495A (en)* | 2020-10-20 | 2021-01-22 | 平安科技(深圳)有限公司 | Data transmission method and device, computer equipment and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102196060A (en)* | 2011-06-15 | 2011-09-21 | 北京蓝汛通信技术有限责任公司 | Method and system for selecting source station by Cache server |
| CN103532817A (en)* | 2013-10-12 | 2014-01-22 | 无锡云捷科技有限公司 | CDN (content delivery network) dynamic acceleration system and method |
| US20140215019A1 (en)* | 2013-01-28 | 2014-07-31 | Spencer Ahrens | Static resource caching |
| US20150201033A1 (en)* | 2014-01-10 | 2015-07-16 | Facebook. Inc. | Content specific router caching |
| CN107357890A (en)* | 2017-07-12 | 2017-11-17 | 腾讯科技(深圳)有限公司 | A kind of web page files processing method, apparatus and system and storage device |
| CN109150627A (en)* | 2018-10-09 | 2019-01-04 | 南京邮电大学 | The construction method mapped based on dynamic resource demand and the virtual network of topology ambiguity |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102196060A (en)* | 2011-06-15 | 2011-09-21 | 北京蓝汛通信技术有限责任公司 | Method and system for selecting source station by Cache server |
| US20140215019A1 (en)* | 2013-01-28 | 2014-07-31 | Spencer Ahrens | Static resource caching |
| CN103532817A (en)* | 2013-10-12 | 2014-01-22 | 无锡云捷科技有限公司 | CDN (content delivery network) dynamic acceleration system and method |
| US20150201033A1 (en)* | 2014-01-10 | 2015-07-16 | Facebook. Inc. | Content specific router caching |
| CN107357890A (en)* | 2017-07-12 | 2017-11-17 | 腾讯科技(深圳)有限公司 | A kind of web page files processing method, apparatus and system and storage device |
| CN109150627A (en)* | 2018-10-09 | 2019-01-04 | 南京邮电大学 | The construction method mapped based on dynamic resource demand and the virtual network of topology ambiguity |
| Title |
|---|
| 贾冬青等: ""基于云存储的内容分发技术研究"", 《西南师范大学学报(自然科学版)》* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112187656A (en)* | 2020-09-30 | 2021-01-05 | 安徽极玩云科技有限公司 | Management system of CDN node |
| CN112187656B (en)* | 2020-09-30 | 2023-10-03 | 安徽极玩云科技有限公司 | Management system of CDN node |
| CN112202906A (en)* | 2020-10-09 | 2021-01-08 | 安徽极玩云科技有限公司 | CDN access optimization method and system |
| CN112256495A (en)* | 2020-10-20 | 2021-01-22 | 平安科技(深圳)有限公司 | Data transmission method and device, computer equipment and storage medium |
| Publication number | Publication date |
|---|---|
| CN110830572B (en) | 2022-08-05 |
| Publication | Publication Date | Title |
|---|---|---|
| CN104158755B (en) | The methods, devices and systems of transmitting message | |
| CN110830572B (en) | CDN access optimization method and system | |
| CN107317879B (en) | A method and system for distributing user requests | |
| CN103347068B (en) | A kind of based on Agent cluster network-caching accelerated method | |
| CN108900570B (en) | A Cache Replacement Method Based on Content Value | |
| CN105634992A (en) | CDN platform self-adaptive bandwidth control method and system | |
| US10404603B2 (en) | System and method of providing increased data optimization based on traffic priority on connection | |
| US20140143375A1 (en) | Methods for optimizing service of content requests and devices thereof | |
| CN110134896A (en) | A monitoring process and intelligent caching method of proxy server | |
| CN106686060B (en) | A kind of method and system of content diffusion | |
| CN104426838B (en) | A kind of internet buffer scheduling method and system | |
| CN111294394B (en) | Self-adaptive caching strategy method based on complex network junction | |
| US9386353B2 (en) | Child node, parent node, and caching method and system for multi-layer video network | |
| CN102137138B (en) | Method, device and system for cache collaboration | |
| Reshadinezhad et al. | An efficient adaptive cache management scheme for named data networks | |
| CN114866475A (en) | Network-on-chip congestion control method, system, device and storage medium | |
| CN108769253B (en) | Adaptive pre-fetching control method for optimizing access performance of distributed system | |
| WO2017000094A1 (en) | Data storage method, device and system | |
| CN108471457A (en) | Based on distributed node dynamic memory load-balancing method | |
| CN103416027A (en) | Cache optimization method, cache and cache optimization system | |
| WO2017113373A1 (en) | Caching method and packet data network gateway | |
| CN107911471B (en) | The distributed caching method and equipment of data | |
| CN109788075B (en) | Private network network system, data acquisition method and edge server | |
| Shuai et al. | A cost-based distributed algorithm for load balancing in content delivery network | |
| EP2800386A1 (en) | Child node, father node and buffer method and system for multi-layer video network |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |