Embodiment
Be described below in detail embodiments of the invention, the example of described embodiment is shown in the drawings, and wherein same or similar label represents same or similar element or has element that is identical or similar functions from start to finish.Being exemplary below by the embodiment be described with reference to the drawings, only for explaining the present invention, and can not limitation of the present invention being interpreted as.
In describing the invention, term " interior ", " outward ", " longitudinal direction ", " transverse direction ", " on ", D score, " top ", the orientation of the instruction such as " end " or position relationship be based on orientation shown in the drawings or position relationship, be only the present invention for convenience of description instead of require that the present invention with specific azimuth configuration and operation, therefore must can not be interpreted as limitation of the present invention.
Refer to Fig. 1, Figure 1 shows that the module map of data cache placement system 10 in an embodiment of the present invention.
In the present embodiment, data cache placement system 10 comprises: computing module 102, judge module 104, selection module 106, continuation module 108, memory 110 and processor 112, wherein, computing module 102, judge module 104, selection module 106 and continuation module 108 store in the memory 110, and processor 112 is for performing storage functional module in the memory 110.
In the present embodiment, data cache placement system 10 is in wireless network, and wherein, wireless network comprises multiple node.
In the present embodiment, cache node set C, candidate's node set H, the nearest cache node set NC of all nodes and coefficient of competition set CC is provided with in memory 110.In the present embodiment, under initial situation, data source node belongs to cache node set C and nearest cache node set NC.
In the present embodiment, computing module 102 is for calculating the data flow that liquidates of each node in described wireless network.
Judge module 104 is for judging whether a node is less than the distance of a certain node to nearest cache node to the distance of a certain node.
In the present embodiment, computing module 102 is also for being less than a certain node to the data flow that liquidates increasing this node during the distance of nearest cache node at a node to the distance of a certain node.
In the present embodiment, the data flow that liquidates described in is that node is as increasing during cache node and the data flow sum reduced.
In the present embodiment, the hedge fund in the concept of the data flow that liquidates (Hedging Data Flow) and financial industry has the place of playing the same tune on different musical instruments.The type of the data flow existed in caching system comprises following three kinds: the data flow of the first type is visit data stream (Accessing DataFlow), referred to as ADF, and the request situation of a node visit data in this description of data stream network; The second is reply data stream (Reply Data Flow), and referred to as RDF, this description of data stream data source node or cache node reply the situation of the request of data of other nodes; The third is update data stream (Update Data Flow), referred to as UDF, this description of data stream be the data flow that data source upgrades the data copy on cache node and produces.
Therefore comprehensive above-mentioned four kinds of data flow, if desired increase a cache node, just need minimizing visit data stream as much as possible and reply data stream, the update data stream also needing minimizing as much as possible and introduce because increasing cache node.
In the present embodiment, the relation between the data flow that liquidates and other three kinds of data flow:
HDF(i)=ΔADF(i)+ΔRDF(i)-UDF(i)
Incorporated by reference to Fig. 2, Figure 2 shows that computing module 102 calculates an embodiment of the data flow that liquidates.In embodiments, the path of tentation data access is the same with the path that data return, and therefore, visit data stream and reply data stream can be combined, have visit data stream just to have reply data stream as long as also just mean.
In the figure in the upper left corner in fig. 2, node N1 is data source.
If in the figure in the upper right corner of Fig. 2, plan selects N3 to be cache node, and the visit data stream so reduced should be:
ΔADF(3)=(f
a(4)+f
a(5)+f
a(6)+f
a(7)+f
a(8))×(s
r+s
d)×w(3,1) (1)
In superincumbent formula (1), f
a(4) frequency of node N4 visit data is represented, s
rand s
drepresent the size of data itself and the size of request of data respectively, w (3,1) represents the weight of path just from node N3 to data source N1.
Formula (1) above represents, other nodes will go data source N1 to go to have access to data through node N3 originally, as long as just can have access to data now on node N3.Like this, double bounce (2hops) can just be reduced for other nodes N4 to N8.According to same reason, originally node N3 does not need from update data stream, and now because it act as cache node, therefore just add update data stream, the data flow of increase can represent with formula below:
UDF(3)=f
U×s
d×w(1,3) (2)
In formula (2), f
urepresent the frequency of data source more new data, s
drepresent the size of data itself, w (1,3) represents that path is just from data source N1 to the weight of node N3.
In the present embodiment, judge module 104 is also for judging whether the data flow that liquidates of this node is greater than first threshold.
Select module 106 for electing this node as candidate node when the data flow that liquidates of this node is greater than first threshold, and by this node join to candidate's node set.
In the present embodiment, computing module 102 also calculates this candidate's node coefficient of competition in the wireless network for liquidate data flow and the distance between this candidate's node and cache node according to this candidate's node.
In the present embodiment, the coefficient of competition of node Ni is defined as follows:
In the present embodiment, the node Ni coefficient of competition in formula (3) depends primarily on the distance of node Ni to nearest cache node, and the amount of node Ni and the data flow through node Ni visit data.
Judge module 104 is also with judging whether described coefficient of competition is greater than Second Threshold.
Described selection module 106 also for when described coefficient of competition is greater than Second Threshold using this candidate's node as cache node, and by this candidate's node join to cache node set.
In the present embodiment, to during the distance of nearest cache node, described judge module 104 also judges whether described candidate's node set is empty for being more than or equal to a certain node at a node to the distance of a certain node, and do not judge whether this node is last node for empty at described candidate's node set.
In the present embodiment, for empty, described judge module 104 also for judging when the data flow that liquidates of this node is less than or equal to first threshold whether described candidate's node set is empty, and does not judge whether this node is last node at described candidate's node set.
In the present embodiment, for empty, described judge module 104 also for judging when described coefficient of competition is less than or equal to Second Threshold whether described candidate's node set is empty, and does not judge whether this node is last node at described candidate's node set.
In the present embodiment, continue module 108 to process next node for continuing when described node is not last node.
Refer to Fig. 3, Figure 3 shows that in an embodiment of the present invention the flow chart utilizing the data cache placement system 10 shown in Fig. 1 to carry out the method for data buffer storage.
In the present embodiment, the method for data buffer storage is used in wireless network, and wherein wireless network comprises multiple node.
In the present embodiment, cache node set C, candidate's node set H, the nearest cache node set NC of all nodes and coefficient of competition set CC is provided with in memory 110.In the present embodiment, under initial situation, data source node belongs to cache node set C and nearest cache node set NC.
In step S200, computing module 102 calculates the data flow that liquidates of each node in described wireless network.
In the present embodiment, the data flow that liquidates described in is that node is as increasing during cache node and the data flow sum reduced.
In the present embodiment, computing module 102 is according to the data flow that liquidates of following formulae discovery node.
HDF(i)=ΔADF(i)+ΔRDF(i)-UDF(i)
In step S202, judge module 104 judges whether a node is less than the distance of a certain node to nearest cache node to the distance of a certain node.
If a node is less than the distance of a certain node to nearest cache node to the distance of a certain node, then in step S204, computing module 102 increases the data flow that liquidates of this node.
In the present embodiment, computing module 102 increases the data flow that liquidates of this node according to following formula.
HDF(x)+=(w(y,NC[y])-w(y,x))*(s
d+s
r)*f
a(y)
In step S206, judge module 104 judges whether the data flow that liquidates of this node is greater than first threshold.
If the data flow that liquidates of this node is greater than first threshold, then in step S208, module 106 is selected to elect this node as candidate node, and by this node join to candidate's node set.
In step S210, computing module 102 calculates this candidate's node coefficient of competition in the wireless network according to liquidate data flow and the distance between this candidate's node and cache node of this candidate's node.
In the present embodiment, the coefficient of competition of node Ni is defined as:
In the present embodiment, node Ni coefficient of competition depends primarily on the distance of node Ni to nearest cache node, and the amount of node Ni and the data flow through node Ni visit data.
In step S212, judge module 104 judges whether described coefficient of competition is greater than Second Threshold.
If described coefficient of competition is greater than Second Threshold, then in step S214, select module 106 using this candidate's node as cache node, and by this candidate's node join to cache node set.
If the judged result in step S202 is a node be more than or equal to the distance of a certain node to nearest cache node to the distance of a certain node, then in step S216, judge module 104 judges whether this node is last node.
If the data flow that liquidates that the judged result in step S206 is this node is less than or equal to first threshold, then in step S216, judge module 104 judges whether the described nodal set that selects is empty.
If described candidate's nodal set is not empty, then in step S218, judge module 104 judges whether this node is last node.
If the judged result in step S210 is described coefficient of competition be less than or equal to Second Threshold, then in step S216, judge module 104 judges whether the described nodal set that selects is empty.
If described candidate's nodal set is not empty, then in step S216, judge module 104 judges whether this node is last node.
If the judged result in step S216 is described node is not last node, then in step S218, continue module 108 and continue to process next node.
Whether be candidate node by judging the data flow that liquidates of node whether to be greater than first threshold if deciding node for data cache placement system 10 in embodiment of the present invention and the method for data buffer storage, then calculated candidate binding place coefficient of competition and judge whether coefficient of competition is greater than Second Threshold and decides node whether cache node, form cache node set, decrease the analysis to data flow, and data cached access delay, decrease the expense of data access in network simultaneously.
Although the present invention is described with reference to current better embodiment; but those skilled in the art will be understood that; above-mentioned better embodiment is only used for the present invention is described; not be used for limiting protection scope of the present invention; any within the spirit and principles in the present invention scope; any modification of doing, equivalence replacement, improvement etc., all should be included within the scope of the present invention.