←back to thread

Use One Big Server (2022)

(specbranch.com)
343 points antov825 | 3 comments | | HN request time: 0s | source
Show context
matt-p ◴[] No.45085454[source]
A thoroughly good article. It's probably worth also considering adding a CDN if you take this approach at scale. You get to use their WAF and DNS failover.

A big pain point that I personally don't love is that this non-cloud approach normally means running my own database. It's worth considering a provider who also provides cloud databases.

If you go for an 'active/passive' setup, consider saving even more money by using a cloud VM with auto scaling for the 'passive' part.

In terms of pricing the deals available these days on servers are amazing you can get 4GB RAM VPSs with decent CPU and bandwidth for ~$6 or bare metal for ~$90 for 32GB RAM quad core worth using sites like serversearcher.com to compare.

replies(2): >>45086101 #>>45086515 #
andersmurphy ◴[] No.45086101[source]
If you're running on a single machine then you'll get way more performance with something like sqlite (instead of postgres/MySQL) which also makes managing the database quite trivial.
replies(2): >>45087928 #>>45089314 #
immibis ◴[] No.45087928[source]
SQLite has serious concurrency concerns which have to be evaluated. You should consider running postgres or mysql/mariadb even if it's on the same server.

SQLite uses one reader/writer lock over the whole database. When any thread is writing the database, no other thread is reading it. If one thread is waiting to write, new reads can't begin. Additionally, every read transaction starts by checking if the database has changed since last time, and then re-loading a bunch of caches.

This is suitable for SQLite's intended use case. It's most likely not suitable for a server with 256 hardware threads and a 50Gbps network card. You need proper transaction and concurrency control for heavy workloads.

Additionally, SQLite lacks a bunch of integrity checks, like data types and various kinds of constraints. And things like materialised views, etc.

SQLite is lite. Use it for lite things, not hevy things.

replies(4): >>45088753 #>>45089581 #>>45091071 #>>45094059 #
wild_egg ◴[] No.45094059{3}[source]
You know, it's ok to say that you're out of your element and don't have direct experience with the thing you're commenting on.

SQLite is easily the best scaling DB tech I've used. I've moved all my postgres workloads over to it and the gains have been incredible.

It's not a panacea and not the best in all cases but it's a very sane default that I recommend everyone start with and only complicate their stack with an external DB when they they start hitting real limits (often never happens)

replies(1): >>45094085 #
1. immibis ◴[] No.45094085{4}[source]
> You know, it's ok to say that you're out of your element and don't have direct experience with the thing you're commenting on.

I moved several projects from sqlite to postgres because sqlite didn't scale enough for any of them.

replies(1): >>45094411 #
2. andersmurphy ◴[] No.45094411[source]
May I suggest you could have been holding it wrong?

The out of the box defaults for sqlite are terrible for web apps.

replies(1): >>45099875 #
3. immibis ◴[] No.45099875[source]
Are you aware of the irony behind saying "You're holding it wrong"? Do you know where that phrase came from?