Ask HN: Is 8gb RAM enough for a Linux dev laptop?

17 points by herodoturtle ↗ HN
New laptop, core i5, plugged into external 4K display, 5 to 10 chrome tabs, the odd full screen zoom meeting.

On a budget, and the 16gb option in my area (very remote) is more than double the price.

74 comments

[ 3.0 ms ] story [ 132 ms ] thread
I've been using a Macbook Air M1 with 8gb of ram to run a bunch of Chrome tabs, multiple iOS simulators, docker, an external display, plus the obligatory slack and zoom apps simultaneously and never ran into any issues. I assume most linux distributions would handle this even better than MacOS but anyone correct me if I'm wrong.
How is that possible? Or by "never run into any issues" you mean the machine wasn't completely unusable while it continuously was swapping everything everything to disk?

As I sit here and type with one citrix session and two chrome tabs open, I'm using 16.91gb of heap.

I've seen quite a few YouTube videos of people seeing how much they can do on minimally configured Apple silicon Macs, and it is insane.

My guess is that what is going on is that the internal storage is so fast that if it has to swap when switching tasks it doesn't really cause much slowdown, so that as long as each individual task can fit in memory during its time slice you are fine.

(Well...fine in the sense that it is almost as fast as a system with much more memory. But if I'm right it is also increasing the write load on the SSD and so lowering its lifetime, which those who want to use their computers for a long time might want to take into account).

I'd guess the same would happen on other operating systems and architectures if the SSD was fast enough.

Internal storage will still be an order of magnitude slower than ram, right?

Apple silicone memory bandwidth is like 100-200Gb/sec versus maybe 10Gb/sec for the ssd on a good day. Anyone can run on like a gig of heap, but nothing will be "fast", including apple silicone.

At 10 GB/sec it would take ~800 ms if you were trying to resume a process that needs 8 GB and was entirely swapped out, assuming that all 8 GB have to be present for it to run. (Add another 800 ms if it has to entirely swap out 8 GB of the previous process to make room, unless the SSD can overlap reads and writes).

But most big processes don't need everything to be present in memory to resume. You just need to bring in the code and data that will be used in the short term.

10 GB in a second is 1 GB in 100 ms or 100 MB in 10 ms or 1 MB in 100 µs.

For many programs, especially GUI programs, you can maybe swap in enough for the main event loop and whatever is being actively worked on in a couple ms. Then as the user continues working you might have to spend another ms or so when they do something that needs code or data that wasn't already brought in.

Yes, my machine does swap quite generously. I have never noticed any slowdowns except when working with large video projects. However, I'm coming from an entry level 2015 MacBook Pro, so maybe I just don't know what's fast anymore. I am a little concerned about the SSD lifespan but that's something I'm still looking into.
yeah i have a macbook pro 13" that work got me. M1, 8gb of ram and for what i'm doing i've not even noticed a slowdown.

rails / react / arc browser with tons of tabs, spotify, slack, vscode, obsidian, etc all open 24/7 and it feels as snappy if not snappier than my personal laptop. plus it's plugged into a 4k monitor.

i've been seriously impressed

(comment deleted)
I got an Intel 11th gen i5 quad core laptop with 16GB DDR4 ram for $110 recently. I only use it with external monitors at home. Here is the trick:
Q: How do you keep a turkey in suspense?

A: ...

Laptop with broken screens for parts are very cheap on ebay.

I recently bought a lot of two broken laptops, all Intel 11th gen for $160. One used exclusively for web browing, zoom, and slack. Another used for coding and building. 16GB each for total of 32GB ram. Use barrier to share mouse/kb between the two.

(comment deleted)
Depends what you're developing.

I'd go for a lightweight desktop env like XFCE.

It depends. If you only develop native command line programs it will more than be enough. But every Slack, Discord, Teams, webmail client, ... you got to have open will cut more into your RAM than you think. If the documentation you work with is not js ridden websites but man pages, txts or pdfs, your workflow allows you to occasionally close all tabs, and you do need to run software with big ram use on an ongoing basis you should be fine. However if those circumstances change you might need to upgrade: - by putting more RAM in the machine - moving parts of your workflow to a different machine and use laptop as "thin-client" - switch machines

At the moment my memory use with 16 GB looks like this:

      total   used    free   shared  buff/cache   available
Mem: 16167816 13526588 1017224 805552 1624004 1420060

Swap: 24838136 10326200 14511936

and i have not found a good way to account for where my memory goes.

"top" then M (Shift M) to sort by memory usage might help.

Note that buffered/cache is aggressively cached filesystem data that is as good as free/available with the Linux kernel.

As others have said, your best bet is to use some lightweight desktop environment. You may also want to switch Chrome for Firefox.

Also: can't you buy the 8 GB model and buy the extra RAM separately?

Yes, 8gb is enough to do dev with.

Although I suggest not using Chrome, but another Chromium browser that can sleep tabs by default, or Firefox instead.

I would advise against 8GB, its really low even for lightweight work. You mention "dev' work: Imagine you have:

- few browser tabs

- IDE

- compilation

- maybe virtual machine or application under test running

its very easy to run out of RAM in this scenario, just parsing the source code and providing code completion can hang a pc these days. you can swap to disc but you will be hurting

if you buying 8GB is only option make sure the laptop has free RAM slot(s) so you can upgrade later

more tips:

- forget about GUI, look up i3

- if you can, install arch, or some other distro that lets you manually pick packages, if you go for ubuntu, be prepared to be disabling a lot of services after first install (not a huge pain, you can google how to do it)

It is often much cheaper to upgrade than buy a package. Can you upgrade the ram later if you need to? I have a very old Thinkpad that I upgraded to 16gb ram some time ago and it works fine for everything I need, except editing gigapixel images (files sizes in multiple gb). I have a 64gb ram workstation for that.
Take 16gb at all costs. The time will come when you have to run some weird software stack in a VM taking up 4G. Additionally your IDE clocking in at 1-2GB and suddenly you find yourself at the limits. Saving here is not worth it.
I remember running OpenBSD on my laptop in the early 2000s at a total system memory use of 26MB.

Running Dillo instead of Firefox, vi (or vim) for coding, and twm as window manager. That was super low even back then. I think the only unavoidable memory hog nowadays is wanting to have many browser tabs open. And having a heavy IDE; VSCode is pretty cheap on resource use, but with LSP support you can really feel a difference with a better CPU and enough RAM.

I used sub-1gb dev laptop until ~2015. The only real problem was the web browser. A Firefox or a Chromium would eat at least 1gb of RAM just for showing a single tab. That was annoying. I came away not wanting more ram, but wanting a less burdensome web.
8gb is enough, but I wouldn't buy a new laptop with 8gb unless I could update the ram in the future.
This 100%!

Buying a new laptop should not only serve you today but also AT LEAST 2-3 years (more like 5y) down the road.

I'm still using my Late 2013 MBP (which I even bought second hand a year or two old) today - everyday. Unfortunately this one will need to get replaced soon as even with this build quality things starting to come apart or work suboptimal after almost 10 years. Hoping my next one is more repairable/upgradable (so probably no Apple) and last at least 5 years

16GB is the bare minimum for me these days. I recommend 32GB, but your mileage may vary.
I'm curious, what are you doing that requited 32 gb of RAM?
It very much depends, but for a point of comparison:

With only 4GB, I have been mostly happy running:

  - Xfce
  - Firefox with thousands of tabs (most unloaded, and uBlock Origin installed!)
  - Postgres
  - Rails (one big app at a time)
  - Nginx
  - Slack desktop (Electron app)
  - tmux
  - vim as IDE, dozens of buffers, zero? plugins
  - zram for memory compression (kernel configuration.. this is critical)
  - Small (256GB) but quick SSD
  - Zero swap configured
  - Zero VMs locally!
If you are running Gnome, or Chrome, or Eclipse, or a big Java app, your experience will definitely be less good.

My biggest consumers were Firefox and Slack. Restarting these apps nightly kept things under control.

I set this machine up as a temporary thing for a temporary project. It didn't turn out to be temporary, but it took me years to get around to migrating to a new machine, which I did just a few months ago. I was shocked at how "actually really OK" it turned out to be.

And this was with 4GB, not 8GB! So, I'd respond with "Yes, maybe."

Kde is light weight Enough
If you have SSD you can pretty good use swap
I run ElementaryOS 5.1 on a 2010 Thinkpad i5. It works fine for (basic) dev with vscode and javascript + nodejs stuff. I use Brave as a browser: much lighter than chrome. I tried to move to ElementaryOS 6 but it was slower.
I've got a 4gb RAM pinebook pro, and use it as a dev laptop whenever I'm at my university, and didn't have any major problems. (Other than the missing vulkan support for the GPU, but I remedied that with swiftshader, oh and compiling llvm took very long, but thats not something I usually need to do)
I’d look at refurbished laptops if you’re price sensitive. I’d rather have enough ram than a brand new system.
8GB is probably enough to get by for most types of development, but personally I'd sacrifice some other spec on my computer (such as having the bare minimum HD space) to try and ensure that the RAM is at the normal level.
Question. Why a laptop if you're plugging it into a monitor and therefore using it like a desktop?

Does it have to be a laptop? If you just want something portable you can take from place A to place B and use with a monitor have a look at mini PCs. They're smaller than a laptop (about the same weight) so you can pop it in your bag easily to move around if that is your need.

The only real limitation is you can't sit down in a coffee shop to work. But if you have a couple fixed areas of work they are far more cost effective than a laptop and actually allow for upgrading (RAM and SSD anyway, more than you get on most laptops these days).

FWIW I picked one up for my son a couple of months ago. It's a Ryzen 5600H with 32GB RAM and 500GB NVMe SSD. Runs Windows 11 and Fedora perfectly. Does a little gaming but is mostly for school work. Makes a solid little dev system though.

Not to mention it had perfect Linux support out of the box. Literally everything worked (wifi, bluetooth, both HDMI with 4k60, etc) whereas on a laptop it can be a real pain to get everything working right. You can avoid so many headaches going mini pc over laptop.

for the described usecase, that should be fine. I would recommend getting rid of desktop environment (gnome, kfce ...), go for i3 instead. and don't use display manager, gtty is what you need to log in to your system. that would save you lot of memory and space.
With laptops (and few other things), I have a personal rule: It's better to spend a bit more and enjoy it than save money and suffer it. Having said that, if your budget is that tight and there's no possibility of saving a bit more in a reasonable amount of time, I would go for the 8GB version *only* if the model allows to upgrade the RAM, then, months later, after saving a bit of more money again, purchase more RAM and add it. If the model is one of those where the RAM is soldered, I wouldn't even bother.
Or do both and just get an older flagship model secondhand, both cheap(ish) and high mem... Especially now that full hd laptops (maybe I'm getting old but I don't really like higher-than-fhd resolutions on small screens, not on macs but especially not on linux)

I like to do machine learning, which means no battery life, and even an bad old laptop nvidia gets you performance close to an M1.

No, it is not. That is enough for like 1 tab browsing a bank website to pay the bills. Maybe open 1 wikipedia tab.
As others have said, only if upgradable -- you're going to want to add more RAM at some point .

And stay tf away from browsers.