Ask HN: How would you build a budget CPU compute cluster in 2023?

42 points by margorczynski ↗ HN
So lately I've been dabbling in a lot of stuff that requires a lot of CPU compute, 0 GPU and can be basically linearly scaled across threads and nodes in a cluster.

Now using only my own box is proving to be a bottleneck so I've been thinking of either using AWS spot instances or building my own mini-cluster (2-3 machines + switch) at home. Does it make sense to go cloud (even spot) when I would aim at high utilization?

As for the potential node spec:

- Ryzen 4500/5500 (seems best perf/$)

- Some mATX AM4 mobo with integrated GPU

- 2x8GB RAM

- mATX case, the smaller the better. ITX seems pricier.

All the box does is basically run the k8s pod(s).

WDYT?

70 comments

[ 412 ms ] story [ 1936 ms ] thread
I would investigate buying used servers, workstations, desktops. Often you can find them for very cheap and in large quantities.
How long is this gonna be up and running? Cases may not be needed. If you're optimizing for cheap; then perhaps motherbaords and CPUs of a couple generations back are a better bet. "Refurb" deals can save a lot of money there.

Of course "cheap" can cost too much: if you need reliability and want it to run first time after assembly, then it might pay to spend more.

One problem to keep in mind with refurb though is power consumption. Ask me how I know (hint, there’s a rack of Dell r720’s in my basement).
I aim mainly for perf/cost and the cost is the TOC - this includes power consumption which currently is a big part of the cost in the long run. So I would aim for lower TDP under load - these newer Ryzen's seem to have 2x lower TDP than quite less performant older solutions.
What are you trying to optimize for? Solely the initial cost of hardware? Power consumption? Is there some performance target, task that needs to complete in X minutes, etc?

For example, I might suggest buying used Lenovo Tiny M75q's on eBay. The Ryzen 3400GE is significantly slower than your Ryzen 4500, but also lower TDP and very cheap procurement cost. Also fits your "smaller the better" wish. No ECC, though.

Cloud vs. on prem is going to come down basically to your duration of use and average/peak utilization ratio. For instance, if you want to run large parallel experiments 1 hour a day then 23 hours a day your compute is sitting idle then that will favor cloud more. Fundamentally on-prem you incur capital costs proportional to peak use whereas cloud opex is proportional to average use.

Once you have your intended compute lifecycle figured out you can compute the cloud cost and hardware cost and compare. Given you’re mentioning k8s I’m assuming this might be a continuous load in which case you’d amortize your hardware capital costs much faster.

Along with that, if you can find other users inside the company/research area/whatever that need compute power too, splitting that cost and getting higher usage numbers will also probably be favorable compared to cloud offerings then. It'd also let you split up the hardware and maintenance costs of keeping it on premises too.
Another really important factor here is workload size. If you NEED massive, parallel compute 1 hour a day, public cloud is probably your best option.

But if you can break that up and batch process it over 24h, and you don't have a need to scale up and down, a VPS from OVH is going to give you almost an order of magnitude lower cost than Azure, AWS, and GCP will for a box running 24h/day. What $5/mo gets you on OVH will run you close to $50/mo running 24/7 in a public cloud.

Note these are on-demand costs. Spot pricing or savings plans narrow the gap to more like 3-4x cost difference.
Mobos these days don't come with iGPUs. You'll need CPUs with graphics or buy cheap graphic adapters on eBay.

You can buy a couple of 16 to 22 core Xeons on AliExpress and a dual CPU motherboard for them. Plenty of reviews on YouTube.

> You'll need CPUs with graphics or buy cheap graphic adapters on eBay.

I'd recommend something like a GT 700-series card for this purpose. I've got one I stick into my server when I need it to have a screen. Costs like 50 bucks.

This will heavily depend on power costs in your area, but if your tasks are not just CPU heavy but also require a lot of RAM it's totally worth to consider old Xeons from China with used Samsung RAM.

This used hardware can be easily be 2-4 times cheaper than building using modern CPUs, but power usage is also much higher.

This. I wouof look at total cost (including power) for a year of the amount of compute you need. I suspect starting with a single modern massive core Epyc will start to look more attractive long-term than 10s of old Xeon boxes
or hetzner

beefy dedicated servers for 50/100 eur per month

you can use it for a few months and return it any time monthly contract)

> Does it make sense to go cloud (even spot) when I would aim at high utilization?

Hybrid cloud ?

"combines and unifies public cloud, private cloud and on-premises infrastructure to create a single, flexible, cost-optimal IT infrastructure."

Hetzner has a dedicated cheap server: ( monthly pricing )

https://www.hetzner.com/de/dedicated-rootserver/matrix-ax

- AMD Ryzen™ 5 3600 ( € 37.30 + VAT) / month

- AMD Ryzen™ 7 7700 ( € 59.00 + VAT ) / month + setup

