Alex Xu Profile picture
Aug 17 8 tweets 3 min read
How does Netflix scale push messaging for millions of devices?

This post draws from an article published on Netflix’s engineering blog. Here’s my understanding of how the online streaming giant’s system works. Image
𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬 & 𝐬𝐜𝐚𝐥𝐞
- 220 million users
- Near real-time
- Backend systems need to send notifications to various clients
- Supported clients: iOS, Android, smart TVs, Roku, Amazon FireStick, web browser
𝐓𝐡𝐞 𝐥𝐢𝐟𝐞 𝐨𝐟 𝐚 𝐩𝐮𝐬𝐡 𝐧𝐨𝐭𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧
1. Push notification events are triggered by the clock, user actions, or by systems.

2. Events are sent to the event management engine. Image
3. The event management engine listens to specific events and forward events to different queues. The queues are populated by priority-based event forwarding rules

4. The “event priority-based processing cluster” processes events and generates push notifications data for devices Image
5. A Cassandra database is used to store the notification data.

6. A push notification is sent to outbound messaging systems. Image
7. For Android, FCM is used to send push notifications. For Apple devices, APNs are used. For web, TV, and other streaming devices, Netflix’s homegrown solution called ‘Zuul Push’ is used. Image
Over to you: if you wanted to support every kind of device, which delivery model would work better, push or pull-based notifications?
Subscribe to our weekly newsletter to learn something new every week ⇩:

bit.ly/3ysfTqW

#systemdesign #coding #interviewtips

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Alex Xu

Alex Xu Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @alexxubyte

Aug 16
How is a SQL statement executed in the database?

The diagram below shows the process. Note that the architectures for different databases are different, the diagram demonstrates some common designs.
Step 1 - A SQL statement is sent to the database via a transport layer protocol (e.g.TCP).

Step 2 - The SQL statement is sent to the command parser, where it goes through syntactic and semantic analysis, and a query tree is generated afterward.
Step 3 - The query tree is sent to the optimizer. The optimizer creates an execution plan.

Step 4 - The execution plan is sent to the executor. The executor retrieves data from the execution.

Step 5 - Access methods provide the data fetching logic required for execution
Read 7 tweets
Aug 15
/1 Amazon DynamoDB powered 89 million requests per second during prime days. How does it do that?

The diagrams below are my attempt to draw the latest architecture of DynamoDB based on the 2022 paper. Please leave a comment if you spot any mistakes.

A thread.👇
/2 Multi-Paxos group
/3 Write-ahead log & B-tree
Read 8 tweets
Aug 11
/1 Why is the credit card called “𝐭𝐡𝐞 𝐦𝐨𝐬𝐭 𝐩𝐫𝐨𝐟𝐢𝐭𝐚𝐛𝐥𝐞 product in banks”? How does VISA/Mastercard make money?

The diagram below shows the economics of the credit card payment flow.

1. The cardholder pays a merchant $100 to buy a product.
/2 2. The merchant benefits from the use of the credit card with higher sales volume and needs to compensate the issuer and the card network for providing the payment service. The acquiring bank sets a fee with the merchant, called the “𝐦𝐞𝐫𝐜𝐡𝐚𝐧𝐭 𝐝𝐢𝐬𝐜𝐨𝐮𝐧𝐭 𝐟𝐞𝐞.”
/3 3 - 4. The acquiring bank keeps $0.25 as the 𝐚𝐜𝐪𝐮𝐢𝐫𝐢𝐧𝐠 𝐦𝐚𝐫𝐤𝐮𝐩, and $1.75 is paid to the issuing bank as the 𝐢𝐧𝐭𝐞𝐫𝐜𝐡𝐚𝐧𝐠𝐞 𝐟𝐞𝐞. The merchant discount fee should cover the interchange fee.
Read 9 tweets
Aug 10
/1 Why is single-threaded Redis so fast?

There are 3 main reasons, as shown in the diagram below.

If you prefer video, you can watch our YouTube video here ⇩

bit.ly/3QlWFti

If you prefer text, keep reading:
/2 1. Redis is a RAM-based database. RAM access is at least 1,000 times faster than random disk access.

2. Redis leverages IO multiplexing and single-threaded execution loop for execution efficiency.

3. Redis leverages several efficient lower-level data structures.
/3 Over to you: Another popular in-memory store is Memcached. Do you know the differences between Redis and Memcached?
Read 5 tweets
Aug 9
1. How do video live streamings work on YouTube, TikTok live, or Twitch? The technique is called live streaming.

Livestreaming differs from regular streaming because the video content is sent via the internet in real-time, usually with a latency of just a few seconds.
2. The diagram below explains what happens behind the scenes to make this possible.

Step 1: The raw video data is captured by a microphone and camera. The data is sent to the server side.
3. Step 2: The video data is compressed and encoded. For example, the compressing algorithm separates the background and other video elements. After compression, the video is encoded to standards such as H.264.

The size of the video data is much smaller after this step.
Read 13 tweets
Aug 9
1. Twitter and Reddit support NFT (Non-Fungible Token) profile pictures. Do you know what the differences between NFT profile pictures and regular profile pictures are?

The diagram below shows how NFT and regular images differ.
2. 𝐑𝐞𝐠𝐮𝐥𝐚𝐫 𝐩𝐫𝐨𝐟𝐢𝐥𝐞 pic
🔹Step 1: The user uploads a profile picture, and this request goes to the user service

🔹Step 2: The picture is stored in an object store, like Amazon S3. A URL is generated to visit the file

🔹Step 3: The picture’s metadata is stored in DB
3. 𝐍𝐅𝐓 𝐩𝐫𝐨𝐟𝐢𝐥𝐞 image

🔹Step 1: To understand the process, we should know what smart contracts are. Smart contracts are programs deployed and stored on blockchains. They are self-executing when predetermined conditions are met. This is when an NFT is “minted.”
Read 12 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(