CN103888517B - Caching method for publishing and subscription system to achieve historical event subscription - Google Patents

Caching method for publishing and subscription system to achieve historical event subscription Download PDF

Info

Publication number
CN103888517B
CN103888517B CN201410075650.2A CN201410075650A CN103888517B CN 103888517 B CN103888517 B CN 103888517B CN 201410075650 A CN201410075650 A CN 201410075650A CN 103888517 B CN103888517 B CN 103888517B
Authority
CN
China
Prior art keywords
cache
event
proxy node
point
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410075650.2A
Other languages
Chinese (zh)
Other versions
CN103888517A (en
Inventor
曹健
于润胜
徐钱元
许文星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangyin Daily Information Technology Co Ltd
Original Assignee
Shanghai Jiao Tong University
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 Shanghai Jiao Tong University filed Critical Shanghai Jiao Tong University
Priority to CN201410075650.2A priority Critical patent/CN103888517B/en
Publication of CN103888517A publication Critical patent/CN103888517A/en
Application granted granted Critical
Publication of CN103888517B publication Critical patent/CN103888517B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明公开了一种用于发布订阅系统的实现历史事件订阅的缓存方法,包括如下步骤:路由表扩充步骤,在路由表中增设缓存路由信息;事件处理步骤,通过哈希函数计算缓存点参考值;事件发布步骤:根据缓存点参考值判断当前代理节点是否作为缓存点并进行缓存,同步更新缓存路由信息;缓存订阅步骤;以及缓存获取步骤。本发明具有以下有益效果:本发明提供的缓存方法实现了订阅者对历史事件的订阅;本发明充分利用了事件分发路径上所有代理及其邻居代理的存储空间,提高了存储资源利用率,增强了发布订阅系统的缓存能力;本发明对缓存冗余做了精简,在访存效率与存储占用率之间做了平衡。

The invention discloses a caching method for realizing historical event subscription for a publishing and subscribing system, comprising the following steps: a routing table expansion step, adding caching routing information in the routing table; an event processing step, calculating a caching point reference through a hash function value; event publishing step: judge whether the current proxy node is used as a cache point and cache according to the cache point reference value, and update the cache routing information synchronously; cache subscription step; and cache acquisition step. The present invention has the following beneficial effects: the caching method provided by the present invention enables subscribers to subscribe to historical events; the present invention fully utilizes the storage space of all agents and their neighbor agents on the event distribution path, improves the utilization rate of storage resources, and enhances The caching capability of the publish-subscribe system is improved; the invention simplifies the caching redundancy and balances the memory access efficiency and the storage occupancy rate.

Description

用于发布订阅系统的实现历史事件订阅的缓存方法Cache method for implementing historical event subscription for publish-subscribe system

技术领域technical field

本发明涉及发布订阅系统技术,具体涉及一种实现历史事件订阅的缓存方法。The invention relates to a publish-subscribe system technology, in particular to a caching method for realizing historical event subscription.

背景技术Background technique

发布订阅系统包含一个分布式的通信网络,即事件代理网络,和一系列相互通信的端点,即订阅者和发布者。订阅者和发布者之间通过事件代理网络互联,采用一种异步的发布-订阅方式来完成数据交换。订阅者通过声明一个过滤条件表达式提交订阅,当发布者发布了一条符合其订阅条件的事件,该事件即经由代理网络路由到订阅者。在时间上,内容的订阅与发布是异步的,而在空间上,订阅者与发布者也不必关心对方位于何处,因此发布订阅系统实现了通信双方在空间、时间和控制流上完全解耦。A publish-subscribe system consists of a distributed communication network, the event broker network, and a series of endpoints communicating with each other, namely subscribers and publishers. Subscribers and publishers are interconnected through an event proxy network, and an asynchronous publish-subscribe method is used to complete data exchange. Subscribers submit subscriptions by declaring a filter condition expression. When a publisher publishes an event that meets its subscription conditions, the event is routed to the subscriber through the proxy network. In terms of time, subscription and publication of content are asynchronous, and in terms of space, subscribers and publishers do not need to care about where each other is located. Therefore, the publish-subscribe system realizes the complete decoupling of the communication parties in terms of space, time and control flow .

在传统的发布订阅系统中,事件通知能够确保最终到达每个感兴趣的订阅者,但前提是每个订阅者都处于在线状态且各自的订阅被整个系统所知。这一前提条件对于动态网络环境来说则是一大限制,因为客户端往往会频繁地加入或离开网络,新加入的订阅者可能会请求一个在其加入网络之前所发布的事件。在传统的发布订阅系统中,这种请求是得不到响应的,因而如何利用事件缓存机制以使新用户能够获知历史事件就成为了发布订阅系统需要解决的一大问题。In a traditional publish-subscribe system, event notifications are guaranteed to eventually reach each interested subscriber, but only if each subscriber is online and their subscriptions are known to the entire system. This prerequisite is a major limitation in dynamic network environments, since clients tend to join and leave the network frequently, and newly joined subscribers may request an event that was published before they joined the network. In the traditional publish-subscribe system, this kind of request cannot be responded, so how to use the event cache mechanism to enable new users to learn about historical events has become a major problem that the publish-subscribe system needs to solve.

发明内容Contents of the invention

为了克服现有技术中存在的订阅者无法订阅历史事件的缺陷,本发明提供一种实现历史事件订阅的缓存方法。本发明具体的技术方案如下:In order to overcome the defect in the prior art that subscribers cannot subscribe to historical events, the present invention provides a caching method for realizing historical event subscription. Concrete technical scheme of the present invention is as follows:

一种用于发布订阅系统的实现历史事件订阅的缓存方法,包括如下步骤:A caching method for implementing historical event subscription for a publish-subscribe system, comprising the following steps:

路由表扩充步骤:在各代理节点的路由表中增设缓存路由信息,所述缓存路由信息用于提供能够定位到缓存点的路由信息;Routing table expansion step: adding cached routing information in the routing table of each proxy node, the cached routing information is used to provide routing information that can be located to the cache point;

事件处理步骤:当某一代理节点发出一事件时,通过哈希函数进行计算,得到一缓存点参考值;为所述事件附加一消息头,所述消息头中记录了缓存点信息以及订阅路径信息;所述缓存点信息中包括所述缓存点参考值;Event processing steps: when a proxy node sends out an event, calculate it through a hash function to obtain a cache point reference value; add a message header to the event, and record the cache point information and subscription path in the message header information; the cache point information includes the cache point reference value;

事件发布步骤:根据所述消息头中记录的订阅路径信息,将所述事件向对应的订阅节点进行发布;对于发布路径中的每个代理节点,根据所述缓存点参考值判断当前代理节点是否作为缓存点并进行缓存,同时,当前代理节点同步更新对应于所述事件的缓存路由信息;Event publishing step: according to the subscription path information recorded in the message header, publish the event to the corresponding subscription node; for each proxy node in the publishing path, judge whether the current proxy node is As a cache point and cache, at the same time, the current proxy node synchronously updates the cache routing information corresponding to the event;

缓存订阅步骤:某一代理节点发出一缓存请求,所述缓存请求中包含订阅条件;将所述订阅条件与当前代理节点的路由表中预存的过滤条件进行匹配,确定缓存事件;所述缓存事件是指,与订阅条件匹配成功的过滤条件对应的事件;Cache subscription step: a certain proxy node sends a cache request, and the cache request includes a subscription condition; the subscription condition is matched with the pre-stored filter conditions in the routing table of the current proxy node to determine a cache event; the cache event Refers to the event corresponding to the filter condition that successfully matches the subscription condition;

缓存获取步骤:若当前代理节点的路由表中包含所述缓存事件对应的缓存路由信息,则直接根据该缓存路由信息找到所述缓存事件对应的缓存点,将缓存请求转发到缓存点,获取缓存;若当前代理节点的路由表中不包含所述缓存事件对应的缓存路由信息,则根据所述缓存事件对应的订阅路由信息,将缓存请求发送到下一个代理节点,回转执行缓存获取步骤。Cache acquisition step: If the routing table of the current proxy node contains the cache routing information corresponding to the cache event, then directly find the cache point corresponding to the cache event according to the cache routing information, forward the cache request to the cache point, and obtain the cache ; If the routing table of the current proxy node does not contain the cache routing information corresponding to the cache event, then according to the subscription routing information corresponding to the cache event, send the cache request to the next proxy node, and perform the cache acquisition step in turn.

作为优化方案,所述哈希函数如公式(1)所示:As an optimization scheme, the hash function is as shown in formula (1):

该哈希函数的定义域为事件e的取值范围(a,b),值域为[0,MAX_HOP];其中MAX_HOP是事件分发路径上的代理节点到其根节点的最大距离。The domain of the hash function is the value range (a, b) of the event e, and the value range is [0, MAX_HOP]; where MAX_HOP is the maximum distance from the agent node on the event distribution path to its root node.

计算得到的缓存点参考值为一整数值。The calculated cache point reference value is an integer value.

作为优化方案,根据所述缓存点参考值判断当前代理节点是否作为缓存点并进行缓存具体为:As an optimization scheme, according to the cache point reference value, it is judged whether the current proxy node is used as a cache point and the cache is specifically as follows:

当前代理节点收到事件后先将所述缓存点参考值t减1,然后根据缓存点参考值进行判断,若t=0,则将当前代理节点做为缓存点。After receiving the event, the current proxy node firstly subtracts 1 from the cache point reference value t, and then judges according to the cache point reference value. If t=0, the current proxy node is used as the cache point.

作为优化方案,所述路由表扩充步骤具体为:As an optimization scheme, the steps of expanding the routing table are specifically:

在各代理节点的路由表中增加cache_nexthops字段,使得所述路由表的结构为:Add the cache_nexthops field in the routing table of each proxy node, so that the structure of the routing table is:

<filter|sub_nexthops|cache_nexthops><filter|sub_nexthops|cache_nexthops>

其中,filter是指过滤条件,sub_nexthops记录了与filter匹配成功的事件向订阅节点方向转发的下一跳代理,cache_nexthops记录了与filter匹配成功的缓存请求向缓存点方向转发的下一跳代理。Among them, filter refers to the filter condition, sub_nexthops records the next-hop agent that forwards the events that successfully match the filter to the direction of the subscription node, and cache_nexthops records the next-hop agent that forwards the cache request that successfully matches the filter to the direction of the cache point.

作为优化方案,所述事件发布步骤中,对于事件在发布过程中的当前代理节点,其缓存路由信息的更新方法具体为:As an optimization scheme, in the event publishing step, for the current agent node in the publishing process of the event, the update method of its cached routing information is specifically:

若当前代理节点在缓存点的后方,则将缓存路由信息中的下一跳设置为前驱的代理节点;If the current proxy node is behind the cache point, the next hop in the cache routing information is set as the predecessor proxy node;

若当前代理节点正好为缓存点,则将缓存路由信息中的下一跳设置为当前代理节点自身;If the current proxy node happens to be a cache point, the next hop in the cache routing information is set to the current proxy node itself;

若当前代理节点在缓存点的前方,则将缓存路由信息中的下一跳设置为后继的代理节点。If the current proxy node is in front of the cache point, the next hop in the cache routing information is set as the subsequent proxy node.

作为优化方案,所述缓存获取步骤中,将缓存请求转发到缓存点获取缓存的方法具体为:As an optimization scheme, in the cache obtaining step, the method of forwarding the cache request to the cache point to obtain the cache is as follows:

在缓存请求转发到缓存点的过程中依次记录沿途经过的代理节点,记为缓存请求路径;缓存请求到达缓存点后,缓存点将请求的缓存沿缓存请求路径的逆序发送给发出缓存请求的代理节点。In the process of forwarding the cache request to the cache point, record the proxy nodes along the way in sequence, which is recorded as the cache request path; after the cache request reaches the cache point, the cache point sends the requested cache along the cache request path in reverse order to the proxy that issued the cache request node.

作为优化方案,所述事件发布步骤中,若当前代理节点作为缓存点并进行缓存时,进行判断:若当前代理节点的存储空间耗尽,则询问该事件发布路径之外的直接邻居是否尚有可用存储空间;若该邻居有可用存储空间,则将事件转发给该邻居进行缓存。As an optimization scheme, in the event publishing step, if the current proxy node is used as a cache point and caches, it is judged: if the storage space of the current proxy node is exhausted, then ask whether the direct neighbors outside the event publishing path still have Available storage space; if the neighbor has available storage space, the event is forwarded to the neighbor for caching.

作为优化方案,所述缓存点信息还包括缓存点位置、缓存副本数目以及缓存时间戳,所述缓存点位置、缓存副本数目以及缓存时间戳的初值均为空;对于发布路径中的每个代理节点,若当前代理节点作为缓存点并进行缓存时,更新事件的消息头中记录的缓存点位置、缓存副本数目以及缓存时间戳,同时更新当前代理节点内存储的缓存点位置、缓存副本数目以及缓存时间戳。As an optimization solution, the cache point information also includes the cache point location, the number of cached copies, and the cache timestamp, and the initial values of the cache point location, the number of cached copies, and the cache timestamp are all empty; for each Proxy node, if the current proxy node is used as a cache point and caches, update the cache point location, cache copy number and cache timestamp recorded in the event message header, and update the cache point location and cache copy number stored in the current proxy node and cache timestamps.

作为优化方案,在事件在发布过程中,沿途比较各代理节点的缓存时间戳,获得最旧缓存的位置,当事件抵达订阅节点时,若整条发布路径上的存储空间耗尽,则转回至最旧缓存的位置删除最旧的缓存。As an optimization scheme, during the publishing process of the event, compare the cache timestamps of the proxy nodes along the way to obtain the location of the oldest cache. Go to the location of the oldest cache to delete the oldest cache.

作为优化方案,所述事件发布步骤中,对于每个代理节点,采用冗余精简方法对事件进行缓存,所述冗余精简方法具体为:As an optimization solution, in the event publishing step, for each proxy node, a redundant streamlining method is used to cache the event, and the redundant streamlining method is specifically:

设代理节点为bi,其包含若干子节点bij,设gij为每个子节点bij对应的子树;根据目标函数确定将缓存的副本分派到缓存点的哪些子树,如公式(2)所示:Let the proxy node be b i , which contains several child nodes b ij , and let g ij be the subtree corresponding to each child node b ij ; according to the objective function Determines which subtrees of cache points to dispatch cached copies to, as shown in equation (2):

其中,dij表示代理节点bt距离子树gij末端用户的最大距离,rij表示代理节点bt接收到来自子树gij的用户请求总数,sij表示子树gij中所有节点总的存储空闲率,t为缓存点参考值;目标函数的分子表示将事件的一个副本放置在子树gij上时,用户获取该副本的总开销;其中,分子的第一项为子树gij末端的用户请求该副本时的开销,分子的第二项则表示其余子树上的用户请求该副本时的总开销;Among them, d ij represents the maximum distance between the proxy node b t and the end user of the subtree g ij , r ij represents the total number of user requests received by the proxy node b t from the subtree g ij , s ij represents the total number of all nodes in the subtree g ij The storage idle rate of , t is the reference value of the cache point; the objective function The numerator of represents the total cost for the user to obtain a copy of the event when it is placed on the subtree g ij ; among them, the first item of the numerator is the cost when the user at the end of the subtree g ij requests the copy, and the first item of the numerator The binomial represents the rest of the subtrees The total overhead when users on the network request this copy;

代理节点bt为每个子节点bij各计算一个目标选择其值最小的m=min{k,ni}棵子树gt1,gt2,...,gtm分派副本,并相应地将发往子节点bt1,bt2,...,btm的事件的副本数目k根据公式(3)进行修改:The proxy node b t calculates a goal for each child node b ij Select m=min{k, n i } sub-trees g t1 , g t2 , ..., g tm with the smallest value to assign copies, and correspondingly send copies to child nodes b t1 , b t2 , ..., b The replica number k of the event of tm is modified according to formula (3):

将发往其他子节点btt的事件的副本数目k设为ki=0(m<l≤nt),相应的t值归0。Set the replica number k of events sent to other child nodes b tt as k i =0 (m<l≤n t ), and return the corresponding t value to 0.

与现有技术相比,本发明具有以下有益效果:Compared with the prior art, the present invention has the following beneficial effects:

(1)本发明提供的缓存方法实现了订阅者对历史事件的订阅;(1) The caching method provided by the present invention realizes the subscriber's subscription to historical events;

(2)本发明充分利用了事件分发路径上所有代理及其邻居代理的存储空间,提高了存储资源利用率,增强了发布订阅系统的缓存能力;(2) The present invention makes full use of the storage space of all agents and their neighbor agents on the event distribution path, improves the utilization rate of storage resources, and enhances the caching capability of the publish-subscribe system;

(3)本发明对缓存冗余做了精简,在访存效率与存储占用率之间做了平衡。(3) The present invention simplifies the buffer redundancy and balances the memory access efficiency and the storage occupancy rate.

附图说明Description of drawings

图1为本发明提供的缓存方法的总流程图;Fig. 1 is the general flowchart of the cache method provided by the present invention;

图2为实施例1中发布订阅系统的网络示意图。FIG. 2 is a schematic network diagram of the publish-subscribe system in Embodiment 1.

具体实施方式detailed description

下面结合附图以实施例的方式详细描述本发明。The present invention will be described in detail below by means of embodiments in conjunction with the accompanying drawings.

实施例1:Example 1:

如图1所示,一种用于发布订阅系统的实现历史事件订阅的缓存方法,包括如下步骤:As shown in Figure 1, a caching method for implementing historical event subscription for a publish-subscribe system includes the following steps:

步骤S1,路由表扩充步骤:在各代理节点的路由表中增设缓存路由信息,所述缓存路由信息用于提供能够定位到缓存点的路由信息。Step S1, routing table expansion step: adding cached routing information in the routing table of each proxy node, the cached routing information is used to provide routing information that can locate the cached point.

传统的发布订阅系统中,各代理节点的路由表中已包含订阅路由信息,用于定位到事件对应的订阅者;为了使发布订阅系统支持缓存,在此基础上,增设缓存路由信息,对路由表进行扩展。In the traditional publish-subscribe system, the routing table of each proxy node already contains subscription routing information, which is used to locate the subscribers corresponding to the event; The table is extended.

现有的路由表结构为<filter|sub_nexthops>,其中filter是过滤条件,sub_nexthops则记录了与filter匹配成功的事件向订阅节点方向转发的下一跳代理节点;该sub_nexthops字段即对应于订阅路由信息。The existing routing table structure is <filter|sub_nexthops>, where filter is the filter condition, and sub_nexthops records the next-hop proxy node that forwards the event that matches the filter successfully to the direction of the subscription node; the sub_nexthops field corresponds to the subscription routing information .

在现有的路由表结构中增加cache_nexthops字段,使得所述路由表的结构为:Add the cache_nexthops field in the existing routing table structure, so that the structure of the routing table is:

<filter|sub_nexthops|cache_nexthops><filter|sub_nexthops|cache_nexthops>

其中,cache_nexthops记录了与filter匹配成功的缓存请求向缓存点方向转发的下一跳代理,该cache_nexthops字段即对应于缓存路由信息。该cache_nexthops字段在事件发布过程中沿分发路径逐跳构造,作用是为用户的缓存请求提供路由信息,使其能够找到缓存点,正如sub_nexthops帮助事件找到订阅者一样。Among them, cache_nexthops records the next-hop agent that the cache request that successfully matches the filter is forwarded to the cache point, and the cache_nexthops field corresponds to the cache routing information. The cache_nexthops field is constructed hop-by-hop along the distribution path during the event publishing process, and its function is to provide routing information for the user's cache request so that it can find the cache point, just as sub_nexthops helps the event find subscribers.

步骤S2,事件处理步骤:当某一代理节点发出一事件时,通过哈希函数进行计算,得到一缓存点参考值;为所述事件附加一消息头,所述消息头中记录了缓存点信息以及订阅路径信息;所述缓存点信息中包括所述缓存点参考值。Step S2, event processing step: when a proxy node sends out an event, it calculates through a hash function to obtain a cache point reference value; attaches a message header to the event, and the cache point information is recorded in the message header and subscription path information; the cache point information includes the cache point reference value.

本步骤是发布者向订阅者发送事件之前,为了实现缓存而进行的处理。假设事件e的取值范围为e,value∈(a,b),发布者通过以下哈希函数来决定将事件缓存在路径上的哪些节点,如公式(1)所示:This step is for the publisher to implement caching before sending events to subscribers. Assuming that the value range of event e is e, value ∈ (a, b), the publisher decides which nodes on the path to cache the event through the following hash function, as shown in formula (1):

其中,该哈希函数的定义域即为事件e取值范围(a,b),值域则是[0,MAX_HOP],其中MAX_HOP是事件分发路径上的代理节点到其根节点的最大距离(可通过事先发送探索消息获得),以跳数计。当事件e不存在分发路径时,它被映射到第0跳,即根节点。Wherein, the definition domain of the hash function is the value range (a, b) of the event e, and the value range is [0, MAX_HOP], where MAX_HOP is the maximum distance from the agent node on the event distribution path to its root node ( can be obtained by sending a discovery message in advance), counted in hops. When there is no distribution path for event e, it is mapped to the 0th hop, which is the root node.

计算得到缓存点参考值,该缓存点参考值为一整数值。哈希映射的结果即得到的缓存点参考值并非缓存点的代理标识符,而是一个类似减法计数器的跳数变量t,记录的是该事件的缓存点与当前代理节点的距离。进行哈希运算之后,并不能立刻确定哪个代理节点是缓存点,需要在事件发布过程中,由发布路径上的各代理节点根据缓存点参考值确定自身是否做为缓存点。将计算出的缓存点参考值记录在事件的消息头中,随事件一起发布。订阅路径信息记录了事件从发布者发送到订阅者所要经过的路径信息。A cache point reference value is calculated, and the cache point reference value is an integer value. The result of hash mapping is that the reference value of the cache point is not the proxy identifier of the cache point, but a hop variable t similar to a subtraction counter, which records the distance between the cache point of the event and the current proxy node. After the hash operation is performed, it is not immediately possible to determine which proxy node is the cache point. During the event publishing process, each proxy node on the publishing path needs to determine whether it is a cache point according to the reference value of the cache point. Record the calculated cache point reference value in the message header of the event and publish it together with the event. The subscription path information records the path information that the event needs to pass through from the publisher to the subscriber.

步骤S3,事件发布步骤:根据所述消息头中记录的订阅路径信息,将所述事件向对应的订阅节点进行发布;对于发布路径中的每个代理节点,根据所述缓存点参考值判断当前代理节点是否作为缓存点并进行缓存,同时,当前代理节点同步更新对应于所述事件的缓存路由信息。Step S3, event publishing step: according to the subscription path information recorded in the message header, publish the event to the corresponding subscription node; for each proxy node in the publishing path, judge the current Whether the proxy node acts as a cache point and caches, and at the same time, the current proxy node synchronously updates the cache routing information corresponding to the event.

在本步骤中,根据缓存点参考值判断当前代理节点是否作为缓存点并进行缓存具体为:In this step, according to the cache point reference value, it is judged whether the current proxy node is used as a cache point and the cache is specifically as follows:

当前代理节点收到事件后先将缓存点参考值t减1,然后根据其值进行判断,若t=0,则当前代理节点即做为缓存点。After the current proxy node receives the event, it first subtracts 1 from the cache point reference value t, and then judges according to its value. If t=0, the current proxy node is used as the cache point.

在进行缓存时,有可能当前代理节点会出现存储空间已满的情况,为了充分利用网络中的存储空间,在进行缓存之前,进行如下判断:若当前代理节点的存储空间耗尽,则询问该事件发布路径之外的直接邻居是否尚有可用存储空间;若该邻居有可用存储空间,则将事件转发给该邻居进行缓存。采用此方法可以提高整个系统的存储空间的利用率。When caching, the storage space of the current proxy node may be full. In order to make full use of the storage space in the network, the following judgment should be made before caching: if the storage space of the current proxy node is exhausted, ask the Whether the direct neighbor outside the event publishing path still has available storage space; if the neighbor has available storage space, the event will be forwarded to the neighbor for caching. Adopting this method can improve the utilization rate of the storage space of the whole system.

当前代理节点在完成缓存点判断之后,需要同步更新当前代理节点的路由表中该事件对应的缓存路由信息。缓存路由信息的更新方法具体为,包括三种情况:并相应构造缓存路由:After the current proxy node completes the judgment of the cache point, it needs to synchronously update the cache routing information corresponding to the event in the routing table of the current proxy node. The update method of the cached routing information is specifically, including three situations: and correspondingly construct the cached route:

情况一:若t<0,即事件的转发已经过缓存点,当前代理节点位于缓存点的下游,则将缓存路由信息中的下一跳设置为前驱的代理节点;Case 1: If t<0, that is, the forwarding of the event has passed the cache point, and the current proxy node is located downstream of the cache point, then set the next hop in the cache routing information as the predecessor proxy node;

情况二:若t=0,即当前代理节点正好为缓存点,则将缓存路由信息中的下一跳设置为当前代理节点自身;Case 2: if t=0, that is, the current proxy node is just a cache point, then the next hop in the cache routing information is set as the current proxy node itself;

情况三:若t>0,即事件的转发还未到达缓存点,当前代理节点在缓存点的前方,则将缓存路由信息中的下一跳设置为后继的代理节点。Case 3: If t>0, that is, the forwarding of the event has not yet reached the cache point, and the current proxy node is in front of the cache point, then the next hop in the cache routing information is set as the subsequent proxy node.

在事件发布过程中的每一个代理节点都进行上述缓存点的判断和缓存路由信息更新的操作。当事件发送到订阅者时,所有的缓存点均已确定并进行缓存,发布路径中的所有代理节点均已更新缓存路由信息。In the process of publishing the event, each proxy node performs the operation of judging the cache point and updating the cache routing information. When the event is sent to the subscriber, all cache points have been determined and cached, and all proxy nodes in the publishing path have updated the cache routing information.

步骤S4,缓存订阅步骤:某一代理节点发出一缓存请求,所述缓存请求中包含订阅条件;将所述订阅条件与当前代理节点的路由表中预存的过滤条件进行匹配,确定缓存事件;所述缓存事件是指,与订阅条件匹配成功的过滤条件对应的事件。Step S4, cache subscription step: a proxy node sends a cache request, and the cache request includes a subscription condition; matches the subscription condition with the filter condition pre-stored in the routing table of the current proxy node, and determines the cache event; The above cached events refer to the events corresponding to the filter conditions that successfully match the subscription conditions.

在本步骤中,当订阅者接入发布订阅系统后,若要对历史事件进行订阅,即是要从缓存的事件中订阅所需的内容。类似于订阅事件时发送的订阅请求,订阅缓存时通过发送一缓存请求实现。设缓存请求为Requset(Δf),其中的Δf为订阅条件。In this step, after the subscriber accesses the publish-subscribe system, if he wants to subscribe to the historical event, he must subscribe to the required content from the cached event. Similar to the subscription request sent when subscribing to events, subscribing to caches is achieved by sending a cache request. Let the cache request be Requset(Δf), where Δf is the subscription condition.

步骤S5,缓存获取步骤:若当前代理节点的路由表中包含所述缓存事件对应的缓存路由信息,则直接根据该缓存路由信息找到所述缓存事件对应的缓存点,将缓存请求转发到缓存点,获取缓存;若当前代理节点的路由表中不包含所述缓存事件对应的缓存路由信息,则根据所述缓存事件对应的订阅路由信息,将缓存请求发送到下一个代理节点,回转执行缓存获取步骤。Step S5, cache acquisition step: if the routing table of the current proxy node contains the cache routing information corresponding to the cache event, then directly find the cache point corresponding to the cache event according to the cache routing information, and forward the cache request to the cache point , to obtain the cache; if the routing table of the current proxy node does not contain the cache routing information corresponding to the cache event, then according to the subscription routing information corresponding to the cache event, the cache request is sent to the next proxy node, and the cache acquisition is performed in turn step.

具体地说,在本步骤中,获取缓存包括两种情况:Specifically, in this step, obtaining the cache includes two situations:

(1)路由表中包含缓存事件对应的缓存路由信息,即订阅历史事件的用户出现在其兴趣事件的分发路径上。这时缓存请求可以直接依据cache_nexthops找到事件缓存点。在缓存请求逐跳转发到缓存点的过程中依次记录沿途经过的代理节点,记为缓存请求路径;缓存请求到达缓存点后,缓存点将请求的缓存沿缓存请求路径的逆序发送给发出缓存请求的代理节点。(1) The routing table contains cached routing information corresponding to cached events, that is, users who subscribe to historical events appear on the distribution path of their interested events. At this time, the cache request can directly find the event cache point according to cache_nexthops. In the process of forwarding the cache request to the cache point hop by hop, the proxy nodes along the way are recorded in sequence, which is recorded as the cache request path; after the cache request reaches the cache point, the cache point sends the requested cache to the issuing cache along the reverse order of the cache request path The requested proxy node.

(2)路由表中不包含缓存事件对应的缓存路由信息,即订阅历史事件的用户不在其兴趣事件的分发路径上。根据缓存事件对应的sub_nexthops,将缓存请求发送到下一个代理节点。下一个代理节点重复上述操作,直至找到事件缓存点。(2) The routing table does not contain the cached routing information corresponding to the cached event, that is, the user subscribing to the historical event is not on the distribution path of the event of interest. According to the sub_nexthops corresponding to the cache event, the cache request is sent to the next proxy node. The next proxy node repeats the above operations until an event cache point is found.

下面举一个实例对本实施例提供的缓存方法进行详细的说明,图2给出了发布订阅系统的网络示意图,其中,A~E代表5个代理节点,P代表发布者所在的代理节点,S1代表用户(订阅者)所在的代理节点。An example is given below to describe the caching method provided in this embodiment in detail. Figure 2 shows a network schematic diagram of the publish-subscribe system, where A-E represent five proxy nodes, P represents the proxy node where the publisher is located, and S 1 Represents the proxy node where the user (subscriber) resides.

假设用户S1的过滤条件是f1,发布者P发布了一条符合过滤条件f1的事件e1并选择代理D作为缓存点,e1携此缓存点信息沿分发路径A→B→D→E由发布者向订阅者逐跳匹配转发。代理A将事件与f1匹配成功,读取事件消息头中的缓存点信息并发现其缓存点位于自己下游,于是将匹配成功的订阅路由下一跳节点(代理B)添加至cache_nexthops字段,表明将来接收到的缓存查找请求会转发给B。B也会进行类似的操作并将后继节点D作为缓存查找的下一跳。D接收到事件后发现自己被选为缓存点,则将事件存储于本地并将自己添加至缓存路由下一跳。代理E则根据事件消息头中的缓存点信息得知e1被缓存在了事件分发路径中的上游,于是将前趋节点D作为缓存路由下一跳。从而逐跳完成了缓存路由信息的构造。Assuming that the filter condition of user S 1 is f 1 , the publisher P publishes an event e 1 that meets the filter condition f 1 and selects agent D as the cache point, and e 1 carries the cache point information along the distribution path A→B→D→ E is matched and forwarded by the publisher to the subscriber hop by hop. Proxy A successfully matches the event with f 1 , reads the cache point information in the event message header and finds that its cache point is located downstream of itself, then adds the successfully matched subscription route next hop node (proxy B) to the cache_nexthops field, indicating Future received cache lookup requests will be forwarded to B. B will also perform similar operations and use the successor node D as the next hop for cache lookup. After receiving the event, D finds that it is selected as the cache point, then stores the event locally and adds itself to the next hop of the cache route. Proxy E knows that e 1 is cached upstream in the event distribution path according to the cache point information in the event message header, so it uses the predecessor node D as the next hop of the cache route. Thus, the construction of the cached routing information is completed hop by hop.

假设一个新用户S2连接到代理E并请求事件e1,由于新用户S2出现在事件e1的发布路径上,E查找路由表并与f1匹配成功后,根据cache_nexthops将请求转发给缓存下一跳(代理D),从而找到事件缓存,即是步骤S5中提到的第(1)种情况。Suppose a new user S 2 connects to proxy E and requests event e 1. Since new user S 2 appears on the publishing path of event e 1 , E searches the routing table and matches f 1 successfully, and forwards the request to the cache according to cache_nexthops The next hop (agent D) to find the event cache is the case (1) mentioned in step S5.

倘若S2出现在代理C处,由于新用户S2不在事件e1的发布路径上,C匹配成功的f1表项中不存在缓存路由信息(NIL),这时它会根据sub_nexthops将缓存请求向订阅者方向转发,即转发给代理B,而B恰好处于e1的分发路径上,可以根据缓存路由cache_nexthops将请求转发给D,这样最终也找到了缓存,即是步骤S5中提到的第(2)种情况。Request消息转发过程中会依次记录沿途所经节点的ID,用户的缓存请求最终到达代理D时,其中包含了一条节点链路:S2→C→B,即缓存请求路径。代理D将用户所请求的事件内容和这条链路一起封装成响应消息Response(e1,S2→C→B),沿链路的逆向回发给用户,完成缓存请求的响应。If S 2 appears at agent C, since the new user S 2 is not on the release path of event e 1 , C does not have cache routing information (NIL) in the successfully matched f 1 entry, then it will cache the request according to sub_nexthops Forward to the subscriber, that is, forward to agent B, and B happens to be on the distribution path of e 1 , and the request can be forwarded to D according to the cache route cache_nexthops, so that the cache is finally found, that is, the first step mentioned in step S5 (2) Situations. During the forwarding process of the Request message, the IDs of the nodes along the route will be recorded sequentially. When the user's cache request finally reaches the proxy D, it contains a node link: S 2 →C→B, which is the cache request path. Proxy D encapsulates the event content requested by the user and this link into a response message Response(e 1 , S 2 →C→B), and sends it back to the user along the reverse direction of the link to complete the cache request response.

实施例2:Example 2:

本实施例与实施例1的区别在于,事件消息头中的缓存点信息还包括缓存点位置、缓存副本数目以及缓存时间戳,每个事件缓存对应一个缓存时间戳。The difference between this embodiment and Embodiment 1 is that the cache point information in the event message header also includes the cache point location, the number of cache copies, and the cache timestamp, and each event cache corresponds to a cache timestamp.

在事件发布之前,所述缓存点位置、缓存副本数目以及缓存时间戳的初值均为空。在事件发布过程中,对于发布路径中的每个代理节点,若当前代理节点作为缓存点并进行缓存时,更新事件的消息头中记录的缓存点位置、缓存副本数目以及缓存时间戳,同时更新当前代理节点内存储的缓存点位置、缓存副本数目以及缓存时间戳。Before the event is released, the initial values of the location of the cache point, the number of cache copies, and the cache timestamp are all empty. During the event publishing process, for each proxy node in the publishing path, if the current proxy node is used as a cache point and cached, update the cache point location, the number of cache copies, and the cache timestamp recorded in the message header of the event, and update The location of the cache point, the number of cache copies, and the cache timestamp stored in the current proxy node.

在实际应用中,有可能会出现发布订阅网络中的存储空间耗尽的情形,因此,此时需要删除一些旧的缓存,释放出存储空间提供给新的缓存。在本实施例中,具体采用如下方法:在事件在发布过程中,沿途比较各代理节点的缓存时间戳,获得最旧缓存的位置,当事件抵达订阅节点时,若整条发布路径上的存储空间耗尽,则转回至最旧缓存的位置删除最旧的缓存。In practical applications, the storage space in the publish-subscribe network may be exhausted. Therefore, at this time, some old caches need to be deleted to release storage space for new caches. In this embodiment, the following method is specifically adopted: during the publishing process of the event, compare the cache timestamps of the proxy nodes along the way to obtain the location of the oldest cache. If the space is exhausted, go back to the location of the oldest cache and delete the oldest cache.

实施例3:Example 3:

为了对缓存冗余进行精简,在访存效率与存储占用率之间进行平衡,本实施例在实施例1的基础上加入了缓存精简的方法,具体方法如下:In order to streamline cache redundancy and balance between memory access efficiency and storage occupancy, this embodiment adds a cache streamlining method on the basis of Embodiment 1. The specific method is as follows:

在事件发布步骤中,对于每个代理节点,采用冗余精简方法对事件进行缓存,所述冗余精简方法具体为:In the event publishing step, for each proxy node, a redundancy reduction method is used to cache the event, and the redundancy reduction method is specifically:

表示事件分发树中所有代理节点的集合,表示事件分发树中的一个代理节点,其中, 表示节点bi的所有子节点集合,其中,每个代理节点为包含若干子节点bij,gij为每个子节点所对应的一棵子树,其中j=1,2,...,nt表示ni棵子树共同构成的bt的子树集合。make Represents the collection of all agent nodes in the event distribution tree, Represents an agent node in the event distribution tree, where, Represents the collection of all child nodes of node b i , where, Each proxy node contains several child nodes b ij , and g ij is each child node A corresponding subtree, where j=1, 2,..., n t ; Indicates the set of subtrees of b t composed of n i subtrees.

根据目标函数确定将缓存的副本分派到缓存点的哪些子树,如公式(1)所示:According to the objective function Determines which subtrees of cache points to dispatch cached copies to, as shown in equation (1):

其中,dij表示代理节点bt距离子树gij末端用户的最大距离,rij表示代理节点bi接收到来自子树gij的用户请求总数,sij表示子树gij中所有节点总的存储空闲率,t为缓存点参考值;目标函数的分子表示将事件的一个副本放置在子树gij上时,用户获取该副本的总开销;其中,分子的第一项为子树gij末端的用户请求该副本时的开销,分子的第二项则表示其余子树上的用户请求该副本时的总开销。Among them, d ij represents the maximum distance between the proxy node b t and the end user of the subtree g ij , r ij represents the total number of user requests received by the proxy node b i from the subtree g ij , s ij represents the total number of all nodes in the subtree g ij The storage idle rate of , t is the reference value of the cache point; the objective function The numerator of the event represents the total cost of getting a copy of the event when the user places it on the subtree g ij ; the first item of the numerator is the cost when the user at the end of the subtree g ij requests the copy, and the first item of the numerator The binomial represents the rest of the subtrees The total overhead when users on the server request this copy.

这里的距离dtj-t和dti+t只是一个近似值,每个代理节点无法得知子树的确切拓扑结构,故而近似认为每个用户到缓存点距离等同。缓存请求的总开销越小,或子树上总存储空间空闲率越大,则目标函数值越小。The distances d tj -t and d ti +t here are only approximate values, and each proxy node cannot know the exact topology of the subtree, so it is approximately considered that the distance from each user to the cache point is the same. The smaller the total overhead of the cache request, or the larger the free rate of the total storage space on the subtree, the smaller the value of the objective function.

代理节点bt为每个子节点bij各计算一个目标选择其值最小的m=min{k,nt}棵子树gt1,gt2,...,gtm分派副本,并相应地将发往子节点bt1,bt2,...,btm的事件的副本数目k根据公式(2)进行修改:The proxy node b t calculates a goal for each child node b ij Select m=min{k, n t } subtrees g t1 , g t2 , ..., g tm with the smallest value to assign copies, and correspondingly send copies to child nodes b t1 , b t2 , ..., b The replica number k of the event of tm is modified according to formula (2):

将发往其他子节点btt的事件的副本数目k设为ki=0(m<l≤nt),相应的t值归0。Set the replica number k of events sent to other child nodes b tt as k i =0 (m<l≤n t ), and return the corresponding t value to 0.

每一个做为缓存点的代理节点都进行上述处理,从而由各代理节点分布式地完成缓存副本的存放。Each proxy node serving as a cache point performs the above processing, so that each proxy node completes the storage of the cache copy in a distributed manner.

以上公开的仅为本申请的一个具体实施例,但本申请并非局限于此任何本领域的技术人员能思之的变化,都应落在本申请的保护范围内。The above disclosure is only a specific embodiment of the present application, but the present application is not limited thereto. Any changes conceivable by those skilled in the art should fall within the protection scope of the present application.

Claims (10)

1.一种用于发布订阅系统的实现历史事件订阅的缓存方法,其特征在于,包括如下步骤:1. A caching method for realizing historical event subscription for a publish-subscribe system, characterized in that, comprising the steps: 路由表扩充步骤:在各代理节点的路由表中增设缓存路由信息,所述缓存路由信息用于提供能够定位到缓存点的路由信息;Routing table expansion step: adding cached routing information in the routing table of each proxy node, the cached routing information is used to provide routing information that can be located to the cache point; 事件处理步骤:当某一代理节点发出一事件时,通过哈希函数进行计算,得到一缓存点参考值;为所述事件附加一消息头,所述消息头中记录了缓存点信息以及订阅路径信息;所述缓存点信息中包括所述缓存点参考值;Event processing steps: when a proxy node sends out an event, calculate it through a hash function to obtain a cache point reference value; add a message header to the event, and record the cache point information and subscription path in the message header information; the cache point information includes the cache point reference value; 事件发布步骤:根据所述消息头中记录的订阅路径信息,将所述事件向对应的订阅节点进行发布;对于发布路径中的每个代理节点,根据所述缓存点参考值判断当前代理节点是否作为缓存点并进行缓存,同时,当前代理节点同步更新对应于所述事件的缓存路由信息;Event publishing step: according to the subscription path information recorded in the message header, publish the event to the corresponding subscription node; for each proxy node in the publishing path, judge whether the current proxy node is As a cache point and cache, at the same time, the current proxy node synchronously updates the cache routing information corresponding to the event; 缓存订阅步骤:某一代理节点发出一缓存请求,所述缓存请求中包含订阅条件;将所述订阅条件与当前代理节点的路由表中预存的过滤条件进行匹配,确定缓存事件;所述缓存事件是指,与订阅条件匹配成功的过滤条件对应的事件;Cache subscription step: a certain proxy node sends a cache request, and the cache request includes a subscription condition; the subscription condition is matched with the pre-stored filter conditions in the routing table of the current proxy node to determine a cache event; the cache event Refers to the event corresponding to the filter condition that successfully matches the subscription condition; 缓存获取步骤:若当前代理节点的路由表中包含所述缓存事件对应的缓存路由信息,则直接根据该缓存路由信息找到所述缓存事件对应的缓存点,将缓存请求转发到缓存点,获取缓存;若当前代理节点的路由表中不包含所述缓存事件对应的缓存路由信息,则根据所述缓存事件对应的订阅路由信息,将缓存请求发送到下一个代理节点,回转执行缓存获取步骤。Cache acquisition step: If the routing table of the current proxy node contains the cache routing information corresponding to the cache event, then directly find the cache point corresponding to the cache event according to the cache routing information, forward the cache request to the cache point, and obtain the cache ; If the routing table of the current proxy node does not contain the cache routing information corresponding to the cache event, then according to the subscription routing information corresponding to the cache event, send the cache request to the next proxy node, and perform the cache acquisition step in turn. 2.根据权利要求1所述的缓存方法,其特征在于,所述哈希函数如公式(1)所示:2. The caching method according to claim 1, wherein the hash function is as shown in formula (1): 所述哈希函数的定义域为事件e的取值范围(a,b),值域为[0,MAX_HOP];其中MAX_HOP是事件分发路径上的代理节点到其根节点的最大距离。The definition domain of the hash function is the value range (a, b) of the event e, and the value range is [0, MAX_HOP]; where MAX_HOP is the maximum distance from the agent node on the event distribution path to its root node. 3.根据权利要求2所述的缓存方法,其特征在于,根据所述缓存点参考值判断当前代理节点是否作为缓存点并进行缓存具体为:3. The caching method according to claim 2, wherein judging whether the current agent node is used as a caching point according to the caching point reference value and caching is specifically: 当前代理节点收到事件后先将所述缓存点参考值t减1,然后根据缓存点参考值进行判断,若t=0,则将当前代理节点做为缓存点。After receiving the event, the current proxy node firstly subtracts 1 from the cache point reference value t, and then judges according to the cache point reference value. If t=0, the current proxy node is used as the cache point. 4.根据权利要求1所述的缓存方法,其特征在于,所述路由表扩充步骤具体为:4. The caching method according to claim 1, wherein the routing table expansion step is specifically: 在各代理节点的路由表中增加cache_nexthops字段,使得所述路由表的结构为:Add the cache_nexthops field in the routing table of each proxy node, so that the structure of the routing table is: <filter|sub_nexthops|cache_nexthops><filter|sub_nexthops|cache_nexthops> 其中,filter是指过滤条件,sub_nexthops记录了与filter匹配成功的事件向订阅节点方向转发的下一跳代理,cache_nexthops记录了与filter匹配成功的缓存请求向缓存点方向转发的下一跳代理。Among them, filter refers to the filter condition, sub_nexthops records the next-hop agent that forwards the events that successfully match the filter to the direction of the subscription node, and cache_nexthops records the next-hop agent that forwards the cache request that successfully matches the filter to the direction of the cache point. 5.根据权利要求4所述的缓存方法,其特征在于,所述事件发布步骤中,对于事件在发布过程中的当前代理节点,其缓存路由信息的更新方法具体为:5. The caching method according to claim 4, characterized in that, in the event publishing step, for the current agent node in the publishing process of the event, the update method of its cache routing information is specifically: 若当前代理节点在缓存点的后方,则将缓存路由信息中的下一跳设置为前驱的代理节点;If the current proxy node is behind the cache point, the next hop in the cache routing information is set as the predecessor proxy node; 若当前代理节点正好为缓存点,则将缓存路由信息中的下一跳设置为当前代理节点自身;If the current proxy node happens to be a cache point, the next hop in the cache routing information is set to the current proxy node itself; 若当前代理节点在缓存点的前方,则将缓存路由信息中的下一跳设置为后继的代理节点。If the current proxy node is in front of the cache point, the next hop in the cache routing information is set as the subsequent proxy node. 6.根据权利要求5所述的缓存方法,其特征在于,所述缓存获取步骤中,将缓存请求转发到缓存点获取缓存的方法具体为:6. The cache method according to claim 5, wherein in the cache acquisition step, the method of forwarding the cache request to the cache point to obtain the cache is specifically: 在缓存请求转发到缓存点的过程中依次记录沿途经过的代理节点,记为缓存请求路径;缓存请求到达缓存点后,缓存点将请求的缓存沿缓存请求路径的逆序发送给发出缓存请求的代理节点。In the process of forwarding the cache request to the cache point, record the proxy nodes along the way in sequence, which is recorded as the cache request path; after the cache request reaches the cache point, the cache point sends the requested cache along the cache request path in reverse order to the proxy that issued the cache request node. 7.根据权利要求1所述的缓存方法,其特征在于,所述事件发布步骤中,若当前代理节点作为缓存点并进行缓存时,进行判断:若当前代理节点的存储空间耗尽,则询问该事件发布路径之外的直接邻居是否尚有可用存储空间;若该邻居有可用存储空间,则将事件转发给该邻居进行缓存。7. The caching method according to claim 1, wherein in the event publishing step, if the current proxy node is used as a cache point and cached, it is judged: if the storage space of the current proxy node is exhausted, then query Whether the direct neighbor outside the event distribution path still has available storage space; if the neighbor has available storage space, the event will be forwarded to the neighbor for caching. 8.根据权利要求1所述的缓存方法,其特征在于,所述缓存点信息还包括缓存点位置、缓存副本数目以及缓存时间戳,所述缓存点位置、缓存副本数目以及缓存时间戳的初值均为空;对于发布路径中的每个代理节点,若当前代理节点作为缓存点并进行缓存时,更新事件的消息头中记录的缓存点位置、缓存副本数目以及缓存时间戳,同时更新当前代理节点内存储的缓存点位置、缓存副本数目以及缓存时间戳。8. The caching method according to claim 1, wherein the cache point information further comprises a cache point location, a cache copy number, and a cache timestamp, and the cache point location, the cache copy number, and the cache timestamp are initially The values are all empty; for each proxy node in the publishing path, if the current proxy node is used as a cache point and cached, update the cache point location, the number of cache copies, and the cache timestamp recorded in the message header of the event, and update the current The location of the cache point, the number of cache copies, and the cache timestamp stored in the proxy node. 9.根据权利要求8所述的缓存方法,其特征在于,在事件在发布过程中,沿途比较各代理节点的缓存时间戳,获得最旧缓存的位置,当事件抵达订阅节点时,若整条发布路径上的存储空间耗尽,则转回至最旧缓存的位置删除最旧的缓存。9. The caching method according to claim 8, characterized in that, during the publishing process of the event, the cache timestamps of the proxy nodes are compared along the way to obtain the position of the oldest cache, when the event arrives at the subscribing node, if the entire If the storage space on the publishing path is exhausted, go back to the location of the oldest cache and delete the oldest cache. 10.根据权利要求1所述的缓存方法,其特征在于,所述事件发布步骤中,对于每个代理节点,采用冗余精简方法对事件进行缓存,所述冗余精简方法具体为:10. The caching method according to claim 1, wherein in the event publishing step, for each proxy node, a redundancy reduction method is used to cache the event, and the redundancy reduction method is specifically: 设代理节点为bi,其包含若干子节点bij,设gij为每个子节点bij对应的子树;根据目标函数确定将缓存的副本分派到缓存点的哪些子树,如公式(2)所示:Let the proxy node be b i , which contains several child nodes b ij , and let g ij be the subtree corresponding to each child node b ij ; according to the objective function Determines which subtrees of cache points to dispatch cached copies to, as shown in equation (2): 其中,dij表示代理节点bi距离子树gij末端用户的最大距离,rij表示代理节点bi接收到来自子树gij的用户请求总数,sij表示子树gij中所有节点总的存储空闲率,t为缓存点参考值;目标函数的分子表示将事件的一个副本放置在子树gij上时,用户获取该副本的总开销;其中,分子的第一项为子树gij末端的用户请求该副本时的开销,分子的第二项则表示其余子树上的用户请求该副本时的总开销;Among them, d ij represents the maximum distance between the proxy node bi and the end user of the subtree g ij , r ij represents the total number of user requests received by the proxy node bi from the subtree g ij , s ij represents the total number of all nodes in the subtree g ij The storage idle rate of , t is the reference value of the cache point; the objective function The numerator of represents the total cost for the user to obtain a copy of the event when it is placed on the subtree g ij ; among them, the first item of the numerator is the cost when the user at the end of the subtree g ij requests the copy, and the first item of the numerator The binomial represents the rest of the subtrees The total overhead when users on the network request this copy; 代理节点bi为每个子节点bij各计算一个目标选择其值最小的m=min{k,ni}棵子树gi1,gi2,...,gim分派副本,并相应地将发往子节点bl1,bl2,...,blm的事件的副本数目k根据公式(3)进行修改:The proxy node b i calculates a goal for each child node b ij Select m=min{k, n i } sub-trees g i1 , g i2 , ..., g im with the smallest value to assign copies, and correspondingly send copies to child nodes b l1 , b l2 , ..., b The replica number k of events of lm is modified according to formula (3): 将发往其他子节点bii的事件的副本数目k设为kl=0(m<l≤ni),相应的t值归0。Set the replica number k of events sent to other child nodes b ii as k l =0 (m<l≤n i ), and return the corresponding t value to 0.
CN201410075650.2A 2014-03-04 2014-03-04 Caching method for publishing and subscription system to achieve historical event subscription Active CN103888517B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410075650.2A CN103888517B (en) 2014-03-04 2014-03-04 Caching method for publishing and subscription system to achieve historical event subscription

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410075650.2A CN103888517B (en) 2014-03-04 2014-03-04 Caching method for publishing and subscription system to achieve historical event subscription

Publications (2)

Publication Number Publication Date
CN103888517A CN103888517A (en) 2014-06-25
CN103888517B true CN103888517B (en) 2017-01-18

Family

ID=50957233

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410075650.2A Active CN103888517B (en) 2014-03-04 2014-03-04 Caching method for publishing and subscription system to achieve historical event subscription

Country Status (1)

Country Link
CN (1) CN103888517B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9733995B2 (en) * 2014-12-17 2017-08-15 Intel Corporation Scalable synchronization mechanism for distributed memory
CN106790402B (en) * 2016-11-29 2020-10-23 苏州浪潮智能科技有限公司 Parallel distribution method and system for middleware data of information system structure
CN112835911B (en) * 2021-03-10 2022-12-02 四川大学华西医院 A master data management system suitable for medical information platform
CN113904979A (en) * 2021-10-09 2022-01-07 南京工业职业技术大学 A Content-Based Routing Service Method Supporting Publish-Subscribe System Traffic Regulation
CN114844948B (en) * 2021-12-14 2024-05-31 合肥哈工轩辕智能科技有限公司 Client cache optimization method and device of real-time distribution system
CN116264605B (en) * 2022-07-12 2025-06-13 深圳市芯睿视科技有限公司 Event processing method, device and system, program product and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170522A (en) * 2007-12-03 2008-04-30 华为技术有限公司 A method and system for publishing historical events
CN102891797A (en) * 2012-07-02 2013-01-23 上海交通大学 Publishing and subscription method capable of supporting message duration

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170522A (en) * 2007-12-03 2008-04-30 华为技术有限公司 A method and system for publishing historical events
CN102891797A (en) * 2012-07-02 2013-01-23 上海交通大学 Publishing and subscription method capable of supporting message duration

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
"Caching in content-based publish/subscribe systems";V.Sourlas等;《Proc. 28th IEEE Conference on Global Telecommunications》;20091204;第1-8页 *
"Caching Mechanism In Publish Subscribe Network";Hongjie Tan , Jian Cao , Minglu Li;《The 7th International Conference on Intelligent Systems and Knowledge Engineering》;20131123;第641-652页 *
"Controlling historical information dissemination in publish/subscribe";Singh J., Eyers D. M., Bacon J.;《proceedings of the 2008 Workshop on Middleware Security (MidSec2008)》;20081230;第34–39页 *
"Historic data access in publish/subscribe";Li G., Cheung A., Hou S., Hu S.等;《Proceedings of the 2007 inaugural international Conference on Distributed Event-Based Systems(DEBS 2007)》;20071230;第80–84页 *

Also Published As

Publication number Publication date
CN103888517A (en) 2014-06-25

Similar Documents

Publication Publication Date Title
CN103888517B (en) Caching method for publishing and subscription system to achieve historical event subscription
CN101529809B (en) Distributed storage of routing information in a link state protocol controlled network
KR20160076445A (en) System and method for efficient name-based content routing using link-state information in information-centric networks
US10091012B2 (en) System and method for multi-source multicasting in content-centric networks
KR20170037818A (en) Information-centric networking with small multi-path or single-path forwarding state
US9385947B2 (en) Message transport system using publication and subscription mechanisms
KR102160494B1 (en) Network nodes, endpoint nodes, and how to receive messages of interest
CN102143199A (en) Content acquisition method, node and content network
JP2016116218A (en) System and method for distance-based interest forwarding
EP2882149A1 (en) Distance-based routing in an information-centric network
JP2016059039A (en) Interest-keepalive at intermediate router in CCN
US11223697B2 (en) Scaling microservices communication over information centric networks
CN103095587B (en) A method for registration service, network group center control nodes and system
CN110113264A (en) A kind of caching and route implementation method for naming data network
CN103179161B (en) A kind of content acquisition method, device and network system
US10536368B2 (en) Network-aware routing in information centric networking
CN104158736A (en) Method and apparatus for determining next hop, and method and apparatus for issuing router information
CN103873465B (en) A kind of caching method of the distribution subscription system being applicable to mobile context
CN104506431B (en) A kind of content search method of content center network, and router and node
CN106817261B (en) A routing information updating method, device and system for NDN network
KR20180136845A (en) Method for transmitting packet, applying aco, in secure surveilance network, apparatus for transmitting packet in secure surveilance network, and icn secure surveilance system applying aco
JP5012712B2 (en) Content distributed storage system, total evaluation value management device, management processing program, node device, and total evaluation value management method
Hashimoto et al. In-network hop-aware query induction scheme for implicit coordinated content caching
US8108547B1 (en) Symbolic links in a distributed system
JP5954330B2 (en) Event notification service method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200116

Address after: Room 1709, Building No. 8, Binjiang West Road, Jiangyin City, Wuxi City, Jiangsu Province

Patentee after: Jiangyin Daily Information Technology Co., Ltd.

Address before: 200240 Dongchuan Road, Shanghai, No. 800, No.

Patentee before: Shanghai Jiaotong University

TR01 Transfer of patent right