Microservices architecture is a concept that supports agile development and delivery of complex/large applications. Let’s see how it is different from usual Monolithic, SOA architectures.
A Monolithic architecture is a method of developing applications where the front-end UI, core of the application business logic and database layer are implemented in a single application. This method is more focused on a modular architecture and is very simple to deploy and test. It makes horizontal scaling easier by having multiple copies of application behind a load balancer, but the application size keeps on growing along with the features added to it which makes scaling, agile development and continuous deployment a bit complex.
This is where Microservices comes in handy by tackling all these complexities by decomposing the modules into small individual services which can be hosted separately. Each microservice is aligned to a specific business function. Each backend service exposes a REST API and most services consume APIs provided by other services.
By this method, we can apply scaling to each independent microservice at the scale it needs. Also instead of sharing a single database schema through the whole application, each service can have a separate schema as it ensures loose coupling.
Benefits of Microservices
- Each service can be developed and deployed independently of other services – easier to deploy new versions of services frequently
- Easier to scale development. It enables you to organize the development effort around multiple teams
- A simpler, lightweight service
We use AWS Elastic Compute Cloud (EC2) in our organization to deploy and scale our applications using Microservices architecture. We use the following libraries built by Netflix to develop a Microservice in JAVA:
- Ribbon – Used for Load balancing and it gives support for multiple protocol (HTTP, TCP, UDP) in an asynchronous and reactive model
- Hystrix – This provides Latency and Fault Tolerance for rapid recovery. It also provides thread and semaphore isolation with circuit breakers
- Archaius – It is used for dynamic configuration and typed properties. It achieves high throughput and Thread safe configuration operations
- Eureka – It is used for Service Discovery and load balancing at middle-tier
To summarize, the Microservices architecture pattern is a better choice for complex, evolving applications despite the implementation challenges.