Measure the Round-Trip Time (RTT) – 作業補充說明

25
Measure the Round-Trip Time (RTT) – 作作作作 作作 Base station (original data server) Mobile host RTT (ms) data size (bytes) 100 200 300 400 500 1000 Number of node:20, 50 Overall query rate: 5 Simulation time: 100 data size (bytes) 100 200 300 400 500 1000 10 20 40 80 10 20 40 80 (a) Node:20 (b) Node:50 1. Scenario_generator 2. Node_20.tcl, Node_50.tcl 3. AODV directory 4. Result: Figure

description

Measure the Round-Trip Time (RTT) – 作業補充說明. Base station (original data server). Scenario_generator Node_20.tcl, Node_50.tcl AODV directory Result: Figure. Number of node:20, 50 Overall query rate: 5 Simulation time: 100. Mobile host. RTT (ms). 80. 80. 40. 40. 20. 20. 10. 10. - PowerPoint PPT Presentation

Transcript of Measure the Round-Trip Time (RTT) – 作業補充說明

Page 1: Measure the Round-Trip Time (RTT) – 作業補充說明

Measure the Round-Trip Time (RTT) – 作業補充說明Base station (original data server)

Mobile host

RTT (ms)

data size (bytes)

100 200 300 400 500 1000

Number of node:20, 50Overall query rate: 5Simulation time: 100

data size (bytes)100 200 300 400 500 1000

10

20

40

80

10

20

40

80

(a) Node:20 (b) Node:50

1. Scenario_generator2. Node_20.tcl, Node_50.tcl3. AODV directory4. Result: Figure

Page 2: Measure the Round-Trip Time (RTT) – 作業補充說明

BS

Mobile Host’s Cache Invalidation

MH

Page 3: Measure the Round-Trip Time (RTT) – 作業補充說明

BS

BS use broadcast to invalidate MHs’ cache

MH

Page 4: Measure the Round-Trip Time (RTT) – 作業補充說明

Wireless

Broadcast Scalable

MHs MHs wake up and sleep for saving energy Disconnection problem

Page 5: Measure the Round-Trip Time (RTT) – 作業補充說明

Cache Invalidation Report (IR), TS (Timestamp) scheme

D. Barbara and T. Imielinski, “Sleepers and Workaholics: Caching Strategies in Mobile Environments,” Proc. ACM SIGMOD Int’l Conf. on Management of Data, Vol. 23, no. 2, pp. 1-12, May 1994.

Page 6: Measure the Round-Trip Time (RTT) – 作業補充說明

Invalidation Report (IR) structure

Time

w=i*L

t1t2 t3

t4 t5 t6t7 t8

t9

Broadcastwindow

L

Page 7: Measure the Round-Trip Time (RTT) – 作業補充說明

MHs receive IR from BS (1/2)

Page 8: Measure the Round-Trip Time (RTT) – 作業補充說明

MHs receive IR from BS (2/2)

Page 9: Measure the Round-Trip Time (RTT) – 作業補充說明

Related functions For Base station (server)

/*1.*/ void BS_Database_Update_Model(); /*2.*/ void BS_Broadcast_IR_to_MHs(); /*3.*/ void BS_Recv_data_request_from_MH(Packet *p);

For Mobile host (MHs) /*1.*/ void MHs_Query_Model(); /*2.*/ int MH_Lookup_Local_Cache(int requested_data_id); /*3.*/ void MH_send_data_request_to_BS(int requested_data_id);

/*4.*/ void MHs_Recv_IR_from_BS(Packet *p); /*5.*/ void Remove_invalid_cached_data(int removed_data_id); /*6.*/ void MH_cache_placement(int data_id); /*7.*/ int MH_cache_replacement_LRU();

Page 10: Measure the Round-Trip Time (RTT) – 作業補充說明

10

aodv_packet.h

Page 11: Measure the Round-Trip Time (RTT) – 作業補充說明

11

Header embedded

struct hdr_aodv_reply *rh = HDR_AODV_REPLY(p);

rh->my_packet_type = 666; rh->requested_data_id = 132;

666 132

my_packet_type requested_data_id

Page 12: Measure the Round-Trip Time (RTT) – 作業補充說明

12

Simulation for database AODV.h

