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 00:15:31 UTC

[2/2] 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/06341309
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/06341309
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/06341309

Branch: refs/heads/master
Commit: 06341309e61a5cee702ea3c7b6d3ef340ac95ad0
Parents: 11fffd3
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:14:48 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/06341309/src/slave/gc.cpp
----------------------------------------------------------------------
diff --git a/src/slave/gc.cpp b/src/slave/gc.cpp
index 83e4e2f..390b35e 100644
--- a/src/slave/gc.cpp
+++ b/src/slave/gc.cpp
@@ -18,7 +18,6 @@
 
 #include <list>
 
-#include <process/async.hpp>
 #include <process/check.hpp>
 #include <process/defer.hpp>
 #include <process/delay.hpp>
@@ -226,7 +225,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/06341309/src/slave/gc_process.hpp
----------------------------------------------------------------------
diff --git a/src/slave/gc_process.hpp b/src/slave/gc_process.hpp
index c383ce2..433b0e0 100644
--- a/src/slave/gc_process.hpp
+++ b/src/slave/gc_process.hpp
@@ -20,6 +20,7 @@
 #include <list>
 #include <string>
 
+#include <process/executor.hpp>
 #include <process/future.hpp>
 #include <process/id.hpp>
 #include <process/owned.hpp>
@@ -106,6 +107,9 @@ private:
   hashmap<std::string, process::Timeout> timeouts;
 
   process::Timer timer;
+
+  // For executing path removals in a separate actor.
+  process::Executor executor;
 };
 
 } // namespace slave {