This only makes sense if queries are computationally intensive. If you're fetching a single row by index you aren't winning much (or anything).
Or if the link to your DB is higher latency than you're comfortable with.
The only loss here is network latency which negligible when you're colocated in AWS.
Postgres's caches end up pulling a lot more weight too when you're not only hitting the db on a cache miss from the web server.
#2 is an interesting point. When you benchmark, the normal process is to just set up a database then run a shitload of queries against it. I don't think a lot of people put actual production load on the database then run the same set of queries against it...usually because you don't have a production load in the prototyping phase.
However, load does make a difference. It made more of a difference in the HDD era, but it still makes a difference today.
I mean, redis is a cache, and you do need to ensure that stuff works if your purge redis (ie: be sure the rebuild process works), etc, etc.
But just because it's old doesn't mean it's bad. OS/390 and AS/400 boxes are still out there doing their jobs.
But FWIW I can easily saturate a 10GBit ethernet link with primary key-lookup read-only queries, without the results being ridiculously wide or anything.
Because it didn't need any setup, I just used:
SELECT * FROM pg_class WHERE oid = 'pg_class'::regclass;
I don't immediately have access to a faster network, connecting via tcp to localhost, and using some moderate pipelining (common in the redis world afaik), I get up to 19GB/s on my workstation.This selects every column (*) from every table (ObjectID is of type regclass)?
It just selects every column from a single table, pg_class. Which is where postgres stores information about relations that exist in the current database.
Last time I checked, Redis doesn't take that long to provide a response. And if your Redis servers actually are that overloaded that you're seeing latency in your requests, it seems like simple key-based sharding would allow horizontally scaling your Redis cluster.
Disclaimer: I am probably less smart than most people who work at OpenAI so I'm sure I'm missing some details. Also this is apparently a Python thing and I don't know it beyond surface familiarity.
Thus, it's much cheaper to run at massive scale like OpenAI's for certain workloads, including KV caching
also:
- robust, flexible data structures and atomic APIs to manipulate them are available out-of-the box
- large and supportive community + tooling
I understand in early 2000s we were using spinning disks and it was the only way. Well, we don't use spinning disks any more, do we?
A modern server can easily have terabytes of RAM and petabytes of NVMe, so what's stopping people from just using postgres?
A cluster of radishes is an anti-pattern.