EP 42: Designing a chat application

This week’s system design refresher:


Thanks for reading ByteByteGo Newsletter! Subscribe for free to receive new posts and support my work.


Building a CSV importer? (Sponsored)

OneSchema is the embeddable CSV Importer for developers (demo). 

Product and engineering teams use OneSchema to save months of development time building a CSV importer. With a large library of prebuilt validations and robust SDKs, OneSchema only takes 30 minutes to get running in your app.

OneSchema turns CSV import from a headache into a breeze:

With features like intelligent mapping and data correction, importing clean customer data into your product is easier than ever. 

See how OneSchema works here


What is CI/CD? How does it help us ship faster? Is it worth the hassle?


How do Visa disputes and chargeback work?

A dispute happens when a cardholder disagrees with a merchant’s charge. A chargeback is a process of reversing the charge. Sometimes, the two terms are used interchangeably.

A dispute is expensive: for every dollar in disputed transactions, an additional $1.50 is spent on fees and expenses.

👉 Over to you: Dispute is expensive. How can we reduce it and make the process more streamlined?


What is the process for deploying changes to production?

The diagram below shows several common deployment strategies.

Big Bang Deployment
Big Bang Deployment is quite straightforward, where we just roll out a new version in one go with service downtime. Preparation is essential for this strategy. We roll back to the previous version if the deployment fails.
💡 No downtime ❌
💡 Targeted users ❌

Rolling Deployment
Rolling Deployment applies phased deployment compared with big bang deployment. The whole plant is upgraded one by one over a period of time.
💡 No downtime ✅
💡 Targeted users ❌

Blue-Green Deployment
In blue-green deployment, two environments are deployed in production simultaneously. The QA team performs various tests on the green environment. Once the green environment passes the tests, the load balancer switches users to it.
💡 No downtime ✅
💡 Targeted users ❌

Canary Deployment
With canary deployment, only a small portion of instances are upgraded with the new version, once all the tests pass, a portion of users are routed to canary instances.
💡 No downtime ✅
💡 Targeted users ❌

Feature Toggle
With feature toggle, A small portion of users with a specific flag go through the code of the new feature, while other users go through normal code. This can be used in combination of other strategies: either the new branch of code is upgraded in one go, or only a few instances are upgraded with new code.
💡 No downtime ✅
💡 Targeted users ✅

👉 Over to you: Which deployment strategies have you used?


How do we design a chat application like WhatsApp, Facebook Messenger, or Discord?

The diagram below shows a design for a simplified 1-to-1 chat application.

User Login Flow

Messaging Flow

👉 Over to you: How to sync the chat messages among Alice’s different devices?


Thanks for reading ByteByteGo Newsletter! Subscribe for free to receive new posts and support my work.