microservice architecture javacro 2015

Download Microservice Architecture JavaCro 2015

Post on 16-Apr-2017

215 views

Category:

Engineering

0 download

Embed Size (px)

TRANSCRIPT

PowerPoint Presentation

Microservice ArchitectureDropwizard Vs Spring Boot

Nenad PeanacSerengeti

Contents Definition

Monolithic architecture

Microservice arhitecture

Pros and Cons

Dropwizard Vs Spring Boot

References

1) Definition

Microservice architecture

Microservice architectural styleis an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.

Martin Fowler, ThoughtWorks

2) Monolithic architecture

Monolithic architecture

Monolithic architecture

Classical architecture.Application is built as a single unit.Typical 3 layer EA:- client-side UI (Browser, HTML + JS)- a database (RDBMS, NoSql ..)- server-side application (Java, .NET, Ruby, Python, PHP ..)

Monolithic architecture

The server-side application - will handle HTTP requests- execute domain logic- retrieve and update data from the database- select and populate HTML viewsThis server-side application is aMonolith- Single logical executable.

Monolithic architecture

Monolithic server - natural approach All logic for handling a request runs in a single process, divided and organized into classes, functions, and namespaces. Application is developed on a developer's laptop, deployed to a testing environment and after that toproduction environment.Monolith is horizontally scaled by running many instances behind a load-balancer.

Monolithic architecture drawbacks

Any changes to the system involve building anddeploying a new version of the application.Changes require good planning and coordination.Changes are expensive.It is hard to keep a good modular structure.Scaling requires scaling of the entire applicationrather than parts of it that require greater resource.Long release cycles.

Monolithic architecture Example

3) Microservice architecture

Microservice architecture

Microservice architecture

Applications naturally start as Monoliths, theyscale and evolve to Microservice architecture.

Applications are then decomposed to components smaller independent service applications.Components are very simple and loosely coupled.

Microservice architecture

Decentralized data management.Decentralized governance.

Microservice architecture

They are built around business capabilities.Each component runs as a separate application, clustered to as many nodes as required.

Microservice architecture

Applications aim to be as decoupled and as cohesive as possible.Components usually communicate through REST.Components sometime use lightweight messaging (RabbitMQ, Zero MQ).There is NO ESB or any other form of central communication management.

Mikroservisna arhitektura

Smart endpoints an dumb pipes:

Microservice architecture

Components are designed for failure.Any service can fail, anytime.The client has to respond as gracefully as possible.It's important to be able to detect the failures quickly and, if possible, automatically restore service.Microservice applications put a lot of emphasis on real-time monitoring.

Microservice architecture

Netflix'sChaos Monkey induces failures of servicesduring the working day to test the application's resilience and monitoring.

Microservices Classic SOA

SOA

XMLComplex to integrateHeavyRequires toolingHTTP/SOAP

Microservices

JSONEasy to integrateLightweightLight toolingHTTP/REST

Mikroservisna arhitektura

Who uses Microservices in Production?

Microservice architectureExample

Microservice architectureAPI Gateway

4) Pros and Cons

Microservice architecture - Pros

Multiple developers and teams can deliverrelativelyindependently of each other.May be written in different programming languages.May be managed by different teams.May use different data storage technologies.Centralized management is minimal.

Microservice architecture - Pros

Independently deployable by fully automateddeployment machinery. Works well with Contionous delivery.

Allows frequent releases while keeping the rest of the system available and stable.

Microservice architecture - Cons

Distributed system complexity.Inter-service communication complexity.Distributed transactions between services dont exist.Significant operations overhead.Difficult testing - Interactions between the servicesRobust error handling and recovery is required.Sophisticated real-time monitoring required.

5) Dropwizard Vs Spring Boot

Dropwizard Vs Spring Boot

Both are microservice containers and rapid development frameworks.Convention over configuration.Applications are deployed as standalone JAR files with embedded lightweight servers (Jetty, Tomcat, Undertow)Built in monitoring, logging and health checks.Easy to leverage existing libraries.

Dropwizard Vs Spring Boot

Dropwizard Vs Spring Boot

Dropwizard is built on Jetty. Spring Boot is focused on Spring applications, supports Tomcat, Jetty or Undertow.Dropwizard puts its REST support withJersey.Spring Boot has REST implementation based on Spring Frameworks core.Dropwizard uses Logback, Spring offers achoice between Logback, Log4j and Log4j2.

Dropwizard Vs Spring Boot

Main difference between both frameworks is dependency injection support.Springs core comes with its built in dependency injection support while with Dropwizard this doesnt come out of the box.Both frameworks have a special module fortestingincluding JUnit and Mockito dependencies.

Dropwizard Vs Spring Boot

Conclusion1) Spring Boot is a part of Spring ecosystem and suits best for Spring-oriented projects 2) Spring offers broader list of supported services - REST, JMS, Messaging...3) Dropwizard offers integrations with other DI frameworks like Guice, CDI 4) Dropwizard owns popular metrics library

6) References

References

Martin Fowler: MicroservicesCraig Richardson: Microservice Architecture PatternCraig Richardson: Decomposing ApplicationsStefan Borsje: How we built microservcies at KarmaBenjamin Wootton: Microservices - Not a free lunchDropwizard: http://www.dropwizard.io/Spring Boot: http://projects.spring.io/spring-boot/Alex Zhitnitsky: Dropwizard Vs Spring BootRizvan Ulah: Dropwizard Vs Spring Boot