• 沒有找到結果。

CHAPTER 2 Related Work

2.2 Query-based DTN routing protocol

2.2.4 Searching for Content in Mobile DTNs [14]

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

12 

2.2.4 Searching for Content in Mobile DTNs [14]

This research focuses on query how to forward and how many queries are replicated. They propose an estimation rule to avoid the query replicates too much.

When Node A encountered Node B, Node A will estimate the query had been replicated numbers first. The estimate value is calculated by query hop count and network nodes, then, Node A could get a Utility value ( ), if it greater than a threshold T, Node A could send the query to Node B. If not, Node A couldn’t.

Therefore, if this approach can estimate the query replication number accurately, it will greatly decrease transmission overhead and look up data efficiently. But, they just use common multi-copy routing schemes to reply data. And the simulation result, they don’t have compare with other approaches, so we can’t know how this research performed.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

13 

CHAPTER 3

Location-Based Content Search Approach

We proposed Location-Based Content Search Approach (LCS) in hybrid DTN to solve the query problem in case of disruptive Internet connection. In our research scenario, all nodes in the network are divided into two types, (1) Online-node and (2) Offline-node. Online-node can connect to the internet to access the remote server, and Offline-node cannot connect to that. All nodes have own database and it includes four tables (see Figure 4), (a) Data Message Table、(b) Encounter Nodes Table、(c) Query Message Table and (d) Reply Message Table. Then we describe below:

(a) Data_table: This table is in charge of the data message storing which is created from node self or received from the other nodes. DataId is the data message unique id, UID is the node id who created this data message, Time is the message creation time or replication time, Data is this message’s content, Sync is whether this message synchronized to the remote server or not. The detail will be described in Section 3.1.

(b) ENs_table: This table is responsible for recording encounter node. UID is the node id of the encounter node, Time is the encounter time, Longitude and Latitude is the encounter location.

(c) Query_table: This table is in charge of the query message storing, if node is

line-node, a ry message yMsg is the ail will be d (d) Reply ated from th que id of thi he reply dat l be describe

Q

In this the d by the o

all query m e unique id e content, is described in y_table: this he node tha is message, ta content, D ed in Sectio

Data_table

Query_table

esis, our go ther nodes

essages are d, Time is t sQueried is

Section 3.2 s table is in at received q Time is thi

e received f this messag whether th 2.

n charge of query mess is message c

the unique

4: Database

the Offline s possible.

from other ge creation his message

f the reply age and had creation tim id of the d

R

e Tables

e-node could In order to

Offline-nod time or re e queried d

message st d match dat me or replica estination n

ENs_table

Reply_table

d get the in o reach this

de. QryId is eplication t data or not.

toring whic ata. RepId is ation time, D node. The d

posed four ery replicat date.

In this the ee parts, Ins

Inside Are ea meters des in differe

er to identif ail see the [ Latitude tw urate to 0.5 P) to calcula

strategies tion strategi

esis, we ass ide Area, B

ea is within s is Border A

ent area use fy the node [26]), this fo wo points to millimeter ate the distan

to solve th ic, (3) Data

sume the ar order Area

Figure 5: T

n a radius o Area and th e different w

position, w formula con o calculate . We use th nce d, if

15 

his problem a reply stra

rea range is and Outside

Three parts

of γ meters he other area

ways to sele we refer to th nsidered the

the shortes he node posi

≤ , it indi a is Outside ect message he Vincenty e earth is ell t distance s ition point a icates the no

a replication Data synch

d we divide it shown as

