1 / 25

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

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.

ariane
Download Presentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 1000 1000 100 200 300 400 500 100 200 300 400 500 data size (bytes) data size (bytes) (a) Node:20 (b) Node:50

  2. Mobile Host’s Cache Invalidation MH BS

  3. BS use broadcast to invalidate MHs’ cache MH BS

  4. Wireless • Broadcast • Scalable • MHs • MHs wake up and sleep for saving energy • Disconnection problem

  5. 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.

  6. Invalidation Report (IR) structure t9 t2 t7 t4 t5 t6 t8 t1 t3 Time L Broadcast window w=i*L

  7. MHs receive IR from BS (1/2)

  8. MHs receive IR from BS (2/2)

  9. 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();

  10. aodv_packet.h 10

  11. Header embedded struct hdr_aodv_reply *rh = HDR_AODV_REPLY(p); rh->my_packet_type = 666; rh->requested_data_id = 132; my_packet_type requested_data_id 132 666 11

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

  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(……) • { ………}

  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); • } • }

  15. 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; • }

  16. 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()); • } • }

  17. 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];

  18. 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; • }

  19. 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; • }

  20. 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; • }

  21. 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; • }

  22. 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); • }

  23. 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.

  24. 期中 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

More Related