Book Image

RabbitMQ Essentials - Second Edition

By : Lovisa Johansson, David Dossot
Book Image

RabbitMQ Essentials - Second Edition

By: Lovisa Johansson, David Dossot

Overview of this book

RabbitMQ is an open source message queuing software that acts as a message broker using the Advanced Message Queuing Protocol (AMQP). This book will help you to get to grips with RabbitMQ to build your own applications with a message queue architecture. You’ll learn from the experts from CloudAMQP as they share what they've learned while managing the largest fleet of RabbitMQ clusters in the world. Following the case study of Complete Car, you’ll discover how you can use RabbitMQ to provide exceptional customer service and user experience, and see how a message queue architecture makes it easy to upgrade the app and add features as the company grows. From implementing simple synchronous operations through to advanced message routing and tracking, you’ll explore how RabbitMQ streamlines scalable operations for fast distribution. This book will help you understand the advantages of message queue architecture, including application scalability, resource efficiency, and user reliability. Finally, you’ll learn best practices for working with RabbitMQ and be able to use this book as a reference guide for your future app development projects. By the end of this book, you’ll have learned how to use message queuing software to streamline the development of your distributed and scalable applications.
Table of Contents (8 chapters)

Networking over connections and channels

Thousands of connections add up to a heavy burden on a RabbitMQ server, causing it to run out of memory and crash. A large number of connections and channels can also negatively impact the RabbitMQ management interface due to the large number of performance metrics being processed. To avoid this, configure each application to create an extremely small number of connections – 1, if possible. Instead of using multiple connections, establish a channel for each thread. Each connection should be long-lived and the following best practices should be considered depending on the application structure.

Remember that even if new hardware offers hundreds of threads, only the number of channels set can be established and this number should be kept from growing too large. As some clients don't make channels thread-safe, it is best not to share channels between threads. Doing so may create a race condition, which could completely crash the application...