Saturday, December 19, 2015

Microservices Architecture – Spring Boot, Spring Cloud and Netflix OSS Infrastructure

What is "Microservices"?
  • A suite of small services that use lightweight mechanism like REST to communicate with each other. 
  • These services are built around business capabilities and independently deployable by fully automated deployment machinery.
Why Micro Services Architecture?
ms-img02We chose micro services architecture to write each functionality as a separate service for core and API functionality and it helps us to achieve the continuous delivery and integration.
Frameworks
There are couple of frameworks available in different software ecosystems that make it easy to create distributed applications using microservices architecture.
  1. Java – Spring Cloud using Netflix OSS
  2. Node.js – Seneca
    ms-img03
  • The reference architecture developed by us builds on the Spring Cloud ecosystem.
  • There are number of components available within the Spring Cloud and Netflix OSS ecosystem that solve common problems for distributed applications
    (e.g. configuration management, service discovery, circuit breakers, intelligent routing etc).
Patterns in Micro Services Architecture :
  • API Gateway
  • Service Registry
  • Service Discovery
Patterns in Micro services Architecture
API Gateway
  • Choose to build the application as a set of micro-services.
  • Decide how the application client’s will interact with the micro services
  • With a monolithic application there is just one set of (typically replicated, load-balanced) endpoints.
  • In a micro services, architecture, however each micro services exposes a set of what are typically fine-grained endpoints.
Service Registry
  • Service registry helps to determine the location of service instances to send request to the corresponding services.
  • Here, we have used the Netflix Eureka to register a service that are available to be registered in service registry server and it can be identified through the router.
Service Discovery
  • In a monalithic application, services invoke one another through language-level method or procedure calls.
  • But, in a modern icro services based application typically runs in a virtualized environments where the number of instances of service and their locations changes dynamically
  • Each service can be identified using router that are registered with service registry server


Microservices Architecture using Netflix Components :
We have used the Netflix components to accomplish the above microservices architecture patterns.
Operations Component Spring Cloud, Netflix OSS
Service Discovery Server Netflix Eureka
Edge Server Netflix Zuul
Central Configuration Server Spring Cloud Config Server
Dynamic Routing and Load Balancer Netflix Ribbon
OAuth 2.0 protected API’s Spring Cloud + Spring Security OAuth2
Circuit Breaker Netflix Hystrix
Monitoring Netflix Hystrix Dashboard and Turbine
Centralized Log Analysis ELK (Elasticsearch,Logstash,Kibana)

Major Components of Netflix :
ms-img04
Netflix Eureka – Service Discovery Server
Netflix Eureka allows micro services to register themselves at runtime as they appear in the system landscape.
ms-img05
Netflix Ribbon – Dynamic Routing & Load Balancer
Netflix Ribbon can be used by service consumers to look up services at runtime. Ribbon uses the information available in Eureka to locate appropriate service instances. If more than one instance is found, Ribbon will apply load balancing to spread the requests over the available instances. Ribbon does not run as a separate service but instead as an embedded component in each service consumer.

ms-img06
Netflix Zuul – Edge Server & API gatewayer
Zuul is (of course) our gatekeeper to the outside world, not allowing any unauthorized external requests pass through. Zulu also provides a well-known entry point to the micro services in the system landscape. Using dynamically allocated ports is convenient to avoid port conflicts and to minimize administration but it makes it of course harder for any given service consumer. Zuul uses Ribbon to look up available services and routes the external request to an appropriate service instance.

Spring Boot & Spring Cloud Netflix OSS – Micro Service Architecture
MSArchitech


Micro Services with Spring Boot :
Spring Boot is a brand new framework from the team at Pivotal, designed to simplify the bootstrapping and development of a new spring application. The framework takes an opinionated approach to configuration, freeing developers from the need to define boilerplate configuration.
MS-boot
Spring Cloud Netflix :
Spring cloud Netflix provides Netflix OSS integrations for spring boot apps through auto configuration and binding to the spring environment and other spring programming models. With a few simple annotations we can quickly enable and configure common patterns inside application and to build large distributed systems with Netflix components. There are lot of features available with spring cloud Netflix. Here, we have listed some of the common features we have implemented with micro services with spring boot and Netflix,
Service Discovery
  • Eureka instances can be registered and clients can discover the instances using spring managed beans.
Service Creation
  • An embedded Eureka server can be created with declarative Java Configuration
External Configuration
  • A bridge from the Spring Environment(enables native configuration of Netflix components using Spring Boot conventions)
Router and Filter
  • Automatic registration of Zuul filters, and a simple convention over configuration approach to reverse proxy creation
You can view on PDF, Please click here: www.optisolbusiness.com/Micro-Services-Architecture-Spring-Boot-and-Netflix-Infrastructure.pdf