You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2018/04/18 04:21:59 UTC

[06/12] mesos git commit: Added new --memory_profiling flag to agent and master binaries.

Added new --memory_profiling flag to agent and master binaries.

This flag allows explicit disabling of the memory profiler
endpoint in the master and agent binaries.

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


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

Branch: refs/heads/master
Commit: 58e224efe4173fe5061c968b41712053b7c22a3e
Parents: 81c9978
Author: Benno Evers <be...@mesosphere.com>
Authored: Tue Apr 17 18:31:47 2018 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Apr 18 06:20:29 2018 +0200

----------------------------------------------------------------------
 src/master/flags.cpp | 11 +++++++++++
 src/master/flags.hpp |  1 +
 src/master/main.cpp  |  2 ++
 src/slave/flags.cpp  | 11 +++++++++++
 src/slave/flags.hpp  |  1 +
 src/slave/main.cpp   |  2 ++
 6 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/58e224ef/src/master/flags.cpp
----------------------------------------------------------------------
diff --git a/src/master/flags.cpp b/src/master/flags.cpp
index dbb35be..4ad1375 100644
--- a/src/master/flags.cpp
+++ b/src/master/flags.cpp
@@ -627,6 +627,17 @@ mesos::internal::master::Flags::Flags()
       "However, this port (along with `advertise_ip`) may be used to\n"
       "access this master.");
 
+  // TODO(bevers): Switch the default to `true` after gathering some
+  // real-world experience.
+  add(&Flags::memory_profiling,
+      "memory_profiling",
+      "This setting controls whether the memory profiling functionality of\n"
+      "libprocess should be exposed when jemalloc is detected.\n"
+      "NOTE: Even if set to true, memory profiling will not work unless\n"
+      "jemalloc is loaded into the address space of the binary, either by\n"
+      "linking against it at compile-time or using `LD_PRELOAD`.",
+      false);
+
   add(&Flags::zk,
       "zk",
       "ZooKeeper URL (used for leader election amongst masters).\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/58e224ef/src/master/flags.hpp
----------------------------------------------------------------------
diff --git a/src/master/flags.hpp b/src/master/flags.hpp
index 505786e..4715f2b 100644
--- a/src/master/flags.hpp
+++ b/src/master/flags.hpp
@@ -108,6 +108,7 @@ public:
   Option<std::string> advertise_ip;
   Option<std::string> advertise_port;
   Option<flags::SecurePathOrValue> zk;
+  bool memory_profiling;
 
   // Optional IP discover script that will set the Master IP.
   // If set, its output is expected to be a valid parseable IP string.

http://git-wip-us.apache.org/repos/asf/mesos/blob/58e224ef/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 3def0f2..3f5b354 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -242,6 +242,8 @@ int main(int argc, char** argv)
     }
   }
 
+  os::setenv("LIBPROCESS_MEMORY_PROFILING", stringify(flags.memory_profiling));
+
   // Log build information.
   LOG(INFO) << "Build: " << build::DATE << " by " << build::USER;
   LOG(INFO) << "Version: " << MESOS_VERSION;

http://git-wip-us.apache.org/repos/asf/mesos/blob/58e224ef/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 4ea2286..e330e5f 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -1394,6 +1394,17 @@ mesos::internal::slave::Flags::Flags()
       "this IPv6 address is only used to advertise IPv6 addresses for\n"
       "containers running on the host network.\n");
 
+  // TODO(bevers): Switch the default to `true` after gathering
+  // some real-world experience.
+  add(&Flags::memory_profiling,
+      "memory_profiling",
+      "This setting controls whether the memory profiling functionality of\n"
+      "libprocess should be exposed when jemalloc is detected.\n"
+      "NOTE: Even if set to true, memory profiling will not work unless\n"
+      "jemalloc is loaded into the address space of the binary, either by\n"
+      "linking against it at compile-time or using `LD_PRELOAD`.",
+      false);
+
   add(&Flags::domain,
       "domain",
       "Domain that the agent belongs to. Mesos currently only supports\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/58e224ef/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index beae47f..4195d3b 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -192,6 +192,7 @@ public:
   Option<std::string> advertise_ip;
   Option<std::string> advertise_port;
   Option<flags::SecurePathOrValue> master;
+  bool memory_profiling;
 
   Duration zk_session_timeout;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/58e224ef/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index dcc9448..ca35668 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -364,6 +364,8 @@ int main(int argc, char** argv)
     os::setenv("LIBPROCESS_ADVERTISE_PORT", flags.advertise_port.get());
   }
 
+  os::setenv("LIBPROCESS_MEMORY_PROFILING", stringify(flags.memory_profiling));
+
   // Log build information.
   LOG(INFO) << "Build: " << build::DATE << " by " << build::USER;
   LOG(INFO) << "Version: " << MESOS_VERSION;