- AMD Ryzen™ 9 5950X ( € 103.30 + VAT ) / month

- AMD EPYC™ 7502P ( € 119.80 + VAT ) / month + setup

You can buy complete Dell Workstations with e5 v4/v3 CPUs or even Xeon Gold CPUs for a pittance on ebay. They already have power management, etc built in and tend to run whisper quiet.
I just upgraded compute hardware at home and went with: ASRock Deskmeet X300 (itx case, motherboard, and 500w power supply), Ryzen 5600g, 32 gb ddr4, 512 gb m.2 for around $400. Pretty good bang for the buck.
Graphics. You may not need to have a graphics card in nodes once they are installed. So you may find you can get a single low end card and use that to install each host.

Power and heat. Will you have enough power for the nodes? What is the power trade-off if you get low-end chips vs higher-end chips? Have a look at the Ryzen page on wikipedia to get a feel for power use of each chip. How will you understand how much cooling you need? (more cooling takes more power)

RAM. How much does accuracy matter? Should you use ECC RAM? You can get UDIMMs to work in Ryzen kit, but not with the chips with integrated graphics card (i.e. avoid APU chips if you want ECC). Get Asrock or Asus AM4 motherboards, then get RAM like this - Samsung M393A4K40DB3-CWE. If you go cloud, you may find the hardware has ECC.

IO. Once the grid-of-nodes is in place will you be moving data to functions, or functions to data? How much data are you moving over the network per-job? Might there be IO bottlenecks when you scale up? How detailed a model of IO can you build before you settle on hardware?

I'd go with a rack and rack cases, if you can. There's a reason why the industry uses it.

I find that once you have a bunch of equipment piled up it makes a huge hard to manage mess, and that happens a lot faster than you'd expect. Before finally getting a rack I ended up with with a bunch of hardware caked in dust because it was all lying in such a precarious way that I was afraid to touch anything in there.

How much data do you need to move in/out? How much variation is there in demand?
Get as much cores as you can, use dual socket boards. You can find 12 core Xeon E5-2670V3 for about $12 on Aliexpress and dual socket X79 boards for about $75. Used ECC RAM is cheap.

Build your own boxes.

You can use Kerrighed or OpenSSI for the software side.

Wow they really cost peanuts. A bit high TDP but still...

Why is this so cheap? I always did software so my hardware knowledge is pretty basic but still this kind of chip can really offer a lot in terms of performance even now?

Perf/watt is bad

Perf/$ is only decent because they’re dirt cheap on the used market as datacenters are dumping them

Yeah from what I see the perf single thread is 2x lower than the Ryzen 5500 so even with 2x the cores you get more or less the same. Just that the Ryzen has 2x lower TDP.

