Chapter 11. Coffee Order Manager
This chapter covers the following:
-
Designing a queuing system
-
Using Redis as an in-memory queue management system
-
Using RabbitMQ for more advanced and scaled queues
In this chapter, you’ll create a couple of Node applications that use queues to manage workloads and enhance scalability. While Node is widely adopted across industries for its efficiency, it faces challenges when handling large-scale applications. Node’s event loop allows it to process incoming requests asynchronously, delegating tasks to other processes to ensure smooth operations. However, as the number of requests increases, or if tasks are CPU intensive or synchronous, the event loop can become a bottleneck, delaying subsequent requests. Queues address this challenge by offloading tasks, organizing them for sequential or parallel processing, and ensuring that critical processes are not overwhelmed. By using queues, you can balance workloads, improve response times, and maintain the reliability of your Node applications, even under heavy demand.
An architectural solution to this problem is to introduce a queuing system to handle requests and task management. Just as the event loop utilizes primitive queues to add new tasks and listen for completion events, more complex queues help organize the flow of tasks through an application, ensuring that no single segment of the application process ever blocks data from reaching its ultimate target.
In this chapter, you’ll explore ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access