You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/04/02 23:36:25 UTC

[08/15] git commit: TS-1067 Remove InkSinglePipeInfo and turn it into a single queue

TS-1067 Remove InkSinglePipeInfo and turn it into a single queue


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/39483b12
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/39483b12
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/39483b12

Branch: refs/heads/master
Commit: 39483b12897d11c2e22d8ea24d0c6b95e5b24c67
Parents: c3ebba3
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 26 11:07:14 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Apr 2 13:52:33 2013 -0600

----------------------------------------------------------------------
 iocore/net/P_UDPNet.h    |   33 +--------------------------------
 iocore/net/UnixUDPNet.cc |   39 +++++++++++----------------------------
 proxy/Main.cc            |    4 ----
 3 files changed, 12 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39483b12/iocore/net/P_UDPNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 44917f2..bf0d67d 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -75,7 +75,6 @@ public:
   ink_hrtime last_report;
   ink_hrtime last_service;
   ink_hrtime last_byteperiod;
-  int bytesSent;
   int packets;
   int added;
 
@@ -343,36 +342,6 @@ get_UDPNetHandler(EThread * t)
 }
 
 // All of this stuff is for UDP egress b/w management
-struct InkSinglePipeInfo
-{
-  InkSinglePipeInfo()
-  {
-    wt = 0.0;
-    bwLimit = 0;
-    count = 0;
-    bytesSent = pktsSent = 0;
-    bwAlloc = 0;
-    bwUsed = 0.0;
-    queue = NEW(new PacketQueue());
-  };
-
-  ~InkSinglePipeInfo() {
-    delete queue;
-  }
-
-  double wt;
-  // all are in bps (bits per sec.) so that we can do ink_atomic_increment
-  int64_t bwLimit;
-  int64_t bwAlloc;
-  // this is in Mbps
-  double bwUsed;
-  IpAddr destIP;
-  uint32_t count;
-  uint64_t bytesSent;
-  uint64_t pktsSent;
-  PacketQueue *queue;
-};
-
-extern InkSinglePipeInfo G_inkPipeInfo;
+extern PacketQueue G_inkPipeInfo;
 
 #endif //__P_UDPNET_H_

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39483b12/iocore/net/UnixUDPNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index e0e3cd7..fc94acc 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -59,7 +59,7 @@ int32_t g_udp_numSendRetries;
 // Public functions
 // See header for documentation
 //
-InkSinglePipeInfo G_inkPipeInfo;
+PacketQueue G_inkPipeInfo;
 
 int G_bwGrapherFd;
 sockaddr_in6 G_bwGrapherLoc;
@@ -630,7 +630,7 @@ Lerror:
 
 // send out all packets that need to be sent out as of time=now
 UDPQueue::UDPQueue()
-  : last_report(0), last_service(0), last_byteperiod(0), bytesSent(0), packets(0), added(0)
+  : last_report(0), last_service(0), last_byteperiod(0), packets(0), added(0)
 {
 }
 
@@ -710,7 +710,7 @@ UDPQueue::service(UDPNetHandler * nh)
       p->conn->nBytesTodo += pktLen;
 
       g_udp_bytesPending += pktLen;
-      G_inkPipeInfo.queue->addPacket(p, now);
+      G_inkPipeInfo.addPacket(p, now);
     }
   }
 
@@ -722,27 +722,11 @@ UDPQueue::service(UDPNetHandler * nh)
     lastPrintTime = now;
   }
 
