You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2017/08/01 23:59:59 UTC

mesos git commit: Revised bulk dequeue for event queue.

Repository: mesos
Updated Branches:
  refs/heads/master 49c34f77d -> 3cbe00421


Revised bulk dequeue for event queue.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3cbe0042
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3cbe0042
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3cbe0042

Branch: refs/heads/master
Commit: 3cbe00421bdb225649e4bf8dbe9acb3ecc8064b5
Parents: 49c34f7
Author: Benjamin Hindman <be...@gmail.com>
Authored: Tue Aug 1 16:59:42 2017 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Aug 1 16:59:42 2017 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/event_queue.hpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3cbe0042/3rdparty/libprocess/src/event_queue.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/event_queue.hpp b/3rdparty/libprocess/src/event_queue.hpp
index 8b4f53d..21c522d 100644
--- a/3rdparty/libprocess/src/event_queue.hpp
+++ b/3rdparty/libprocess/src/event_queue.hpp
@@ -324,7 +324,18 @@ private:
 
       // If we can bulk dequeue more items then keep looking for the
       // out of order event!
-    } while (queue.try_dequeue_bulk(std::back_inserter(items), SIZE_MAX) != 0);
+      //
+      // NOTE: we use the _small_ value of `4` to dequeue here since
+      // in the presence of enough events being enqueued we could end
+      // up spending a LONG time dequeuing here! Since the next event
+      // in the sequence should really be close to the top of the
+      // queue we use a small value to dequeue.
+      //
+      // The intuition here is this: the faster we can return the next
+      // event the faster that event can get processed and the faster
+      // it might generate other events that can get processed in
+      // parallel by other threads and the more work we get done.
+    } while (queue.try_dequeue_bulk(std::back_inserter(items), 4) != 0);
 
     return nullptr;
   }