Still, considering it is like 4-5x times cheaper and uses a mobo with two CPUs (which saves on cost cause you don't need to build 2 boxes) this might be a good idea that I'll strongly look into. Thanks!

Well all the Xeon Ex-xxxx vY stuff is more or less ten years old by now.
Large companies and data centers upgrade their hardware so there's a huge amount of hardware that either gets recycled or sold to hobbysts.
They’re a good value for playing around, but CPU performance has come a long way since those were released. A mid-range AMD desktop CPU could beat even a dual-socket server with two of those in most tasks, and a used 16-core AMD desktop chip will walk away from it in almost every benchmark. It will also be much quieter and consume less power while doing it.

If you’re on a shoestring budget, don’t mind hunting down and testing used parts, and power and noise aren’t an issue then those old server parts are great fun though.

Also don't forget no hardware spectre/meltdown mitigations. V2 Xeons are EOL and get no more updates or support, V3 isn't far behind. Once these go EOL (or get close), companies start dumping them.
It may not be the best use case for you. But you can use the Oracle Cloud forever free tier to run a basic Kubernetes setup. If you don't want the limitations on the networking then you can always pay extra for another public IP.
If you want high throughput, you may want to consider 10gbe and nvme.
> As for the potential node spec:

> - Ryzen 4500/5500 (seems best perf/$)

Price/performance is great for the CPU, but you have to spend hundreds of dollars on the motherboard, RAM, power supply, and case for each one.

You need to look at the overall system cost. If you’re building new, it could be cheaper overall to put 12-core or 16-core CPUs into a smaller number of machines than it would be to put a lot of $100 budget CPUs into many machines.

Unless your goal is to build a cluster for the sake of building a cluster, you might have a better price/performance ratio by building a single 16-core 7950X box than you would with three separate Ryzen 4500 or 5500 machines.

Even with perfect scaling, you would need at least 4 separate Ryzen 5500 machines to have a chance at beating a single 7950X for CPU-bound tasks. The 7950X CPU alone is barely more than 4X the cost of a Ryzen 5500, but you only need to buy one motherboard, one power supply, and so on.

> Even with perfect scaling, you would need at least 4 separate Ryzen 5500 machines to have a chance at beating a single 7950X for CPU-bound tasks.

According to Geekbench [0] you only need 3. [0] https://browser.geekbench.com/processor-benchmarks/

That’s still 3 separate motherboards, 3 separate cases, 3 separate power supplies, 3 separate sets of RAM, 3 machines idling instead of one, etc.
It's also way easier to use one bigger machine than a few networked ones for a lot of tasks.
As others have said -this is vague.

For my home server, I pick the smallest case that can fit a desktop CPU, so just a bit bigger than Intel Nuc. Those have laptop CPU's, you are overpaying. I am willing to pay extra for it to be small.

The two best contenders for me are Asrock DeskMini barebones system (picoITX) and IN WIN Chopin case - you gave to buy an ITX motherboard.

I use Chopin with an Intel CPU, they work for my usecase.

Also some motherboars can boot a ryzen without any GPU at all. Asrock usually will. If you are willing to deal with a totally headless system, go for it.

cpu cost is only a small fraction of overall cost: for every cpu, there is a power supply, ram, motherboard and case. You also haven't mentioned anything about data: do they need local storage or will it be only temporarily stored locally?

it sound like minipcs can be an excellent solution for you.

For how long will you be using this? AWS may be preferable in the short term while local hardware may be cheaper in the long term/a lot of cpu hours.

there is also the question of your application performance on different cpus. there are older servers available for very cheap prices but is it worth it to buy a 12/20core xeon cpu that consumers 200-300W if its performance is similar to a 5900 at 150W ?

If 2-3 Ryzen machines is all you need, you should just go for a Xeon/Epyc server. You can build a decent Epyc workstation/server with 64 cores for as little as $2k USD when using 2nd gen Epyc processors.
I have a couple similar machines in my homelab, running in ASRock X300 boxes w/Ryzen APUs (cpu+gpu), in a similar role (k3s).

The reason I have two is I started with a 3400g (4c/8t) due to supply limitations, then upgraded to a 4750g (8c/16t) when it became feasible. Over time I upgraded memory and storage, so eventually I had everything but the case for a second “half-power” machine.

Having multiple medium-power machines can be useful for rolling upgrades (and for learning purposes), but otherwise it’s very uneconomical.

If your goal is to maximize cores/$ then a single beefy machine will do best.

The server of Theseus! Did you make a new hostname for the server made of the old parts or did you give it back it's old hostname and rename the new-parts one?
It inherited the name of another machine, from where its primary storage was pulled (despite an OS replacement).

You make such a great point that I’m going to rename it: paradox

Thank you, Lithium!

If your workload is able to be split up and run efficiently on different machines, just buy as many cheap (or free) 1-to-10 year old used computers as you can, and run HTCondor on them for scheduling the jobs.
Honestly, look on ebay for used Lenovo ThinkCentre M/P "Tiny" or Dell Optiplex "Tiny" computers. They can be purchased by the lot for most of them as businesses get rid of the old ones.

I use 4 Lenovo M910x's as a kubernetes cluster and home lab. Have them all connected with a netgear switch. The whole setup costs about the same as a single new quality work station. Each has: i7 8700 (6c - 12t), 32gb memory, 1TB SSDs, <1L case, they're practically silent. easy to find parts, they even use lenovo laptop chargers. if one dies, I can easily purchase + replace in a few days.

You can even go cheaper if you don't need the absolute fastest cpus. Some of these older tiny computers can be purchased for around 100 bucks if you look for them. It has worked like a charm for me. Not sure how much horsepower you really need, but this is a cheap way to build a home cluster. I think they hover around using 40w most the time, so power isn't really too big of a cost either.

(comment deleted)
>I use 4 Lenovo M910x's as a kubernetes cluster and home lab.

Just asking out of curiosity: Why not a Ryzen 16-Core CPU + 128GB RAM and then VMs / containers everywhere? To me that seems much less hassle than having to pet four machines, as I am way too lazy to write automation stuff for myself. Also such a setup setup needs less space and probably less power.

>Just asking out of curiosity: Why not a Ryzen 16-Core CPU + 128GB RAM and then VMs / containers everywhere?

It will be harder to simulate failure there to see how the system behaves in such a case. You could just remove ethernet cable or remove a power cable, and see how it reacts.

Happen to have a write up on this? It sounds really cool. I’m in the process of retiring old machines for a client and I was thinking of doing that.
I have been wanting to do something similar. But there's a snag:

How do you tell which of these available boxes has Intel AMT (or its AMD equivalent) fully enabled?

No listing reports this, and sellers seem to not be able to answer the question either.

How did you figure that out? Or are you managing without remote management? If so, how?

Worth noting that a lot of the ultra-tiny PCs have laptop CPUs, which aren’t as fast as the equivalent desktop part.