So,
I’ve never bothered with this before, since systemD seems to work just fine.
But I did this year stop using Ubuntu for most of my hosting needs and moved to Alpine or Debian, depending on what I’m doing.
So it makes sense to optimize even more. I read up a little about why people dislike systemD. Good reasons if mainly you’re worried that it’s doing too much and is too heavy.
So what are the alternatives that work with both Alpine and Debian? What are people using? Is it relatively easy to move from systemD to whatever is your alternative?
Thanks!
I bought a miniPC from AliExpress last year expecting 8GB RAM and Intel N100. The vendor sent an Intel N5095 with 4 GB RAM. I clawed most of my money back, but kept the machine for experimentation. Upped the RAM with the money I got back.
Alpine seems to work best for that machine. Though, I’m tempted to just put Debian on there so I can make docker and portainer agent work on it easily.
Update: Intel 5095, not Intel 50. My bad!
there’s also devuan if you want, debian but with init freedom!
Huh? I don’t think you need anything near as memory efficient as Alpine for something which has 4GB of RAM, unless you’re doing it for the sole purpose of pushing the machine and yourself to the limit.
I only ever consider dropping Debian and/or Systemd when going below 512MB RAM. I’ve run most of my public-facing homelab stuff on a 1GB VPS till recently, including multiple webservers such as FoundryVTT, and Docker containers such as a Wireguard server, Jenkins, Searxng, etc… It rarely used more than ~60% of the RAM, but I obviously couldn’t run Immich or any heavy services on it.
Alpine is a fair amount lighter in memory consumption than Debian.
Is it? I thought the thing that musl optimized for was disk usage, not memory usage or CPU time. It’s been my experience that alpine containers are worse than their glibc counterparts because glibc is damn good. It’s definitely faster in many cases. I think this is fixed now, but I remember when musl made the python interpreter run like 50-100x slower.
EDIT: musl is good at what it tries to be good at. It’s not trying to be the fastest, it’s trying to be small on disk or over the network.
Glibc matters on desktop, but the speed advantage doesn’t really matter to services running in cgroup2 containers borrowing the host’s kernel and namespaces.
For op’s purposes, memory density is important, and alpine base images will need about 10x less memory than their Debian counterparts, mostly due to a very pared-down service layout.
There’s a reason a huge portion of docker images are alpine-based.
Do you have any sources for the 10x memory thing? I’ve seen people who have made memory usage claims, but I haven’t seen benchmarks demonstrating this.
EDIT: glibc-based images wouldn’t be using service managers either. PID 1 is your application.
EDIT: In response to this:
After months of research, my company pushed thousands and thousands of containers away from alpine for operational and performance reasons. You can get small images using glibc-based distros. Just look at chainguard if you want an example. We saved money (many many dollars a month) and had fewer tickets once we finished banning alpine containers. I haven’t seen a compelling reason to switch back, and I just don’t see much to recommend Alpine outside of embedded systems where disk space is actually a problem. I’m not going to tell you that you’re wrong for using it, but my experience has basically been a series of events telling me to avoid it. Also, I fucking hate the person that decided it wasn’t going to do search domains properly or DNS over TCP.
musl does support DNS over TCP since version 1.2.4.
That is incus. But similar in other implementations of LXC. Docker has similar ratios, but I suspect you know this already.
That has been fixed since 3.18.
Look, I’m not sure why you’re challenging me so hard on this, I’m not a superfan of Alpine or anything. I use it when I can because it’s really, really light on memory and so do others. There are lots of cases that don’t work with Alpine, like mongodb, sql, etc. because of what ships with alpine and their philosophy. But there are lots of great uses for alpine as well, like networking or anything that works well with busybox tooling.
Have a better one.
You make it sound like Debian is obviously superior to Alpine. Alpine Linux is just fine for server tasks. It is nice that is it lightweight, but that isn’t the only thing it has going for it.
Debian is superior for server tasks. musl is designed to optimize for smaller binaries on disk. Memory is a secondary goal, and cpu time is a non-goal. musl isn’t meant to be fast, it’s meant to be small and easily embedded. Those are great things if you need to run in a network/disk constrained environment, but for a server? Why waste CPU cycles using a libc that is, by design, less time efficient?
EDIT: I had to fight this fight at my job. We had hundreds of thousands of Alpine containers running, and switching them to glibc-based containers resulted in quantifiable cloud spend savings. I’m not saying musl (or alpine) is bad, just that you have horses for courses.
I’ve used Alpine on servers a lot and didn’t notice any performance difference when compared to glibc in the vast majority of cases. This performance comparison even suggests that musl is quite a bit faster in some cases and in most instances it is at least as fast as glibc, which matches my experience.
I’m not entirely sure how “… don’t need anything near as memory efficient as Alpine” became “Debian is obviously superior to Alpine”.
… I was referencing systemd and familiarity of use in regard to OP. Debian just happened to be mentioned, it comes per default with systemd, and it’s my personal first choice for servers. Though, taking context into account, OP did say they originally came from Ubuntu and made it sound like they were trying to optimize their system since it “only” had 4(8)GB memory in total.
I do believe Debian with systemd is more similar to Ubuntu than Alpine is to Ubuntu. My point was not so much about Debian vs Alpine in general as it was specific to efficiency in regard to memory usage, with the sole reason to change to Alpine over Debian (or any OS which uses systemd, really) purely for memory savings being rather weak when systemd only uses some <50MB in memory, the computer has 4GB+ of it, and the user already is familiar with Debian-based flavors which use systemd.
So no, Debian is obviously not “obviously superior to Alpine”, just as systemd isn’t too heavy to run on computers with 4GB of RAM - unless you’re trying to push the computer to its limits.
Okay, thanks for the explanation!
This was what made me assume this:
You can go with Debian (or Devuan), easily. My home server is running Proxmox on metal (Debian-based itself), virtualized OPNSense, and multiple Debian containers on an i3-4150 and previously 4GB RAM (now mis-matched 10GB).