Tecnology and architecture decissions
Theory Introduction to Microservice Architecture.
The objective of this section is to motivate the use of an architecture based on microservices.
Microservices allow a software to be divided into small services, thus making it much easier to develop, debug, deploy and maintain.
To carry out the communication between the different microservices and these with the database, there are several alternatives such as REST, SOAP, AMQP or ZMQ.
Advantages of using microservices as opposed to a monolithic block:
- It allows to be polyglot and therefore, to develop each microservice in the language that is most convenient.
- The code is simplified and much smaller. Updating and adding functionality is a more atomized and simple process than restructuring code in a monolithic architecture.
- Flexible (horizontal) scaling. A development based on microservices allows to estimate costs and to scale according to the demand.
- Work well within containers, such as Docker.
- If one service fails, all other services continue to work. A partial drop of one functionality does not drag down the others.
- Each microservice has its own process (and culture, working with nodes, clusters and the cloud) of DevOps versus the role of system administrator (working with your own team).
- If they run inside containers, they can be easily orchestrated (docker-compose)
- They are__ easily reusable__. For example, a microservice that provides authentication for one system is very easy to adapt for a different system.
- Each microservice provides minimum guarantees of isolation, thus facilitating security issues and compatibility between microservices.
- Unit tests are simpler as the combination of functionality provided by the microservice in question is more packaged and defined.
Questions to be answered using microservices:
- Communication protocols must be designed between the microservices. Not everything is a microservice. You have to know how to detect what a microservice is and what it is not. Too many microservices could overload the development of the software system we have in mind to build.
- It is necessary to know how to orchestrate well and correctly balance the load between the different microservices.
- Integration tests are more complex when we have to take into account each and every one of the microservices that provide the software system.
Proposed design
Proposed microservices:
- Authentication microservice.
- Microservice for collecting statistics.
- Product catalog microservice (accounts, cards, deposits and common user savings accounts).
- Notification microservice (e-mails, push).