Author: mrogers
Date: 2006-08-10 22:40:48 +0000 (Thu, 10 Aug 2006)
New Revision: 10036
Removed:
trunk/apps/load-balancing-sims/phase5-coalescing/Ack.java
trunk/apps/load-balancing-sims/phase5-single-ack-delay/
Modified:
trunk/apps/load-balancing-sims/phase5-coalescing/Node.java
trunk/apps/load-balancing-sims/phase5-coalescing/Packet.java
trunk/apps/load-balancing-sims/phase5-coalescing/Peer.java
trunk/apps/load-balancing-sims/phase5-coalescing/Sim.java
trunk/apps/load-balancing-sims/phase5-no-ack-delay/Node.java
trunk/apps/load-balancing-sims/phase5-no-ack-delay/Sim.java
Log:
Subtracting the ack delay breaks retransmission on links with rtt << 100ms
Deleted: trunk/apps/load-balancing-sims/phase5-coalescing/Ack.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-coalescing/Ack.java 2006-08-10
21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-coalescing/Ack.java 2006-08-10
22:40:48 UTC (rev 10036)
@@ -1,13 +0,0 @@
-// Tell the sender how long each ack was delayed so it can measure the RTT
-
-class Ack
-{
- public final int seq; // Sequence number of an acked packet
- public final double delay; // Seconds the ack was delayed for coalescing
-
- public Ack (int seq, double delay)
- {
- this.seq = seq;
- this.delay = delay;
- }
-}
Modified: trunk/apps/load-balancing-sims/phase5-coalescing/Node.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-coalescing/Node.java 2006-08-10
21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-coalescing/Node.java 2006-08-10
22:40:48 UTC (rev 10036)
@@ -162,13 +162,12 @@
// Event callback
private void generateRequest()
{
- if (requestsGenerated++ > 10000) return;
- // Send a request to a random location
- Request r = new Request (locationToKey (Math.random()));
- log ("generating request " + r.id);
- handleRequest (r, null);
- // Schedule the next request
- Event.schedule (this, 0.0123, GENERATE_REQUEST, null);
+ for (int i = 0; i < 10000; i++) {
+ // Send a request to a random location
+ Request r = new Request (locationToKey (Math.random()));
+ log ("generating request " + r.id);
+ handleRequest (r, null);
+ }
}
// Event callback
Modified: trunk/apps/load-balancing-sims/phase5-coalescing/Packet.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-coalescing/Packet.java
2006-08-10 21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-coalescing/Packet.java
2006-08-10 22:40:48 UTC (rev 10036)
@@ -5,23 +5,23 @@
class Packet
{
public final static int HEADER_SIZE = 80; // Including IP & UDP headers
- public final static int ACK_SIZE = 8; // Size of an ack in bytes
+ public final static int ACK_SIZE = 4; // Size of an ack in bytes
public final static int MAX_SIZE = 1450; // MTU including headers
public final static int SENSIBLE_PAYLOAD = 1000; // Coalescing
public int src, dest; // Network addresses
public int size = HEADER_SIZE; // Size in bytes, including headers
public int seq = -1; // Data sequence number (-1 if no data)
- public ArrayList<Ack> acks = null;
+ public ArrayList<Integer> acks = null;
public ArrayList<Message> messages = null;
public double sent; // Time at which the packet was (re) transmitted
public double latency; // Link latency (stored here for convenience)
- public void addAck (Ack a)
+ public void addAck (int ack)
{
- if (acks == null) acks = new ArrayList<Ack>();
- acks.add (a);
+ if (acks == null) acks = new ArrayList<Integer>();
+ acks.add (ack);
size += ACK_SIZE;
}
Modified: trunk/apps/load-balancing-sims/phase5-coalescing/Peer.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-coalescing/Peer.java 2006-08-10
21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-coalescing/Peer.java 2006-08-10
22:40:48 UTC (rev 10036)
@@ -75,7 +75,8 @@
// Return to slow start when the link is idle
double now = Event.time();
- if (now - lastTransmission > RTO * rtt) window.reset();
+ if (now - lastTransmission > RTO * rtt + MAX_DELAY)
+ window.reset();
lastTransmission = now;
// Work out how large a packet we can send
@@ -100,10 +101,7 @@
Packet p = new Packet();
// Put all waiting acks in the packet
- for (Deadline<Integer> a : ackQueue) {
- double delay = now - (a.deadline - MAX_DELAY);
- p.addAck (new Ack (a.item, delay));
- }
+ for (Deadline<Integer> a : ackQueue) p.addAck (a.item);
ackQueue.clear();
ackQueueSize = 0;
@@ -163,7 +161,7 @@
public void handlePacket (Packet p)
{
if (p.messages != null) handleData (p);
- if (p.acks != null) for (Ack a : p.acks) handleAck (a);
+ if (p.acks != null) for (int ack : p.acks) handleAck (ack);
}
private void handleData (Packet p)
@@ -193,30 +191,28 @@
else log ("warning: received " + p.seq + " before " + rxSeq);
}
- private void handleAck (Ack a)
+ private void handleAck (int ack)
{
- log ("received ack " + a.seq);
+ log ("received ack " + ack);
double now = Event.time();
Iterator<Packet> i = txBuffer.iterator();
while (i.hasNext()) {
Packet p = i.next();
double age = now - p.sent;
// Explicit ack
- if (p.seq == a.seq) {
+ if (p.seq == ack) {
log ("packet " + p.seq + " acknowledged");
i.remove();
// Update the congestion window
window.bytesAcked (p.size);
// Update the average round-trip time
- rtt *= RTT_DECAY;
- rtt += (age - a.delay) * (1.0 - RTT_DECAY);
- log ("ack delay " + a.delay);
- log ("round-trip time " + (age - a.delay));
+ rtt = rtt * RTT_DECAY + age * (1.0 - RTT_DECAY);
+ log ("round-trip time " + age);
log ("average round-trip time " + rtt);
break;
}
// Fast retransmission
- if (p.seq < a.seq && age > FRTO * rtt) {
+ if (p.seq < ack && age > FRTO * rtt + MAX_DELAY) {
p.sent = now;
log ("fast retransmitting packet " + p.seq);
node.net.send (p, address, latency);
Modified: trunk/apps/load-balancing-sims/phase5-coalescing/Sim.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-coalescing/Sim.java 2006-08-10
21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-coalescing/Sim.java 2006-08-10
22:40:48 UTC (rev 10036)
@@ -6,7 +6,7 @@
{
public static void main (String[] args)
{
- double txSpeed = 15000, rxSpeed = 15000; // Bytes per second
+ double txSpeed = 1000000, rxSpeed = 1000000; // Bytes per second
// rxSpeed = Math.exp (rand.nextGaussian() + 11.74);
// txSpeed = rxSpeed / 5.0;
@@ -18,10 +18,10 @@
Node n2 = new Node (txSpeed, rxSpeed);
Node n3 = new Node (txSpeed, rxSpeed);
- n0.connectBothWays (n1, 0.1);
- n1.connectBothWays (n2, 0.1);
- n1.connectBothWays (n3, 0.1);
- n2.connectBothWays (n3, 0.1);
+ n0.connectBothWays (n1, 0.001);
+ n1.connectBothWays (n2, 0.001);
+ n1.connectBothWays (n3, 0.001);
+ n2.connectBothWays (n3, 0.001);
Event.schedule (n0, 0.0, Node.GENERATE_REQUEST, null);
Modified: trunk/apps/load-balancing-sims/phase5-no-ack-delay/Node.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-no-ack-delay/Node.java
2006-08-10 21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-no-ack-delay/Node.java
2006-08-10 22:40:48 UTC (rev 10036)
@@ -162,13 +162,12 @@
// Event callback
private void generateRequest()
{
- if (requestsGenerated++ > 10000) return;
- // Send a request to a random location
- Request r = new Request (locationToKey (Math.random()));
- log ("generating request " + r.id);
- handleRequest (r, null);
- // Schedule the next request
- Event.schedule (this, 0.0123, GENERATE_REQUEST, null);
+ for (int i = 0; i < 10000; i++) {
+ // Send a request to a random location
+ Request r = new Request (locationToKey (Math.random()));
+ log ("generating request " + r.id);
+ handleRequest (r, null);
+ }
}
// Event callback
Modified: trunk/apps/load-balancing-sims/phase5-no-ack-delay/Sim.java
===================================================================
--- trunk/apps/load-balancing-sims/phase5-no-ack-delay/Sim.java 2006-08-10
21:39:56 UTC (rev 10035)
+++ trunk/apps/load-balancing-sims/phase5-no-ack-delay/Sim.java 2006-08-10
22:40:48 UTC (rev 10036)
@@ -6,7 +6,7 @@
{
public static void main (String[] args)
{
- double txSpeed = 15000, rxSpeed = 15000; // Bytes per second
+ double txSpeed = 1000000, rxSpeed = 1000000; // Bytes per second
// rxSpeed = Math.exp (rand.nextGaussian() + 11.74);
// txSpeed = rxSpeed / 5.0;
@@ -18,10 +18,10 @@
Node n2 = new Node (txSpeed, rxSpeed);
Node n3 = new Node (txSpeed, rxSpeed);
- n0.connectBothWays (n1, 0.1);
- n1.connectBothWays (n2, 0.1);
- n1.connectBothWays (n3, 0.1);
- n2.connectBothWays (n3, 0.1);
+ n0.connectBothWays (n1, 0.001);
+ n1.connectBothWays (n2, 0.001);
+ n1.connectBothWays (n3, 0.001);
+ n2.connectBothWays (n3, 0.001);
Event.schedule (n0, 0.0, Node.GENERATE_REQUEST, null);