Micro-services
Micro-services design is really helping alleviate some problems we experienced with the monolithic model. Implementing micro-services is perhaps one of the greatest ways to improve the producitivity of a software engineering team.
Specifically,
- You deploy only the component that was changed (as opposed to the whole application), this keeps the deployments and the tests managable.
- If multiple team members are working on the application, they need to wait until everyone is done with development, testing and ready to move forward. However, with microservices-services model, whenever each piece of functionality is ready it could be deployed.
- Each micro-service runs in its own process space, so if we want to scale for any reason, we can scale the particular micro-service that needs more resources instead of scaling the entire application.
- When one micro-service needs to communicate with other other micro-service, it does using a lightweight protocol such as http.
This post examines, how to deploy microservices created using python and django on nginx and uwsgi.
Before going into the details of a microservices design, lets understand and examine how a typical monolithic application looks like.
Monolithic Design
However, with breaking the functionality into logically isolated micro-services, this is how the design would like.
Microservices Design
Now, lets examine how the configuration would like for a python and django application that runs on nginx on a typical linux server.
Because the application code is spread across multiple repos (or subrepos) grouped by logically independent code, this will be the typical organization of the application directories on the server.
Nginx, which is typically deployed a front-end gateway or a reverse proxy will have the this configuration.
Multiple uWSGI process have to be created that would process the request for each microservice.