You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/04/25 23:32:10 UTC

[17/50] mesos git commit: Disabled "drop_log_memory" flag for glog.

Disabled "drop_log_memory" flag for glog.

When this flag is set, glog makes several hundred `posix_fadvise(...,
POSIX_FADV_DONTNEED)` calls per second to advise the kernel to drop
in-memory buffers related to log contents.

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


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

Branch: refs/heads/0.26.x
Commit: 499c68efc1f8e4f5169e3dfb7a37206908456ecc
Parents: a07520e
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Jan 19 15:08:26 2016 -0500
Committer: Michael Park <mp...@apache.org>
Committed: Fri Feb 26 20:59:05 2016 -0800

----------------------------------------------------------------------
 src/logging/logging.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/499c68ef/src/logging/logging.cpp
----------------------------------------------------------------------
diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp
index fb79867..4639157 100644
--- a/src/logging/logging.cpp
+++ b/src/logging/logging.cpp
@@ -37,6 +37,13 @@
 
 #include "logging/logging.hpp"
 
+// Declare FLAGS_drop_log_memory flag for glog. This declaration is based on the
+// the DECLARE_XXX macros from glog/logging.h.
+namespace fLB {
+  extern GOOGLE_GLOG_DLL_DECL bool FLAGS_drop_log_memory;
+}
+using fLB::FLAGS_drop_log_memory;
+
 using process::Once;
 
 using std::string;
@@ -164,6 +171,16 @@ void initialize(
 
   FLAGS_logbufsecs = flags.logbufsecs;
 
+  // Do not drop in-memory buffers of log contents. When set to true, this flag
+  // can significantly slow down the master. The slow down is attributed to
+  // several hundred `posix_fadvise(..., POSIX_FADV_DONTNEED)` calls per second
+  // to advise the kernel to drop in-memory buffers related to log contents.
+  // We set this flag to 'false' only if the corresponding environment variable
+  // is not set.
+  if (os::getenv("GLOG_drop_log_memory").isNone()) {
+    FLAGS_drop_log_memory = false;
+  }
+
   google::InitGoogleLogging(argv0.c_str());
   if (flags.log_dir.isSome()) {
     // Log this message in order to create the log file; this is because GLOG