struct database { int data_id; float data_size; float nearest_update_time; int flag; //用來模擬資料的狀態,例如存在與否 }; database server_db[1000];

Page 13: Measure the Round-Trip Time (RTT) – 作業補充說明

13

Simulation for database server_db[1].data_id = 514; server_db[1].data_size = 1024; //bytes server_db[1]. nearest_update_time = 25; //Simulation time server_db[1].flag = 1;

server_db[2].data_id = 587; server_db[2].data_size = 512; //bytes server_db[1].nearest_update_time = 55; //Simulation time server_db[2].flag = 1;

那裡可以設定”變數”的初始值 ? 。 AODV.cc 的建構式函數。

AODV:AODV(……) { ………}

Page 14: Measure the Round-Trip Time (RTT) – 作業補充說明

14

Update operation for database void AODV::BS_Database_Update_Model() { if (CURRENT_TIME > DATABASE_NEXT_UPDATE) { int update_data_id = rand()%(TOTAL_DATA_SET-1)+1; server_db[1].nearest_update_time = CURRENT_TIME; DATABASE_NEXT_UPDATE = (rand()%

(DATABASE_UPDATE_MEAN*2)+1); } }

Page 15: Measure the Round-Trip Time (RTT) – 作業補充說明

void AODV::BS_Broadcast_IR_to_MHs(void) { if (CURRENT_TIME >= NEXT_IR_TIME) { Packet *IR_packet = Packet::alloc(); struct hdr_cmn *ch = HDR_CMN(IR_packet); struct hdr_ip *ih = HDR_IP(IR_packet); struct hdr_aodv_reply *header = HDR_AODV_REPLY(IR_packet);

header->rp_type = AODVTYPE_HELLO; header->Message_type = 1;

int IR_size = 0; float IR_w_interval_time = CURRENT_TIME - (W_WINDOW * IR_INTERVAL);

for(int a=1;a<TOTAL_DATA_SET;a++) { header->Content[a].data_reply_flag = 0; header->Content[a].update_time = 0; if

((BS_database[a].nearest_update_time>IR_w_interval_time)&&(BS_database[a].nearest_update_time>0))

{ header->Content[a].update_time = BS_database[a].nearest_update_time; IR_size += 4*2; } header->Content[a].data_reply_flag = scheduled_data[a]; scheduled_data[a] = 0; }

Page 16: Measure the Round-Trip Time (RTT) – 作業補充說明

printf("\nIR_size=%d bytes",IR_size); ch->size() = IP_HDR_LEN + IR_size; ch->ptype() = PT_AODV; ch->iface() = -2; ch->error() = 0; ch->addr_type() = NS_AF_NONE; ch->prev_hop_ = index;

ih->saddr() = index; ih->daddr() = IP_BROADCAST; ih->sport() = RT_PORT; ih->dport() = RT_PORT; ih->ttl_ = 1; Scheduler::instance().schedule(target_, IR_packet, 0.01*

Random::uniform()); } }

Page 17: Measure the Round-Trip Time (RTT) – 作業補充說明

Simulation for MHs’ cache #define max_cache_entry 100

struct MH_cache_entry_struct { int data_id; float cached_time; }; MH_cache_entry_struct MH_cache[max_cache_entry];

Page 18: Measure the Round-Trip Time (RTT) – 作業補充說明

int AODV::MH_Lookup_Local_Cache(int data_id) { for(int a=0;a<max_cache_entry;a++) { if (MH_cache[a].data_id==data_id) { return 1; } } return 0; }

Page 19: Measure the Round-Trip Time (RTT) – 作業補充說明

int AODV::MH_cache_replacement_LRU() { int compared_time = 99999; int replace_location = 0;

for(int a=0;a<max_cache_entry;a++) { if (MH_cache[a].cached_time < compared_time) { compared_time = MH_cache[a].cached_time; replace_location = a; } } return replace_location; }

Page 20: Measure the Round-Trip Time (RTT) – 作業補充說明

void AODV::MH_cache_placement(int data_id) { int place_location = 0; place_location = MH_cache_replacement_LRU(); MH_cache[place_location].data_id = data_id; MH_cache[place_location].cached_time = CURRENT_TIME; }

Page 21: Measure the Round-Trip Time (RTT) – 作業補充說明

void AODV::MHs_Recv_IR_from_BS(Packet *IR_packet) { struct hdr_aodv_reply *header = HDR_AODV_REPLY(IR_packet); //Use IR to remove the invalid cached data in MH for(int a=0;a<max_cache_entry;a++) { int data_id = MH_cache[a].data_id; if (MH_cache[a].cached_time < header->Content[data_id].update_time) { Remove_invalid_cached_data(data_id); } }

if (MH_status == 3) //Cache hit, IR invalid, and then receive data reply { MH_cache_placement(queried_data_id); MH_status = 0; queried_data_id = 0; query_time = 0; }

Page 22: Measure the Round-Trip Time (RTT) – 作業補充說明

if (MH_status == 1) //Cache hit, waiting IR { if (MH_cache[queried_data_id].cached_time >= header->

Content[queried_data_id].update_time) { MH_status = 0; queried_data_id = 0; query_time = 0; } if (MH_cache[queried_data_id].cached_time < header-

>Content[queried_data_id].update_time) { MH_status = 3; Remove_invalid_cached_data(queried_data_id); MH_send_data_request_to_BS(queried_data_id); } }

if (MH_status == 2) //Cache miss, wait and receive data reply { MH_cache_placement(queried_data_id,data_Q_bit,data_U_bit); MH_status = 0; queried_data_id = 0; query_time = 0; } Packet::free(IR_packet); }

Page 23: Measure the Round-Trip Time (RTT) – 作業補充說明

Updated Invalidation Report (UIR) scheme

G. Cao, “A Scalable Low-Latency Cache Invalidation Strategy for Mobile Environments,” IEEE Trans. on Knowledge and Data Engineering, Vol. 15, No. 5, pp. 1251-1265, Sept./Oct. 2003.

Page 24: Measure the Round-Trip Time (RTT) – 作業補充說明

24

Page 25: Measure the Round-Trip Time (RTT) – 作業補充說明

期中 NS-2 Project Use NS2 to implement UIR (Updated Invalidation Report) scheme

Reference G. Cao, “A Scalable Low-Latency Cache Invalidation Strategy

for Mobile Environments,” IEEE Trans. on Knowledge and Data Solve Problem: Cache Consistency Problem