Preface
Hello, fellow Django developers and others interested in enhancing web applications with microservices. Microservices are playing an important role in today’s web applications. In 2020 alone, market researchers from Gartner saw a 42 percent increase in mentions of microservices architecture on social media. So, microservices are hot, raising questions regarding topics such as what they are and how we can apply them.
Fortunately, there is now enough experience building microservices to answer these questions from a real-world perspective. To give you a first idea, a microservice is a single-task piece of software that is part of a larger application and can be used by different applications.
As a result, microservices run asynchronously while collectively completing a process. As such, microservices are the opposite of monolithic applications, which perform all tasks sequentially from a single program, whereby one task can freeze the user experience because it takes seconds to complete.
This created the need for asynchronous processing with microservices as they let us split applications into task-driven components that run independently. So, the application proceeds without delay, which improves the user experience.
To develop and implement microservices, we need these main parts:
- A producer, which is a program that offloads a task to a microservice
- A task queue manager that passes the tasks to the microservices
- A microservice, which is a program that listens to a queue and executes when a task arrives
There are many ways to implement these parts. Producers can be Django apps or other applications, such as React and Vue components. For the task queue manager, we have a choice of systems, such as Redis and RabbitMQ. And we can develop microservices in Python or another programming language, such as Node.js.
This book focuses on developing Django microservices and, therefore, covers these choices for the main microservices parts:
- Django apps as producers.
- Celery and Redis as task queue managers, as these are most common for Django. But the book also covers RabbitMQ, as this gives more profound insight into task queuing.
- Python as the programming language for developing microservices.
The format of this book is hands-on, meaning it provides you with the necessary information about concepts and then provides extensive practical steps, examples, and explanations to build Django microservices yourself.