by moehm · 5y ago · 0 comments
This goes against everything I have learned until now. Maybe an experienced DBA can explain when moving stuff out of the database is helpful? I mean sorting, merging and filtering is the core discipline of a RDBMS and many, many man hours went into it. How and when can a custom version be better?
1. Add more ram, CPU, etc to the DB host
2. Create DB read replicas for higher read volume
3. Shard the DB (reads and writes)
4. Offload logic to stateless clients, who you can easily scale horizontally
So option 4 is reasonable if you don't want to or can't do the other options.And thanks for brining this up, I've added a disclaimer that these are not to be taken for granted, and they work for us, on our scale.
I did plan a whole new article about this. With all the benchmarks we've gathered over the years.
It doesn't matter if it sorts 1000x faster than client code, when there aren't cycles left to perform this (in theory) very performant sorting.
This might not be your actual problem, but I've seen it hit a completely oblivious dev team before :)
(It's probably cheaper/easier to scale their application servers as well.)