central, ou e Area. This es and deliv y’s formula[

lipsoid, and s, and the d and the Are ode is in the

n strategic, hronization

ed the area s Figure 5.

utside the In s intention i ver message [26](Formu d use Longi deviation ca ea Central P

e Inside Are , (2)

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

16 

> ≤ + , it indicates the node is in the Border Area, if > + , it means the node is in the Outside Area.

= ( − ∆ ) (1)[26]

When two nodes encounter, they will change their metadata first (shown as Table 1), it includes node’s position, node’s type (Online-node or Offline node), node past moved path point, node encounter nodes, node collected Data message index list, Query message index list and Reply message index list.

Table 1: Metadata format

Category Value Position Longitude, Latitude

TYPE {0,1}

Path {Pt-1, Pt-2}

Encounter {UID1,UID2,…..,UIDn}

Data list {DataId1_UID1_Time1_Sync1,……,DataIdn_UIDn_Timen_Syncn} Query list {QryId1_Time1_isQueried1,…., QryIdn_Timen_isQueriedn} Reply list {RepId1_Time1, RepId2_Time2,….., RepIdn_Timen}

When two nodes encountered, we call ourself as Node A, encounter node as Node B, the Location-based Content Search approach (LCS) workflow is shown as Figure 6, and the transmission protocol is shown as Figure 7. First, Node A and Node B always detect connection, when encountering, Node A will send a metadata request to Node B, after receiving the request, Node B returned its metadata to Node A, when Node A received the metadata from Node B, the first step is check and filer the identical messages from Node A’s database, then keep the message which Node B doesn’t have, and rebuilt that metadata. The next step is Message Selection, it selects the messages which can be sent to Node B. There are three strategies step we

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

17 

proposed to select the messages, (1) Data replication strategic, Node A selected the Data messages according to Node A’s position. The detail description is in Section 3.1.

(2) Data Reply strategic, get the Query message from metadata, if Node A’s database have the queried data message, Node A will generate a Reply message. The detail description is in Section 3.2. (3) Query replication strategic, this strategic must be handled after Data Reply strategic complete, and the queries which queried data shouldn’t send out anymore. The detail description is in Section 3.3. After completing three message selection steps, Node A has chosen the messages which will be sent to Node B. The next step, Node A will check the Data messages which doesn’t synchronize to the remote server. If Node A is an Online-node, it will sync this Data messages to the server, if not, Node A doesn’t do anything, and the detail will be described in Section 3.4. Before sending messages to Node B, Node A has to schedule to messages which will be sent first. Because of the contact time of two nodes are short, it couldn’t send all the messages to the other nodes. Therefore, how send the messages to the encounter node efficiency, it is shown in Section 3.5. Then, Node A sends the selection message queue to Node B. As Node B receiving, it will check the Data messages whether it sync to server or not. If Node B is an Online-node, then sync the message to server, if not, skip this action, and then finish this contact.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

18 

 

Figure 6: LCS workflow

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

19 

  Figure 7: LCS transmission protocol

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

20 

3.1 Data replication strategic

When two nodes encountered in the map, the processing step can be seen in Figure 8, and the selection rule is shown in Formula 2, (1) If the distance d between Node A and Area Central Point (CP) is less than or equal to radius γ, it indicates Node A is in the Inside Area. When Node A encountered Node B, it will add all the Data messages into the Data dataset D_set to prepare to send to the Node B. The main purpose is let the Inside Area fulfill with related Data messages. If any node wondered to query in this area, it can get the Data messages quickly and has high query success rate. But the encounter time of the two nodes and the transmission are limited, two nodes have to change itself metadata before transport. Then, Node A skips the identical Data messages, and adds the others into D_set; (2) If the distance d between Node A and CP is greater than radius γ and less than γ + , it indicates Node A is in the Border Area. According to Node B’s past path, if ∆ . < 0, it indicates Node B will likely enter to the Inside Area, then, Node A add the Data messages into the D_set; (3) if the distance d between Node A and CP is greater than γ + , it indicates Node A is in the Outside Area, then, Node A shouldn’t do anything.

We use ∆ . to predict whether Node B’s will enter to the Inside Area or not.

In Formula 3, . is the distance between Node B position Pt-1 and CP at time t-1, and . is the distance between Node B position Pt-2 and CP at time t-2.

Then, subtract . from . , if the result is less than 0, it means Node B is likely to enter to the Inside Area, if the result is granter then 0, it means Node B is likely to move away from the Inside Area.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

21 

( , _ ) =

, . ≤

, . > . ≤ +

2 ∆ . < 0

,

(2)

∆ . = ( . − . ) (3)

In order to avoid data overflow, we set all the Data messages a storing time TTS (Time-to-Store) (Formula 4). TTS means the time of any message be created or replicated then store in some node. When TTS expired, the messages will drop anymore. Therefore, it can reduce the node loading.

( ) = , _ _

, ℎ (4)

 

Otherwise, if Node B is an Online-node, Node A doesn’t need to send Data messages to Node B. Because the Online-node can connect to the Internet to get the messages by itself, it doesn’t require wasting the resource to send messages.

 

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

22 

  Figure 8: Data replication strategic flow chart

 

3.2 Query replication strategic

This strategic has to do after the Data reply strategic, and the goal of this strategic is let user queried data in a shortest time. This is a three-tier Query strategic, from Node A’s local database to Node B’s local database then remote server. Query replication detail rule can see in Formula 5 and Figure 9 flow chart. When Node A receiving query messages, it has to check the database whether the query messages have the match data. If has, it doesn’t need to do Query replication, if not, there are some rules to do. (1) Node A is an Online-node. It does nothing. (2) Node A is an

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

23 

Offline-node. When Node A in the Inside Area, and then adds all the related Query messages to the Query dataset Q_set; When Node A in the Border Area, then Node A has to predict Node B’s direction ( . , the detail can see in Section 3.1, and also is shown in Formula 3), if . less than 0, it indicates Node B is likely to enter to the Inside Area, then, add the related Query messages to the Q_set. If not, then do nothing. The main purpose is Data replication strategic will centralize the related Data messages in the Inside Area. Therefore, we send the queries to the Inside Area, and there is more opportunity to query success. It has two reasons. One, There are many related messages in the Inside Area. The other, if any node leave from Inside Area, we expect it could carry much more related messages; When Node A in the Outside Area, it shouldn’t do anything.

In addition, if the query represents it had been queried ( . = ), then we don’t have to add this query into the Q_set.

( , _ ) =

, .

, . > . ≤ +

2 . < 0 ,

, ,

( ) =

. =

(5)

 

However, if we don’t have any limitation of replicate query message, it will keep replicating in spite of it has queried. Therefore, we need a mechanism to stop it. Every Query messages set a TTS, if the TTS expired (Formula 6), and then drop it. This way will inhibit query replication. There are some defects in the way. If TTS is too short, it would query data hardly. If TTS is too long, it would still create many query copies.

So we add one more rule. If query message find the match data, this query message’s attribute isQueried will be change to TRUE. And next time, nodes encountered, they

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

24 

change their metadata, then nodes will know what query message had been queried, and it will skip it to add to Q_set.

( ) = , _ _

, ℎ (6)

       

Figure 9: Query replication strategic flow chart

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

25 

3.3 Data Reply strategic

As shown in Figure 11. Node A received Node B’s metadata, it will check all query messages of Node B’s metadata. If Node A has the match data, it will generate a Reply data R_data of the Query message and change the Query message attribute isQueried to TRUE, then we can call Node A as Replier.

It is difficult to send the Reply data to the Querier. Because all nodes in the network are keeping moving, we can’t use the original packet delivery path to send back to the Querier. Therefore, we have to use the other rule to send Reply data.

Replier (Node A) can know the Querier’s location from Query message, and send the Reply data to that location. But, as time goes by, Querier may not still stay there. So, when Replier (Node A) encounters other node (Node B), it will check the Encounter Table of Node B whether it had encountered Querier or not. If it had, we will check the encounter time whose close the recent time. If Node B’s encounter time close, we will update (Formula 7) the Querier position of Replier’s (Node A) metadata.

( . )

= , ( _ ) ( . > . )

,

(7)

Then we have to distinguish which Node will move toward to the Querier, see the Formula 8, if Replier (Node A) won’t move toward to the Querier but Node B will do, it would add the R_data to the Reply dataset R_set. Otherwise, Replier (Node A) will move toward to the Querier but Node B won’t, it just keeps the R_data and does nothing.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

26 

( _ , _ )

=

, ,

. ( ) = . ( ) =

. ( ) = . ( ) =

,, ,

& ( > )

& ( > )

(8)

If Replier (Node A) and Node B are moving the same direction and forward to the Querier, we have to calculate whose moving path will close to the Querier. In Figure 10, we can use the position Pnow , the past position Pt-1 to determine this node’s moving direction, then we add the Querier position Pq and use the basic Triangle Area formula (Formula 9) to calculate the area value , as we know the distance between Pnow and Pt-1, we can get the close Querier distance D. If Da greater than Db, it indicates Node B will move close to the Querier, then we add the R_data to the R_set and waiting for transmission. Otherwise, If Da less than Db, it indicates Replier (Node A) will move close to it, then we just keep the R_data and moving.

= 1

2 (9)

However, we could not replicate messages unlimited, so we have to make some rule to inhibit it. All the Reply data will set a TTS, when the TTS expired or R_data had forwarded to the querier , this message R_data will drop anymore (Formula 10).

( _ ) =

, _ _

, _ ℎ ℎ

, ℎ

(10)

 

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

27 

  Figure 10: Moving direction and the relative distance

 

Figure 11: Data reply strategic flow chart

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

28 

3.4 Data synchronization and update strategic

Whatever Online-node or Offline-node, it would create data messages. Beside keeping the data in local database, it has to upload this data messages to the remote server to share this information. Figure 12 shows this strategic. When node received messages, the first step is distinguishing the type of node, if it is Online-node, it should upload all the data messages which doesn’t sync to the remote server directly.

Then change the Sync attribute of this data message to TRUE. Otherwise, if it is Offline-node, it shouldn’t do anything.

Figure 12: Data sync and update strategic flow chart

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

29 

3.5 Message queue selection algorithm

When all the messages are chosen (D_set, Q_set and R_set), Node A has to send these messages to Node B. But the messages cannot be parallel transferred. Therefore, we have to decide which one will be sent first. In the thesis, shown in Figure 13, we proposed a simple message queue selection algorithm, within the weight value d, q and r, and progressive value S to calculate and get the transmission Message queue M.

Figure 13: Message Queue Selection

We can get the dataset D_Set, Q_Set and R_Set from all the replication strategies we describe above. Then we give the dataset a different weight value d, q, r and d + q + r = 1. The first step, we find the dataset of highest weight value MaxSet, then, the MaxSet dataset pop a message and enqueue to M. This will be the first transmission message, then, we reset the weight value of MaxSet dataset, and add the Progressive value S to the other weight. Repeat the steps until all messages enqueue to M, and then we can get a complete Message queue M. Finally, Node A according to M sends all the messages to Node B.

The beginning results of this selection queue are similar to Weight Fair Queue

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

30 

(WFQ), the highest weight of messages will be sent more. After several times, the message will be selected by Round Robin (RR), because of the weight value and progressive value.

Message queue selection algorithm

Input: Data dataset D_set, Query dataset Q_set, Reply dataset R_set, Data weight d, Query weight q, Reply weight r, Progressive value S

Output: Message queue M 1:

2: 

3: 

4: 

5: 

6: 

7: 

8: 

9: 

10: 

11:

While((size(D_set) + size(Q_set) + size(R_set)) != 0) MaxSet = Max(d,q,r).getSet()

M.enqueue(popMsg(MaxSet)) Switch(MaxSet)

Case D_set: d = d.original, q = q + S, r = r + S Case Q_set: d = d + S, q = q.original, r = r + S Case R_set: d = d + S, q = q + S, r = r.original End switch

If size(MaxSet) = 0 then MaxSet.weight = 0 End while

Return M

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

31 

CHAPTER 4

Simulation Results

In this chapter, we discuss the simulation results, and we compare with three protocols. LCS (we proposed), Locus [11] and Epidemic [3]. We make some variation in Epidemic, because of Epidemic doesn’t matter the query-reply situation. We set the area concept and let nodes having query scenario and reply action in Epidemic.

Then, in the results, we will show some validation parameters. And we explain how the equation be calculated below.

(1) Query-Reply Success Ratio: The equation is shown below. The number of success reply message means all the reply messages success delivery from Replier to Querier, and the same data we won’t be repeatable recorded. And the number of query message means how many numbers the query message be generated, so the replicate query messages we won’t record.

(2) Query Delivery Ratio: The equation is shown below. The number of query delivered means the all query messages which delivered to the data source node and the number of query message described above.

(3) Overhead: The messages which are redundant transferred are overhead.

Success reply message means the first message reply to the Querier and the same messages replied afterword do not include. Query delivered means the first message delivered to the Replier, and as above, the same messages don’t include.

get the med Query-Re en they rea des move to

cy: We calc time of rec dium numbe

nodes are p ached the de the position

Figure

culate from ceive the fir

er to analyze s Ratio = n by shortes

e 14: Map o

32 

the time o rst reply me

e. then we giv st path algor

of Taipei101

f send the f essage by th

ding area (F t a random ve them the

rithm.

1 surroundin

first query m he Replier.

message by And the re

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

33 

Figure 15: ONE simulator

4.2 Simulation Settings

The simulation setting is shown as Table 2. The map area is 3000m * 2500m, and the simulation time is 43200 seconds, it is equivalent to 12 hours. In order to initialize data sources, we have to set a warm up time 1000 seconds. The node data transmission rate is 2Mbps, and the transmission rage is 10m. All nodes divided to

The simulation setting is shown as Table 2. The map area is 3000m * 2500m, and the simulation time is 43200 seconds, it is equivalent to 12 hours. In order to initialize data sources, we have to set a warm up time 1000 seconds. The node data transmission rate is 2Mbps, and the transmission rage is 10m. All nodes divided to

相關文件