Menu
Back to Discussions

Read replicas: dealing with replication lag in user-facing applications

Ravi Ivanova
Ravi Ivanova
·109 views
we rely heavily on read replicas for scaling our database reads, but we've run into persistent issues with replication lag affecting the user experience. we typically see 50-200ms lag, but during peak times or heavy writes, it can spike higher. the problem is when a user performs an action (e.g., creates a new post), and then immediately navigates to another page that fetches data from a replica (e.g., their profile showing recent posts). the new post isn't there, which is confusing. we've explored sticky sessions to route a user to the same replica after a write, but that doesn't guarantee consistency if the data hasn't replicated yet. another idea is using causal consistency tokens passed from the write response to subsequent read requests, but that adds complexity to the frontend and API. what patterns have people successfully implemented to deal with replication lag in user-facing applications without sacrificing too much performance or adding too much complexity?
0 comments

Comments

Sign in to join the conversation.

Loading comments...