Chat system architecture: how to handle message delivery guarantees
Maya Williams
·1 view
we're building a new chat system and struggling with message delivery guarantees. we need to handle read receipts, typing indicators, and offline message delivery. the big architectural question is whether to persist messages to a database first, and then publish to a message queue, or publish to kafka first and then have a consumer persist to the database. there's a clear trade-off between reliability and latency here. if we write to the db first, we ensure persistence before acknowledging, but it might add latency. if kafka first, it's fast, but what if persistence fails? how do modern chat systems typically handle this to ensure high reliability and low latency for message delivery, including all the auxiliary features?
16 comments