Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Add hack for obtaining cgroup stats
Browse files Browse the repository at this point in the history
Docker mounts cgroup stats inconsistently with the hierarchy 
in /proc/self/cgroup. This breaks the logic for traversing
from /proc/self/cgroup to the stats for a process running inside a
container. In core Elasticsearch, an undocumented hack was added to
support this, for now. Thus, for cgroup stats to be available from
Elasticsearch running inside a Docker container, the Elasticsearch
process should be started with `-Des.cgroups.hierarchy.override=/`.

Add hack for obtaining cgroup stats and comment it.

Relates #25 
Relates elastic/elasticsearch#22757
  • Loading branch information
jasontedor authored and dliappis committed Jan 25, 2017
1 parent f085bef commit c922253
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build/elasticsearch/bin/es-docker
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,18 @@ do
fi
done < <(env)

# The virtual file /proc/self/cgroup should list the current cgroup
# membership. For each hierarchy, you can follow the cgroup path from
# this file to the cgroup filesystem (usually /sys/fs/cgroup/) and
# introspect the statistics for the cgroup for the given
# hierarchy. Alas, Docker breaks this by mounting the container
# statistics at the root while leaving the cgroup paths as the actual
# paths. Therefore, Elasticsearch provides a mechanism to override
# reading the cgroup path from /proc/self/cgroup and instead uses the
# cgroup path defined the JVM system property
# es.cgroups.hierarchy.override. Therefore, we set this value here so
# that cgroup statistics are available for the container this process
# will run in.
export ES_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ $ES_JAVA_OPTS"

exec bin/elasticsearch ${es_opts}

0 comments on commit c922253

Please sign in to comment.