0

Recently, I discovered docker containers. Could someone please explain the performance difference in running a program on the host compared to running in a container?

Also, what does "programs run faster" mean in terms of better performance and lower startup latency? What would this look like in real-world terms?

Does containerisation require more resources compared to running in the host?

Am I correct in thinking that containers are better than VM since they don't have os of their own.

How do concepts like process scheduling work (are containers treated as a process by the host)?

Phill Healey
  • 3,084
  • 2
  • 33
  • 67
Akhil Surapuram
  • 654
  • 1
  • 8
  • 22
  • Linux containers are really just ordinary processes on a Linux system. These groups of processes are **isolated** from other groups of processes using resource constraints like (1) **cgroups**, (2) Linux security constraints (Unix permissions, capabilities, SELinux, AppArmor, seccomp, etc.), (3) **namespaces** (PID, network, mount, etc.). Sometimes this introduces a cost in performance, check this for example: [Performance issues running nginx in a docker container](https://stackoverflow.com/questions/49023800/performance-issues-running-nginx-in-a-docker-container) – tgogos Dec 13 '18 at 10:24
  • 1
    Where to start? *"Cgroups, namespaces, and beyond: what are containers made from?"* by Jérôme Petazzoni ([video](https://www.youtube.com/watch?v=sK5i-N34im8) & [slides](https://www.slideshare.net/jpetazzo/cgroups-namespaces-and-beyond-what-are-containers-made-from-dockercon-europe-2015)) or *"Linux container internals"* by Scott McCarty ([video](https://www.youtube.com/watch?v=KawKGsLR1V8) & [slides](https://docs.google.com/presentation/d/1S-JqLQ4jatHwEBRUQRiA5WOuCwpTUnxl2d1qRUoTz5g/edit#slide=id.gb6f3e2d2d_2_213)) – tgogos Dec 13 '18 at 10:34
  • 1
    docker alone does not make your application faster. However, it is a current general trend to make applications more lightweight ("microservices"), for example by using spring-boot over fully fledged application servers. This trend plays very well together with docker - each container becomes a lightweight, transient process, with low startup latency. But you could also dockerize your monolith and it would take as long to start as before. – Fabian Braun Dec 13 '18 at 10:49

0 Answers0