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

[2/3] mesos git commit: Prevent GC path removals from blocking other processes.

Prevent GC path removals from blocking other processes.

This patch dispatches all path removals to a single executor instead of
one `AsyncExecutor` per path such that heavy-duty removals won't occupy
all worker threads and block other actors.

Review: https://reviews.apache.org/r/62230/


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

Branch: refs/heads/1.4.x
Commit: 27b83565082720cbc9c93b3b892305b899af84b7
Parents: bf82953
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Tue Sep 26 17:07:11 2017 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Tue Sep 26 17:30:12 2017 -0700

----------------------------------------------------------------------
 src/slave/gc.cpp | 6 ++++--
 src/slave/gc.hpp | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/27b83565/src/slave/gc.cpp
----------------------------------------------------------------------
diff --git a/src/slave/gc.cpp b/src/slave/gc.cpp
index f270fa4..86d94c8 100644
--- a/src/slave/gc.cpp
+++ b/src/slave/gc.cpp
@@ -16,7 +16,6 @@
 
 #include <list>
 
-#include <process/async.hpp>
 #include <process/check.hpp>
 #include <process/defer.hpp>
 #include <process/delay.hpp>
@@ -183,7 +182,10 @@ void GarbageCollectorProcess::remove(const Timeout& removalTime)
       return Nothing();
     };
 
-    async(rmdirs)
+    // NOTE: All `rmdirs` calls are dispatched to one executor so that:
+    //   1. They do not block other dispatches (MESOS-6549).
+    //   2. They do not occupy all worker threads (MESOS-7964).
+    executor.execute(rmdirs)
       .onAny(defer(self(), &Self::_remove, lambda::_1, infos));
   } else {
     // This occurs when either:

http://git-wip-us.apache.org/repos/asf/mesos/blob/27b83565/src/slave/gc.hpp
----------------------------------------------------------------------
diff --git a/src/slave/gc.hpp b/src/slave/gc.hpp
index b8d5301..f23ffd3 100644
--- a/src/slave/gc.hpp
+++ b/src/slave/gc.hpp
@@ -21,6 +21,7 @@
 #include <string>
 #include <vector>
 
+#include <process/executor.hpp>
 #include <process/future.hpp>
 #include <process/id.hpp>
 #include <process/owned.hpp>
@@ -140,6 +141,9 @@ private:
   hashmap<std::string, process::Timeout> timeouts;
 
   process::Timer timer;
+
+  // For executing path removals in a separate actor.
+  process::Executor executor;
 };
 
 } // namespace slave {