You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2018/09/28 23:57:35 UTC
[mesos] branch master updated: Cached the cgroup results in Docker
containerizer.
This is an automated email from the ASF dual-hosted git repository.
jieyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new 59b92a9 Cached the cgroup results in Docker containerizer.
59b92a9 is described below
commit 59b92a948fab386542f5ddfee275066694cf1f96
Author: Jie Yu <yu...@gmail.com>
AuthorDate: Fri Sep 28 15:55:59 2018 -0700
Cached the cgroup results in Docker containerizer.
Since the cgroup hierarchy results won't change, it does not make sense
to compute it every time `usage` is called. It will get quite expensivie
when the host mount table is big (e.g., MESOS-8418).
This patch uses the static local variable to cache the result.
Review: https://reviews.apache.org/r/68880
---
src/slave/containerizer/docker.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 277a155..aa1f6cc 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -2068,8 +2068,8 @@ Try<ResourceStatistics> DockerContainerizerProcess::cgroupsStatistics(
#ifndef __linux__
return Error("Does not support cgroups on non-linux platform");
#else
- const Result<string> cpuacctHierarchy = cgroups::hierarchy("cpuacct");
- const Result<string> memHierarchy = cgroups::hierarchy("memory");
+ static const Result<string> cpuacctHierarchy = cgroups::hierarchy("cpuacct");
+ static const Result<string> memHierarchy = cgroups::hierarchy("memory");
// NOTE: Normally, a Docker container should be in its own cgroup.
// However, a zombie process (exited but not reaped) will be
@@ -2144,7 +2144,7 @@ Try<ResourceStatistics> DockerContainerizerProcess::cgroupsStatistics(
// Add the cpu.stat information only if CFS is enabled.
if (flags.cgroups_enable_cfs) {
- const Result<string> cpuHierarchy = cgroups::hierarchy("cpu");
+ static const Result<string> cpuHierarchy = cgroups::hierarchy("cpu");
if (cpuHierarchy.isError()) {
return Error(