Skip to main content

Posts

Showing posts from May, 2010

4. DHTTestApp & DHT

DHTTestAPP & DHT work together where DHTTestAPP utilizes the DHT to store & retrieve (key, value) pairs. DHT utilize the underlying overlay to route queries.

DHTTestAPP
Is a Tier2 application that periodically issue DHT put, get, & modify queries. The implementation consist of 2 modules:
GlobalDhtTestMap - Provides a data structure & functions to maintain a global list of (key, value) pairs. Random keys are taken from this list to issue DHT get & modify queries.DHTTestApp - Issues DHT put, get, & modify queries after some delay derived from a truncnormal distribution. Put messages - Use to add a random (key, value) pair into the DHT. A put message (represented as DHTputCAPICall) consists of a random key, random value, expiration time (ttl), & whether (key, value) pair can be modified. Then the message is send to the Tier1 application using sendInternalRpcCall() method, which will store (key, value) pair in the DHT. When a successful response is received (ke…

3. KBRTestApp

After developing your own application & overlay next you should play with the KBRTestApp. KBRTestApp is a Tier1 application that tests 3 operations:
OneWayTest - Route an overlay message to a random key & measure one-way hop count & latency. When a message reaches the destination, receiver call a method in the sender to collect statistics (not over the network). A sequence number is attached to a message to prevent collecting statistics of duplicate ones. Intermediate nodes append their addresses to a message while it's being forwarded.RPCTest - Send RPC call to a random key, wait for response, & then measure one-way hop count & latency. RPC context is used to keep track of destination & whether a message should be considered for statistics.LookUpTest - Lookup a random key using RPC call & collect latency when response is received. Sends as an internal RPC (sendInternalRpcCall) between two tiers (from application to overlay) using LookupCall messages.Con…

Key Application Layer Functions

Constructor  Can be use to set message to NULL. Better not to skip defining the constructor.

Destructor Can be use to clear/delete messages using cancelAndDelete(). New version seems to be motivating to use a destructor so better not to skip.

void initializeApp(int stage)
Can be used to initialize the application, read parameters from omnet.ini file, set statistic collectors, GUI display variables, start timers, set UDP port, etc.
stage - Indicate which stage your are in. MIN_STAGE_APP indicates this module is being created while MAX_STAGE_APP indicates all modules were created. We typically need MIN_STAGE_APP to initialize application & variables. void finishApp() Called when application is terminating. Can be used to summarize stat. New version seems to be motivating us to delete messages in the destructor.

void handleTimerEvent(cMessage* msg) Handle event timer. Use to generate new periodic messages, other events, or check for lost messages. Better not to generate messages until un…

OverSim - Best/Necessary Practices

General Declare each module in a separate fileWrap simple modules through compound modules, even if there is only 1 simple module. This is where you connect in/out gates. Use IOverlay or ITier interfacesUse @class() property to tell compiler to use our own C++ definition of a simple moduleUse Define_Module() method to add a module definition class to simulationBetter not to do anything until underlay is properly initialized. Overlay may be in the initialization phase  if you want to measure bootstrap phase. Can check using underlayConfigurator->isInInitPhase() Applications Suppose our application name is myapp All applications must be stored in /src/applications/ within OverSim directory, e.g., /src/applications/myapp/Package name should be oversim.applications.myapp
Each application must be extended from BaseApp class (.ned files & C++ classes)This will add default in/out gates & parameters to the module &, also C++generic methods such as initializeApp() or deliver()Use …

2. OverSim - First Application & Overlay

OverSim has many sample applications & overlays that you can look at & understand. But, it's always better to build your own ones so you would understand things better. OverSimDevelop provides the steps necessary to build your first application & overlay. My objectives it to provide few additional details that would complete the picture.
Synopsis A node generates a ping messages & sends it to a randomly selected node. When the destination node gets the ping message, it replies with a pong message. As this process continuous messages are probabilistically dropped & statistics are collected.

Overview
MyApplication randomly selects set of overlay nodes then send a ping message to each of them using the MyOverlay. Each overlay node maintains 2 pointers, one to the successor & another to the predecessor node. Ping messages are forwarded clockwise or anticlockwise based on these 2 pointers, e.g., message from node 8 to 2 (in a network with 10 nodes) will follow the …