Menu
Back to Discussions

Database read scaling: when caching isn't enough

Linnea Okonkwo
Linnea Okonkwo
·49 views
we've been running with postgres replicas and redis caching for a while now, and our primary replica is consistently hitting 80%+ CPU. our redis hit rate looks good, but the long-tail queries, especially complex search queries with multiple filters or paginated sorted lists, are just killing us. these are the ones that are basically uncacheable. we're looking into a few things. one option is to throw elasticsearch at it, but that feels like a big jump in complexity just for reporting. another is materialized views for some of the common aggregations, but managing refreshes correctly without locking the tables feels tricky. has anyone had luck with a CQRS-lite approach where the read model is specifically optimized for these kinds of queries? trying to avoid a full-blown event sourcing solution if possible, but the current setup isn't scaling.
2 comments

Comments

Sign in to join the conversation.

Loading comments...