Docker & Containers (50 Qs)•Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
High-Performance Container I/O: Shared Memory (`/dev/shm`), Hugepages, and Host Networking.
senior LevelFormsPerformanceSecurity & Auth
In Simple Words: Default container configurations can cripple high-throughput databases (Postgres, Redis) or ML workloads (PyTorch):
- Shared Memory Limit: Docker defaults
/dev/shmto a meager 64MB. Deep learning frameworks and multi-process browsers (Puppeteer, Playwright) crash immediately withbus errororSIGBUS. Fix:docker run --shm-size=2g .... - Hugepages (
--sysctl vm.nr_hugepages=1024): Bypasses 4KB page table traversal overhead for in-memory databases. - Host Networking (
--network=host): Skips the Linux bridge NAT and iptables connection tracking (conntrack), cutting latency and CPU consumption by 15-25% for high-packet-per-second applications.