This video is the third part of the Notification System Low-Level Design (LLD) series, focusing on adding Asynchronous Support to improve throughput and prevent blocking the main request thread.
Video Description
The tutorial addresses a major bottleneck in synchronous systems: the long wait time while calling third-party vendor APIs. By moving the actual "sending" work to background threads, the system can respond to clients immediately after the notification is stored in the database.
In-Memory Messaging: Introduction of a BlockingQueue as an internal message buffer.
Producer-Consumer Pattern: The NotificationService acts as a producer (pushing to the queue), and dedicated NotificationWorker threads act as consumers (polling and sending).
Concurrency Management: Using Java's ExecutorService and a NotificationWorkerManager to handle a pool of worker threads efficiently, rather than manual thread creation.
Thread Safety: Explaining why LinkedBlockingQueue is chosen for its thread-safe properties and blocking capabilities.
Chapters
0:00 Discussion on current synchronous behavior and problems
3:01 Understand asynchronous flow and solution discussion
7:15 Creating NotificationQueue in Java
11:30 Creating NotificationWorker class
15:20 Pushing notification to the queue by main thread
18:21 Creating worker threads and starting them
21:22 Running the application to check async behavior
24:24 Creating NotificationWorkerManager and using it
29:20 Agenda for next video
Code Link - https://github.com/tenxbackend/low-le...