Difference between revisions of "Private:psim"
(67 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
This page documents the development of a discrete event simulator for P2P video streaming applications. This simulator captures important features of data-driven video streaming systems. In particular, it is designed to evaluate: (i) the performance of various segment scheduling algorithms; (ii) the potential of network coding in multi-layer P2P video streaming systems. | This page documents the development of a discrete event simulator for P2P video streaming applications. This simulator captures important features of data-driven video streaming systems. In particular, it is designed to evaluate: (i) the performance of various segment scheduling algorithms; (ii) the potential of network coding in multi-layer P2P video streaming systems. | ||
− | = | + | == Todo List == |
− | + | We keep a short todo list here. For each todo item, we also list the expected workload, the current assignee, the tentative due date, and the completion time. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Description | ||
+ | ! Workload (ppl-day) | ||
+ | ! Assignee | ||
+ | ! Tentative Duedate | ||
+ | ! Completion time | ||
+ | |- | ||
+ | | Reread and implement Meng Zhang's algorithm | ||
+ | | 1.5 | ||
+ | | Cheng | ||
+ | | March 18, 2009 | ||
+ | | March 18, 2009 | ||
+ | |- | ||
+ | | Finalize the simulator engine | ||
+ | | 1 | ||
+ | | Cheng | ||
+ | | March 17, 2009 | ||
+ | | March 17, 2009 | ||
+ | |- | ||
+ | | Generalize the scheduling algorithm for multiple layer problem | ||
+ | | 3 | ||
+ | | N/A | ||
+ | | | ||
+ | | | ||
+ | |- | ||
+ | | Reorganize the evaluation setup subsection | ||
+ | | 2 | ||
+ | | Yuanbin | ||
+ | | March 18, 2009 | ||
+ | | March 18, 2009 | ||
+ | |} | ||
− | = | + | = High-Level Design = |
+ | |||
+ | We present the high level design of the pSim. Please find a coarse class diagram below, and the source file can be downloaded [[media:psim.dia|here]]. | ||
+ | |||
+ | [[Image:psim.png|center|640px]] | ||
+ | |||
+ | |||
+ | |||
+ | Some misc notes: | ||
+ | * We use long for time/offset in msec, which has a rollover time 24.85 days | ||
+ | |||
+ | === System Architecture === | ||
+ | The core of the simulator is a simulation engine that is abstracted as the | ||
+ | '''Simulator''' class. Since pSim is a discrete event simulator, the | ||
+ | '''Simulator''' class keeps track of a moving simulation time '''simTime''', | ||
+ | which is different from the wall clock (real-time). '''Simulator''' consists of | ||
+ | an '''EventQueue''' that provides the interface of push and pop an event from a | ||
+ | priority queue of the pending events. The pending events are sorted on the | ||
+ | event time in the ascending order. '''Simulator''' works as the follows, in | ||
+ | '''dispatchEvents''' method, the next event is popped from '''EventQueue'''. | ||
+ | '''Simulator''' then update '''simTime''' and calls '''dispatch''' method to | ||
+ | process that event using method '''dispatch''', and then drop the processed | ||
+ | event away. '''Simulator''' then popped the next event from '''EventQueue''' | ||
+ | and update '''simTime'''. That is, the method '''dispatchEvent''' is a forever | ||
+ | loop, thus the caller must not expect '''dispatchEvent''' to return. | ||
+ | |||
+ | Other components in pSim add new events to '''Simulator''' by calling its | ||
+ | '''push''' method. The new events are pushed through '''EventQueue''' to | ||
+ | '''CalendarQueue'''. '''CalendarQueue''' is an efficient implementation of | ||
+ | priority queue, which achieves constant time complexity. We implement the | ||
+ | Dynamic Calendar Queue (DCQ) based on a Berkeley implementation, which sort the | ||
+ | pending events on their '''time'''. We notice that we keep '''EventQueue''' | ||
+ | between '''Simulator''' and '''CalendarQueue''', in case we need to switch to | ||
+ | other priority queue implementation such as standard '''TreeMap'''. | ||
+ | |||
+ | In addition to '''EventQueue''', '''Simulator''' also consists of: (i) | ||
+ | '''Logger''' that is responsible for filtering and saving logging messages, | ||
+ | (ii) '''RndGen''' that is the system-wide random number generator, and (iii) | ||
+ | '''SysParam''' that has all system parameters. | ||
+ | |||
+ | === Event and Event Handler === | ||
+ | Since '''Simulator''' class is driven by its priority queue of events, every | ||
+ | '''Event''' must consist of enough information on how to process that | ||
+ | '''Event'''. The main fields of '''Event''' include: '''type''' that is the | ||
+ | event type, and '''time''' that is the event time. Moreover, the '''Event''' | ||
+ | class maintains a vector of '''EventHandler''' interface, which specifies how | ||
+ | to process that '''Event''''. There is only an abstract method defined in | ||
+ | '''EventHandler''', which is its '''handle''' function. The '''handle | ||
+ | function''' returns a log entry in '''String''' format. We note that this | ||
+ | String must use pipe as the field delimiter, and should not contain any CR nor | ||
+ | LF. See existing code for other convention of the log entries. Notice that, | ||
+ | each '''Event''' instance has no '''EventHandler''' initially: the class who | ||
+ | creates an '''Event''' must provide one or more '''EventHandler''' by calling | ||
+ | the method '''addHandler'''. Last, we mention that the '''dispatch''' method of | ||
+ | '''Simulator''' retrieves all '''EventHandler''' by calling method | ||
+ | '''getHandlers'''. | ||
+ | |||
+ | '''Event''' has two subclasses: '''PeerEvent''' is for events that is local to | ||
+ | a peer, e.g., a peer joins a video group is a '''PeerEvent'''; | ||
+ | '''NetworkEvent''' is for sending messages between two peers, e.g., a receiver | ||
+ | sends a '''CONNECTMSG''' to a sender. '''PeerEvent''' has two fields: | ||
+ | '''Peer''' and '''Video'''. '''NetworkEvent''' has four fields: (i) '''conn''' | ||
+ | that captures the connection status between two peers, (ii) '''length''' that | ||
+ | describes the length of this message, (iii) '''direction''' that indicates | ||
+ | whether the message is sent from receiver to sender or not, and (iv) | ||
+ | '''arrived''' shows whether the message has arrived at the destination. More | ||
+ | precisely, a '''NetworkEvent''' is created with '''arrived''' value set to off, | ||
+ | which means that event just enter the connection '''conn'''. Following the | ||
+ | bandwidth defined in '''conn''', we can compute when will the event arrives at | ||
+ | the destination. This computation is done in '''tHandler''' that stands for | ||
+ | transmission handler. The transmission handler processes a '''NetworkEvent''' | ||
+ | as follows. First, it computes and updates the event time to be the time that | ||
+ | event arrives at the destination. Second, it sets '''arrived''' to be true. | ||
+ | Third, it pushes the same '''NetworkEvent''' back to '''EventQueue'''. | ||
+ | |||
+ | |||
+ | === Random Number Generator and Profiles === | ||
+ | |||
+ | TODO | ||
+ | |||
+ | |||
+ | = Performance metrics for scheduling = | ||
+ | |||
+ | Here are some performance metrics: | ||
+ | # Average delivery ratio: number of on-time scheduled segments over total number of segments to be scheduled | ||
+ | # Load balance among senders | ||
+ | # Initial buffering time | ||
+ | # Time and space complexity of the scheduling algorithm | ||
+ | |||
+ | |||
+ | = Performance metrics for network coding = | ||
+ | |||
+ | Here are some performance metrics: | ||
+ | |||
+ | # Playback quality (PSNR) | ||
+ | # Resilience to peer dynamics (ability of maintaning good streaming quality) | ||
+ | # Required server capacity | ||
+ | |||
+ | |||
+ | = How to install uml and svn tools in eclipse3.2.x = | ||
+ | |||
+ | * Install emul2 | ||
+ | *# Go to "http://www.soyatec.com/euml2/installation/", download its free edition. (Select the right version according to your eclipse) | ||
+ | *# Unpack the zip file | ||
+ | *# Open your eclipse, and go to Help -> Software Updates -> Find and install ... -> Search for new features to install -> New local site then find the unpakced file to install it. | ||
+ | *# How to use: after you creating a new java project, go to File -> New -> Other, select the "UML2 Class Diagram" under the eUML directory, then you can create a class diagram for your project . | ||
+ | |||
+ | |||
+ | * Install subclipse | ||
+ | *# Open your eclipse, and go to Help -> Software Updates -> Find and install ... -> Search for new features to install -> New Remote Site | ||
+ | *# Add "http://subclipse.tigris.org/update_1.4.x" to the URL field and add an arbitrary name to the Name field | ||
+ | *# Follow the instruction to install it. | ||
+ | *# If you encounter an error like "Subclipse Integration for Mylyn 3.x (Optional) (3.0.0) requires plug-in "org.eclipse.mylyn.tasks.core (3.0.0)" don't worry, just deselect the "Integrations" item and continue to install. | ||
+ | *# Go to Window -> Preferences -> Team. If you can see SVN under the Team tab, congratulations, your installation is done. | ||
+ | *# How to use: right click the project you want to commit, select Tean -> Share project -> SVN, input the URL of your svn server, then you can import your project to it. | ||
+ | *# For more details on how to use subclipse, please refer to http://www.ibm.com/developerworks/opensource/library/os-ecl-subversion/ | ||
+ | |||
+ | |||
+ | = The project directory = | ||
+ | |||
+ | I've put the psim project to "https://cs-svn.cs.surrey.sfu.ca/svn/nsl/schedule/psim". You can check it out in eclipse with subclipse. |
Latest revision as of 21:19, 24 March 2009
This page documents the development of a discrete event simulator for P2P video streaming applications. This simulator captures important features of data-driven video streaming systems. In particular, it is designed to evaluate: (i) the performance of various segment scheduling algorithms; (ii) the potential of network coding in multi-layer P2P video streaming systems.
Todo List
We keep a short todo list here. For each todo item, we also list the expected workload, the current assignee, the tentative due date, and the completion time.
Description | Workload (ppl-day) | Assignee | Tentative Duedate | Completion time |
---|---|---|---|---|
Reread and implement Meng Zhang's algorithm | 1.5 | Cheng | March 18, 2009 | March 18, 2009 |
Finalize the simulator engine | 1 | Cheng | March 17, 2009 | March 17, 2009 |
Generalize the scheduling algorithm for multiple layer problem | 3 | N/A | ||
Reorganize the evaluation setup subsection | 2 | Yuanbin | March 18, 2009 | March 18, 2009 |
High-Level Design
We present the high level design of the pSim. Please find a coarse class diagram below, and the source file can be downloaded here.
Some misc notes:
- We use long for time/offset in msec, which has a rollover time 24.85 days
System Architecture
The core of the simulator is a simulation engine that is abstracted as the Simulator class. Since pSim is a discrete event simulator, the Simulator class keeps track of a moving simulation time simTime, which is different from the wall clock (real-time). Simulator consists of an EventQueue that provides the interface of push and pop an event from a priority queue of the pending events. The pending events are sorted on the event time in the ascending order. Simulator works as the follows, in dispatchEvents method, the next event is popped from EventQueue. Simulator then update simTime and calls dispatch method to process that event using method dispatch, and then drop the processed event away. Simulator then popped the next event from EventQueue and update simTime. That is, the method dispatchEvent is a forever loop, thus the caller must not expect dispatchEvent to return.
Other components in pSim add new events to Simulator by calling its push method. The new events are pushed through EventQueue to CalendarQueue. CalendarQueue is an efficient implementation of priority queue, which achieves constant time complexity. We implement the Dynamic Calendar Queue (DCQ) based on a Berkeley implementation, which sort the pending events on their time. We notice that we keep EventQueue between Simulator and CalendarQueue, in case we need to switch to other priority queue implementation such as standard TreeMap.
In addition to EventQueue, Simulator also consists of: (i) Logger that is responsible for filtering and saving logging messages, (ii) RndGen that is the system-wide random number generator, and (iii) SysParam that has all system parameters.
Event and Event Handler
Since Simulator class is driven by its priority queue of events, every Event must consist of enough information on how to process that Event. The main fields of Event include: type that is the event type, and time that is the event time. Moreover, the Event class maintains a vector of EventHandler interface, which specifies how to process that Event'. There is only an abstract method defined in EventHandler, which is its handle function. The handle function returns a log entry in String format. We note that this String must use pipe as the field delimiter, and should not contain any CR nor LF. See existing code for other convention of the log entries. Notice that, each Event instance has no EventHandler initially: the class who creates an Event must provide one or more EventHandler by calling the method addHandler. Last, we mention that the dispatch method of Simulator retrieves all EventHandler by calling method getHandlers.
Event has two subclasses: PeerEvent is for events that is local to a peer, e.g., a peer joins a video group is a PeerEvent; NetworkEvent is for sending messages between two peers, e.g., a receiver sends a CONNECTMSG to a sender. PeerEvent has two fields: Peer and Video. NetworkEvent has four fields: (i) conn that captures the connection status between two peers, (ii) length that describes the length of this message, (iii) direction that indicates whether the message is sent from receiver to sender or not, and (iv) arrived shows whether the message has arrived at the destination. More precisely, a NetworkEvent is created with arrived value set to off, which means that event just enter the connection conn. Following the bandwidth defined in conn, we can compute when will the event arrives at the destination. This computation is done in tHandler that stands for transmission handler. The transmission handler processes a NetworkEvent as follows. First, it computes and updates the event time to be the time that event arrives at the destination. Second, it sets arrived to be true. Third, it pushes the same NetworkEvent back to EventQueue.
Random Number Generator and Profiles
TODO
Performance metrics for scheduling
Here are some performance metrics:
- Average delivery ratio: number of on-time scheduled segments over total number of segments to be scheduled
- Load balance among senders
- Initial buffering time
- Time and space complexity of the scheduling algorithm
Performance metrics for network coding
Here are some performance metrics:
- Playback quality (PSNR)
- Resilience to peer dynamics (ability of maintaning good streaming quality)
- Required server capacity
How to install uml and svn tools in eclipse3.2.x
- Install emul2
- Go to "http://www.soyatec.com/euml2/installation/", download its free edition. (Select the right version according to your eclipse)
- Unpack the zip file
- Open your eclipse, and go to Help -> Software Updates -> Find and install ... -> Search for new features to install -> New local site then find the unpakced file to install it.
- How to use: after you creating a new java project, go to File -> New -> Other, select the "UML2 Class Diagram" under the eUML directory, then you can create a class diagram for your project .
- Install subclipse
- Open your eclipse, and go to Help -> Software Updates -> Find and install ... -> Search for new features to install -> New Remote Site
- Add "http://subclipse.tigris.org/update_1.4.x" to the URL field and add an arbitrary name to the Name field
- Follow the instruction to install it.
- If you encounter an error like "Subclipse Integration for Mylyn 3.x (Optional) (3.0.0) requires plug-in "org.eclipse.mylyn.tasks.core (3.0.0)" don't worry, just deselect the "Integrations" item and continue to install.
- Go to Window -> Preferences -> Team. If you can see SVN under the Team tab, congratulations, your installation is done.
- How to use: right click the project you want to commit, select Tean -> Share project -> SVN, input the URL of your svn server, then you can import your project to it.
- For more details on how to use subclipse, please refer to http://www.ibm.com/developerworks/opensource/library/os-ecl-subversion/
The project directory
I've put the psim project to "https://cs-svn.cs.surrey.sfu.ca/svn/nsl/schedule/psim". You can check it out in eclipse with subclipse.