add custom getLoad() for multifeed leaf
authorEdward Chin <edwardc@fb.com>
Tue, 18 Nov 2014 21:21:00 +0000 (13:21 -0800)
committerDave Watson <davejwatson@fb.com>
Wed, 19 Nov 2014 20:53:12 +0000 (12:53 -0800)
Summary:
getLoad() is called in servicerouter loadbalancing when a load_counter is not specified.  I added a custom getLoad() for leaf and made it so that different metrics can be tested without code pushes.

Changes:
1) Overloaded PriorityThreadManager::getCodel() so you can specify a PRIORITY.  aggr->leaf thrift calls are marked as HIGH priority.
2) The value of FLAGS_load_metric determines what metric the custom getLoad() will use (codel, max requests, or fallback to ThriftServer::getLoad()).
3) Smc listener for FLAGS_load_metric.
4) Removed server->setIsUnevenLoad(false) since there isn't reason this need to be set, and activeRequests_ and getPendingCount() are not tracked when isUnevenLoad_ is false.

Test Plan: Run leaf and check that smc listener works.  Custom getLoad() won't be called until t5625774 is resolved.

Reviewed By: hitesh@fb.com

Subscribers: njormrod, folly-diffs@, trunkagent, varunk, fugalh, alandau, nkgupta, bmatheny, jaredg, xie, mshneer, yguo

FB internal diff: D1685215

Signature: t1:1685215:1416339297:0d1f8cb0cec27242d95f0067337d80149b0a720e

folly/experimental/wangle/concurrent/Codel.cpp
folly/experimental/wangle/concurrent/Codel.h

index d6558d4cb210670ae18a2b92c86db6daaeebc0af..527058ce8467c32a01f186cc9c2c256e6912d5ee 100644 (file)
@@ -80,7 +80,12 @@ bool Codel::overloaded(std::chrono::microseconds delay) {
 }
 
 int Codel::getLoad() {
-  return std::min(100, (int)codelMinDelay_.count() / FLAGS_codel_interval);
+  return std::min(100, (int)codelMinDelay_.count() /
+                  (2 * FLAGS_codel_target_delay));
+}
+
+int Codel::getMinDelay() {
+  return (int) codelMinDelay_.count();
 }
 
 }} //namespace
index f969fc36e99ee088663c91e6a48d3105ba5c319c..16f0205b146f8c55e277ecb1a98cee00e79e03dd 100644 (file)
@@ -50,6 +50,8 @@ class Codel {
   // Return:  0 = no delay, 100 = At the queueing limit
   int getLoad();
 
+  int getMinDelay();
+
  private:
   std::chrono::microseconds codelMinDelay_;
   std::chrono::time_point<std::chrono::steady_clock> codelIntervalTime_;