343 points · by FedericoRazzoli · 6y ago · 69 comments
A personal note here too. cgroups were invented at Google in the early 2000's. If you're using search today, gmail, docs, maps, etc. You're using cgroups. It sounds simple but this tech really powered a whole wave of innovation/startups/projects that almost everyone interacts with on a daily basis. Either through touching a Google service or interacting with anyone using Docker or Kubernetes (running on cgroups/namespaces). Pretty impressive.
#14 - Introduction to Linux Control Groups (Cgroups)
https://sysadmincasts.com/episodes/14-introduction-to-linux-...
#24 - Introduction to Containers on Linux using LXC
https://sysadmincasts.com/episodes/24-introduction-to-contai...
In my understanding, most of the initial commits (at least for LXC, which was the initial userspace) came from IBM, who funded it with interest in kernel-level resource balkanization for their largest mainframes. Google's kubernetes only appeared post-facto after docker, which itself was basically an lxc wrapper for a long time.
Source: I corresponded with two of the authors ~2009, was an early lxc user, and provided some security fixes for early docker.
I picked a file from the patch index mail linked above, mm_inline.h, and went scrolling through its history at https://github.com/torvalds/linux/commits/master/include/lin... but didn't see a corresponding change there. I guess the patches might have gotten refactored before merging or something too but would be nice to have a pointer in the Linux tree history that would work as a reference.
edit: tried looking for linux/container.h too but that just brings up a newer acpi container related container.h: https://github.com/torvalds/linux/commits/master/include/lin...
edit 2: history for linux/cgroup.c starts in a year later in 2007, with this commit: https://github.com/torvalds/linux/commit/ddbcc7e8e50aefe467c... - it has mentions of people from OpenVZ, IBM and a bunch of unaffiliated domains in addition to the signed-off-by line from a Googler (Paul Menage).
"Adding Generic Process Containers to the Linux Kernel" https://www.kernel.org/doc/ols/2007/ols2007v2-pages-45-58.pd...
Although the paper was written by Paul B. Menage it looks like Balbir Singh and Srivatsa Vaddagiri from IBM also made contributions to it.
This tech has completely changed the sysadmin landscape/job descriptions and sort of threw tons of gas the whole devops movement.
Disclaimer: I worked at both Docker & Google. Although not on this tech specifically. Opinions are my own here.
I'm happy to find that I agree with you on at least one area of this new ecosystem :)
Red Hat is trying to base all their stuff on Podman, which is Docker rewritten to by a script instead of a client/server (but can be renamed and used as a drop-in Docker replacement with the same command API). If they have their way, that statement will not longer be quite as correct.
Redhat’s answer to capital D Docker is cri-o.
I'm not sure that's true - a lot of Kubernetes system use containerd these days.
Why use something higher level than you need that wraps containerd (namely Docker) instead of something that is exactly at the level you want: containerd itself? The only real advantage of wrapping docker is that doing so ensures the docker cli works for introspecting containers.
The Docker folks don't want people to be wrapping dockerd, because then those infrastructure folk complain about changes/additional features in dockerd. Even dockerd is (glacially) moving in the direction of move heavily using containerd, for example using it to pull/store images.
The longer-term intent appears to be for dockerd being more for implementing docker specific stuff like its networking, swarm/stack, and various features needed by the front-end.
Yes, Kubernetes uses cgroup too.
Systemd units are also based on cgroups.
Thank you.
Edit: well, at least part four, finally, properly document how to cope with systemd. And guess what, it is different than 90% of documentation on cgroups on the internet.
https://www.schutzwerk.com/en/43/posts/linux_container_intro...
I also tend to think that processes in cgroups are a sweet spot of lightweight containerization that can do quite a bit.
"it's not just badly written kernel/cgroup.c - the interfaces on both sides (userland and the rest of kernel) are seriously misdesigned. As far as I'm concerned, configuring it out solves my problem nicely."
That was in 2011, so things might have improved. What remains however is that cgroups was added to the kernel, by Googlers, for easier maintenance, but with an implicit understanding that no sane person would actually make use of it to do something important.
... enter SystemD.
Cpusets, which had already been accepted into the kernel a year or two previously, provided the basic userspace API for cgroups. It was just expanded to support control files for more resource types. (And multiple resource hierarchies, although that's gone in cgroups v2 I think).