Friday 29 December 2017

Microservices architecture design using Zuul and Eureka - part 1

Microservices architecture design using Zuul and Eureka - part 1





What are microservices?
Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.


There are 2 approaches for app development:
  1. Monolithic Architecture - Single deployable unit containing all other unit like UI, Service etc

  1. MicroService Architecture - Every module is different independent deployable unit and connected each other by rest API

Benefits

This solution has a number of benefits:
  • Each microservice is relatively small
    • Easier for a developer to understand
    • The IDE is faster making developers more productive
    • The application starts faster, which makes developers more productive, and speeds up deployments
  • Each service can be 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. Each (two pizza) team is owns and is responsible for one or more single service. Each team can develop, deploy and scale their services independently of all of the other teams.
  • Improved fault isolation. For example, if there is a memory leak in one service then only that service will be affected. The other services will continue to handle requests. In comparison, one misbehaving component of a monolithic architecture can bring down the entire system.
  • Each service can be developed and deployed independently
  • Eliminates any long-term commitment to a technology stack. When developing a new service you can pick a new technology stack. Similarly, when making major changes to an existing service you can rewrite it using a new technology stack.

Zuul


Zuul is the front door for all requests from devices and web sites to the backend of the Netflix streaming application. As an edge service application, Zuul is built to enable dynamic routing, monitoring, resiliency and security. It also has the ability to route requests to multiple Amazon Auto Scaling Groups as appropriate.

Zuul Benefits:

  • Authentication and Security - identifying authentication requirements for each resource and rejecting requests that do not satisfy them.
  • Insights and Monitoring - tracking meaningful data and statistics at the edge in order to give us an accurate view of production.
  • Dynamic Routing - dynamically routing requests to different backend clusters as needed.
  • Stress Testing - gradually increasing the traffic to a cluster in order to gauge performance.
  • Load Shedding - allocating capacity for each type of request and dropping requests that go over the limit.
  • Static Response handling - building some responses directly at the edge instead of forwarding them to an internal cluster
  • Multiregion Resiliency - routing requests across AWS regions in order to diversify our ELB usage and move our edge closer to our members

Eureka

Eureka Server - Eureka is a REST (Representational State Transfer) based service that is primarily used in the AWS cloud for locating services for the purpose of load balancing and failover of middle-tier servers

Eureka Client - Eureka also comes with a Java-based client component. which makes interactions with the service much easier. The client also has a built-in load balancer that does basic round-robin load balancing. At Netflix, a much more sophisticated load balancer wraps Eureka to provide weighted load balancing based on several factors like traffic, resource usage, error conditions etc to provide superior resiliency.

What's Next,


We will create below components and create simple demo to demonstrate working structure of microservices architecture.

webUI - angular js, react js for UI(we will do it via postman)
API Gateway (zuul-module-service)- Zuul Proxy/SpringBoot Cloud+Boot
Service Registry (eureka-server-module)- Eureka/SpringBoot Cloud+Boot
Services (products-crawler module)- Use SpringBoot module
DB Services(products-db module) - SpringBoot module, JPA Hibernate

No comments:

Post a Comment

Extract error records while inserting into db table using JDBCIO apache beam in java

 I was inserting data into postgres db using apache beam pipeline. it works perfectly with JdbcIO write of apache beam library. But, now, i ...