-  G_inkPipeInfo.queue->advanceNow(now);
+  G_inkPipeInfo.advanceNow(now);
   SendPackets();
 
   timeSpent = ink_hrtime_to_msec(now - last_report);
   if (timeSpent > 10000) {
-    double bw, totalBw;
-
-    if (bytesSent > 0)
-      totalBw = (bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
-    else
-      totalBw = 1.0;
-
-    // bw is in Mbps
-    bw = (G_inkPipeInfo.bytesSent * 8.0 * 1000.0) / (timeSpent * 1024.0 * 1024.0);
-
-    // use a weighted estimator of current usage
-    G_inkPipeInfo.bwUsed = (4.0 * G_inkPipeInfo.bwUsed / 5.0) + (bw / 5.0);
-    G_inkPipeInfo.bytesSent = 0;
-    G_inkPipeInfo.pktsSent = 0;
-
-    bytesSent = 0;
     last_report = now;
     added = 0;
     packets = 0;
@@ -792,10 +776,10 @@ UDPQueue::SendPackets()
 sendPackets:
   sentOne = false;
   send_threshold_time = now + SLOT_TIME;
-  bytesThisPipe = (int32_t) (bytesThisSlot * G_inkPipeInfo.wt);
+  bytesThisPipe = (int32_t)bytesThisSlot;
 
-  while ((bytesThisPipe > 0) && (G_inkPipeInfo.queue->firstPacket(send_threshold_time))) {
-    p = G_inkPipeInfo.queue->getFirstPacket();
+  while ((bytesThisPipe > 0) && (G_inkPipeInfo.firstPacket(send_threshold_time))) {
+    p = G_inkPipeInfo.getFirstPacket();
     pktLen = p->getPktLength();
     g_udp_bytesPending -= pktLen;
 
@@ -806,7 +790,6 @@ sendPackets:
     if (p->conn->GetSendGenerationNumber() != p->reqGenerationNum)
       goto next_pkt;
 
-    G_inkPipeInfo.bytesSent += pktLen;
     SendUDPPacket(p, pktLen);
     bytesUsed += pktLen;
     bytesThisPipe -= pktLen;
@@ -823,8 +806,8 @@ sendPackets:
   if ((bytesThisSlot > 0) && (sentOne)) {
     // redistribute the slack...
     now = ink_get_hrtime_internal();
-    if (G_inkPipeInfo.queue->firstPacket(now) == NULL) {
-      G_inkPipeInfo.queue->advanceNow(now);
+    if (G_inkPipeInfo.firstPacket(now) == NULL) {
+      G_inkPipeInfo.advanceNow(now);
     }
     goto sendPackets;
   }
@@ -834,7 +817,7 @@ sendPackets:
     uint64_t nbytes = g_udp_bytesPending;
     ink_hrtime startTime = ink_get_hrtime_internal(), endTime;
 
-    G_inkPipeInfo.queue->FreeCancelledPackets(g_udp_periodicCleanupSlots);
+    G_inkPipeInfo.FreeCancelledPackets(g_udp_periodicCleanupSlots);
     endTime = ink_get_hrtime_internal();
     Debug("udp-pending-packets", "Did cleanup of %d buckets: %" PRId64 " bytes in %" PRId64 " m.sec",
           g_udp_periodicCleanupSlots, nbytes - g_udp_bytesPending, (int64_t)ink_hrtime_to_msec(endTime - startTime));
@@ -864,7 +847,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal * p, int32_t pktLen)
   msg.msg_name = (caddr_t) & p->to;
   msg.msg_namelen = sizeof(p->to);
   iov_len = 0;
-  bytesSent += pktLen;
+
   for (b = p->chain; b != NULL; b = b->next) {
     iov[iov_len].iov_base = (caddr_t) b->start();
     iov[iov_len].iov_len = b->size();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39483b12/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index dfde9c8..addbeeb 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1521,10 +1521,6 @@ main(int argc, char **argv)
   TS_ReadConfigInteger(history_info_enabled, "proxy.config.history_info_enabled");
   TS_ReadConfigInteger(res_track_memory, "proxy.config.res_track_memory");
 
-  // This was the default when we had no bandwidth_mgmt.filename to load
-  // but I don't know for sure if we still need this.
-  G_inkPipeInfo.wt = 1.0;
-
   init_http_header();
 
   // Sanity checks