Docker [SOLVED]: Do Docker containers on the same host machine share the same page cache?

Docker [SOLVED]: Do Docker containers on the same host machine share the same page cache?

Home Forums Automation Tools Docker Tutorials Docker [SOLVED]: Do Docker containers on the same host machine share the same page cache?

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245012

    Cloudy Point
    Keymaster

    QuestionQuestion

    If I have two Docker containers running on the same host machine do they each have their own page cache or do they use the page cache of the host machine?

    #245013

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    Page cache is managed by the kernel, which is used by all the containers.

    See more at moby/moby issue 21759

    Docker makes it easy to spawn a lot of containers and get better density, but it also makes it easy to run too many services on one machine or to run services which require way too much RAM.

    The official documentation lists devicemapper (direct-lvm) as a production ready storage driver, but it doesn’t have very efficient memory usage. The official documentation doesn’t state otherwise either. Multiple identical containers will increase memory usage for the page cache.

    In order to make this better and get better performance, the following should help, in a similar way to how it helps outside of Docker and containers in general:

    • make containers smaller for long running services & applications (e.g. smaller binaries, smaller images, optimize memory usage, etc)
    • VERY IMPORTANT: use volumes and bind mounts, instead of storing data inside the container
    • VERY IMPORTANT: make sure to run a system with a maintained kernel, up to date Docker and devicemapper libraries (e.g. fully updated CentOS 7 / RHEL 7 / Ubuntu 14.04 / Ubuntu 16.04)

    Source: https://stackoverflow.com/questions/47935039/do-docker-containers-on-the-same-host-machine-share-the-same-page-cache
    Author: VonC
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.