RTT and RTO Applet Instructions
- Overview
- How to start the applet
- How to stop the applet
- Behind the scene - solution design
- Project Developers
This applet demonstrates RTT and RTO calculation based on Karn and Partridge's algorithm. The base applet is consisted of one to three source machines that generate packets, a router, and a destination server that receives the packets and acknowledges them. Once the simulation stars, packets will be generated from the source machines and move through the router to the destination machine. The packets are then sent from the router to the destination where they are being acknowledged. Once ACK reaches its source node, we calculate the new RTO based on the algorithm's rules.
The easiest thing will be to load the applet and press the Start button. This will run the applet with our default parameters which are set for a network that is capable of almost handling the event flow, but load is increasing slowly and therefore the RTO increases (Router's rate a little bit less than packets rate). Note that we present the packets flow with color code for each node, we present the RTO and SRTT for each node, and each time we lose a packet it is presented on the screen (we randomly lose 0.1% of the packets).

Figure 1: Start with default parameters
Applet area:
The applet area presents the following data:
- All network objects. If you change the amount of source nodes it will update the applet
- The links between the objects
- Packets flow. Once started, each source node will generate packets with a different color per node.
We present the flow in two directions next to the link - one direction from the node to the router, and the other direction is from the router to the node.
We chose this presentation do it will be possible to graphically understand the flow.
Packets have a large icon and ACK have small icons. Packet number presented above the packet - Start \ Stop button is located at the top of the applet
- Next to the Start \ Stop button we present lost packets. The network is randomly losing 0.1% of the packets and each time we lose a packet we present its number so you can follow it up
- Next to the lost packets we present the SRTT and RTO values for each source node. These values change dynamically, and in case RTO was calculated based on backoff algorithm (rather than K&P's formula) we present it in red. You may follow the values and tune your network's parameters based on it to get better (or worse...) performance

Figure 2: Applet screen
Configurable parameters:
The applet allows you to configure many of the network parameters so you can see the impact of different load patterns on the RTO values.
You may configure parameters for each source node, router and server separately by simply clicking (or right clicking) on the object
and then clicking on the menu to configure the node.
Router configurable attributes:
Click the router, and then click Configure Router Attributes

Figure 3: Router Configuration
Two attributes available:
- Packets per second: How many packets can the router handle per second.
Remember that all packets are flowing through the router so this number should be high enough - Number of source nodes: How many source nodes will be in the simulation.
We allow 1-3 so the presentation will be readable...

Figure 4: Router Configurable attributes
Server configurable attributes:
Click the server, and then click Configure Destination Node Attributes

Figure 5: Server Configuration
Two attributes available:
- Packets per second: How many packets can the router handle per second.
Remember that server handles packets from all nodes - Link's Packets per Second: Server <-> Router link speed.
Remember that all packets + ACK from all network are going through this link

Figure 6: Server Configurable attributes
Source Node configurable attributes:
Click the source node you are interested in, and then click Configure Source Node Attributes

Figure 7: Source Node Configuration
Available attributes:
- Packets per second: How many new packets the node will generate per second.
- Link's Packets per Seconds: Node <-> Router link speed.
- Initial RTO: The RTO to start with.
Once the applet starts RTO will be calculated based on the algorithm's rules - SRTT Alpha value: alpha is an algorithm's parameter, it is a number between 0 and 1
SRTT(i+1) = alpha*SRTT(i) + (1-alpha)*RTT(i)
RTT is the real round time trip for the packet
New SRTT is calculated only for ACK for packets that were not retransmitted - RTO Beta value: beta is an algorithm's parameter, it is a number > 2 and we limit it to be less equal to 3 (for reasonable results)
RTO = Beta*SRTT(i)
RTO calculation based on K&P's algorithm is calculated only for ACK for packets that were not retransmitted - Use Mills?: If you want to use Mills's improvement, check this box
- Mills Low Alpha value: a value between 0-1 lower than Alpha
Mills suggested to use lower alpha value if SRTT(i) is less than the sampled RTT
If you checked the above checkbox you may set the low Alpha value - Initial BackOff: Value larger than 1.
backoff algorithm is used to calculate RTO when ACK arrive for packet that was retransmitted.
If using backoff algorithm to calculate RTO, this value will be used as the backoff constant
RTO (backoff) = (packet RTO)*(# retransmissions of packet) * (backoff value)

Figure 8: Source Node Configurable attributes
How to stop the applet (and start it again)
Stopping the applet is very simple. Simply click the Stop button (located in the same location as the Start button). It will stop packets from being generated. Once stopped, the Stop button will become a Start button again and you may start running the simulation again. One can change network parameters only when the simulation is stopped. Network configuration is kept, so you can continue working and modifying the network without losing previous configuration.
Behind the scene - solution design
Complete code documentation can be found here
User Interface considerations
Our main objective is to keep the view graphically simple enough to understand the algorithm,
but using a robust data structure that will calculate the algorithm accurately and simulate a real network flow.
- Number of source node limited to allow users to understand the flow, but large enough so one can play with the attributes and see the impact on the network
- Configurable attributes are those that we believe can demonstrate impact on RTO\RTT such as link and nodes speed and K&P's formula parameters
- The most important thing is to clearly present RTO and SRTT, and also show when we 'missed' and had to retransmit packets. We are showing these values at the top of the applet with color code for RTO calculation (red when calculated based on backoff algorithm)
- Network flow must be clear and simple - each node produces packets in different color, packet number presented next to it, and ACKs have a smaller icon
Java implementation
The solution simulates a real network and our applet really transfers the packets as if it were a real (very simplified...) network.
To make it real, we had to code the different network components and have them manage the queues coming in and out.
(very) high level code design:
- Router
- Runs as a single thread
- Main property is a FIFO queue that receives packets from all source nodes and ACKs from destination node and route them to the appropriate link based on the destination of the packet
- Server
- Runs as a single thread
- Main property is a FIFO queue that receives packets from all sources, and produces ACK packets with destination as original packet source
- Source Node
- Runs three separate threads per node
- Packet creator - single thread per source node that generates new packets. The packets are sent to destination over the link from the node to the router
- Manage Packets in queue - packets that were transmitted must be acknowledged. We manage an array of transmitted packets which remain in the queue until they are acknowledged To manage the queue we run it as additional separate thread per source node. This thread is constantly checking the queue, and if a packet RTO is EOL'd we retransmit it and recalculate a new RTO based on backoff algorithm
- Manage ACK queue - ACK packets arrive to a FIFO queue that each source node holds. We process them one by one and update the RTO for the node based on Karn and Partridge's algorithm. This process runs as additional separate thread per source node
- Each node has its own TCP parameters so it can be managed and configured separately.
- Link
- Runs as a single thread
- Manages the packets that are flowing in and out in both directions
- Implemented in a way that simulates link speed and also allows to graphically present the packets on the applet
- Packet
- As expected, we have a packet class which has the required properties as source, destination, number of retransmissions, and RTO for the packet. We move the packets between all network components
- GUI
- At the end of the day, the important thing is what we present. There are many GUI related classes and code in the applet that enable us to show all the things that go on in the network
Out of scope for this applet
- This simulation is does not fully simulate the TCP protocol. We simplified the node buffer management by not managing a buffer and stopping the simulation in case one of the node's queues exceeds pre-defined thresholds
- In addition, we simplified the link capacity by dropping packets in case the link's queue exceeds a pre-defined packet lost percentage
This applet was developed by Itay Cohen, Sharon Levi, Yotam Katzil, and Avigail Garti as a course requirement for Protocols and Computer Networks, taught by Dr. Debby Koren in the program for an MA in Computer Science at Hadassah Academic College, Jerusalem.
