Microservices Architecture

Microservice Architecture is  used for building large enterprise applications with multiple small functionality called services.  The services are loosely coupled enabling them to be developed, deployed and tested independently.

Services can use REST with JSON  for communicating with other services. The services can be deployed in a single machine or across multiple machines

Useful facts about Microservice

  1. Services run independently on their dedicated process.
  2. Loosely Coupled : Services can be updated independently of other services
  3. Services communicate either through HTTP/REST synchronously or AMQP (Advanced Message Queuing Protocol)  asynchronously
  4. Uses its own data store in order to be decoupled from other services
  5. Improved fault isolation – If one service has a problem  then that service can be isolated and analyzed  without affecting the working of other services
  6. Scaling of services based on demand is possible rather than scaling all services
  7. Easy discard of services. If a services is not popular then that service can be discarded easily
  8. Deployment of services is easier
  9. Microservice contains only business logic code.

 

Best Practices for designing a Microservice

  1. Separate DataStore – Design each Microservice with a dedicated data store. Need MDM (Master Data Management) tool to keep all data stores in sync
  2. Maintain all Microservice code at same level of complexity.  For any new enhancements to the Microservices , it is better to create a new Microservice than enhancing the existing already stable service
  3. Separate build for every Microservice . This enables an efficient way of defining the required dependencies
  4. Deploy the Microservices in containers like Dockers
  5. Treat the servers stateless – Under performing servers should be replaced anytime

Constraints of a Microservice design 

For a service to be a Microservice it needs to full-fill certain requirements

  1. Should be scalable. Based on the performance requirement the services should be able to be fine tuned
  2. Failure resistant – Failure of one service should not affect other service or the application .
  3. Should offer a uniform interface and should support aggregation,linking, caching, proxies and gateways.
  4. Microservice should follow SRP (Single Responsibility Principal) OOO principal
  5. Every Micorservice should offer a complete functionlaity

 

Disadvantages

  1. Operations overhead
  2. Require DEV-OPS skills
  3. Duplicated effort to maintain loose coupling
  4. Distributed system is complicated
  5. As the services grow maintainability becomes a huge concern
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Cheat Sheet To JAVA Latest Technology

%d bloggers like this: