borisivan
borisivan

Reputation: 71

why do my docker containers on SLES 12 take 2x memory compared to Ubuntu?

I noticed that my docker containers on SLES 12 were taking approximately 2x the memory compared to identical containers on Ubuntu. Same version of docker.

For example, running selenium/hub, and not running any tests (not doing anything with the container at all), here are the docker stats after about 1 minute:

Just loading selenium/hub, and not doing anything (no tests, etc):

SLES 12:

CONTAINER    CPU % MEM USAGE / LIMIT   MEM %    NET I/O       BLOCK I/O     PIDS
8ce43b4e9a23 0.06% 149.1MiB / 15.6GiB  0.93%    0B / 0B       57.5MB / 0B   0

Ubuntu:

CONTAINER    CPU % MEM USAGE / LIMIT     MEM %   NET I/O       BLOCK I/O       PIDS
05d3140608b4 0.12% 74.79 MiB / 15.67 GiB 0.47%   0 B / 648 B   0 B / 8.19 kB   26

Any ideas?

Upvotes: 1

Views: 68

Answers (2)

Raghwendra Singh
Raghwendra Singh

Reputation: 2234

Since you are using same image but getting different resource consumption metrics, I guess it is because of the different base kernels on respective Operating Systems.

How much resource your container(created by docker) consumes is dependent on it. Docker uses kernel level APIs(cgroups and namespaces) to facilitate the isolation your program needs.

Upvotes: 0

Ricardo Branco
Ricardo Branco

Reputation: 6079

What is the output of docker info?

On Ubuntu, the default storage driver is aufs while SLES uses devicemapper or btrfs.

Excerpts from the above links:

Memory usage: the devicemapper uses more memory than some other storage drivers. Each launched container loads one or more copies of its files into memory, depending on how many blocks of the same file are being modified at the same time. Due to the memory pressure, the devicemapper storage driver may not be the right choice for certain workloads in high-density use cases.

-

Page caching. Btrfs does not support page cache sharing. This means that each process accessing the same file copies the file into the Docker hosts’s memory. As a result, the btrfs driver may not be the best choice high-density use cases such as PaaS.

The supported storage drivers for SLES 12:

https://www.suse.com/documentation/sles-12/singlehtml/book_sles_docker/book_sles_docker.html#Docker_Used_Drivers

I guess you can use overlay2 if you upgrade to SP2 with the 4.4.21 kernel.

https://www.novell.com/support/kb/doc.php?id=3594951

Upvotes: 1

Related Questions