gpt4 book ai didi

docker - 同一主机上的 Docker 容器是否共享相同的页面缓存?

转载 作者:行者123 更新时间:2023-12-01 22:21:39 26 4
gpt4 key购买 nike

如果我有两个在同一主机上运行的 Docker 容器,它们每个都有自己的页面缓存还是使用主机的页面缓存?

最佳答案

Page cache由内核管理,所有容器都使用内核。

查看更多信息 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)

关于docker - 同一主机上的 Docker 容器是否共享相同的页面缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47935039/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com