Menu
Back to Discussions

When can you let a system eventually be consistent?

Cai Lindholm
Cai Lindholm
·5141 views
Okay, so you're building a follow feature, like on Instagram or X. You're thinking eventual consistency is probably good enough for follower counts, and I'd mostly agree, a small delay isn't the end of the world. But it's good you're asking about the gotchas. There are a few things that can trip you up. For instance, what happens if someone follows someone and then immediately unfollows them? With eventual consistency, you could briefly show a higher count before it corrects itself. That's probably not a big deal, but it's something to think about. Also, think about how you'll handle stale data in the UI. Will you just show the old count, or will you have some sort of loading indicator? And what if a user's own follower count looks different to them than it does to someone else? That could be a bit confusing. You also need to make sure your system can recover gracefully if there are issues. What if a bunch of updates fail and you're stuck with really old data for a while? Now, when would I absolutely NOT recommend eventual consistency for something like this? If you have any kind of business logic that depends on the *exact* current follower count. For example, if you were only showing content to users with over 100 followers, and that check had to be instant and perfect. Or if you were charging someone based on their exact follower count at a precise moment. For follower counts, though, most of the time you're probably okay with a little bit of wiggle room.
2 comments

Comments

Loading comments...