Concevoir et déployer vos applications a base de microservices sur Cloud Foundry

43
Concevoir et déployer vos applications à base de microservices sur Cloud Foundry Spring Cloud micro services + Cassandra dans Cloud Foundry 26 mai 2015 Didier Burkhalter – Field Engineer Pivotal @didierDIB

Transcript of Concevoir et déployer vos applications a base de microservices sur Cloud Foundry

1 © 2015 Pivotal Software, Inc. All rights reserved.

Concevoir et déployer vos applications à base de microservices sur Cloud Foundry Spring Cloud micro services +

Cassandra dans Cloud Foundry 26 mai 2015 Didier Burkhalter – Field Engineer Pivotal @didierDIB

2 © 2015 Pivotal Software, Inc. All rights reserved.

•  Cloud Foundry France est une communauté qui encourage les discussions, les sessions techniques et le networking entre ses membres, constitués de développeurs, programmeurs, architectes, ingénieurs, consultants et chefs de projets partageant un intérêt

commun pour le PaaS open source Cloud Foundry et la fondation Cloud Foundry.

•  Cloud Foundry France encourage les échanges d’idées et le partage d’informations entre les utilisateurs et acteurs de l'éco système Cloud Foundry.

Cloud Foundry France meetup

3 © 2015 Pivotal Software, Inc. All rights reserved.

Concevoir et déployer vos application à base de microservices sur Cloud Foundry L'adop'on)des)modèles)d'architecture)à)base)de)microservices)et)"cloud9na've")perme:ent)la)créa'on)rapide)d'applica'ons)modernes)et)scalables.)))La)session)illustrera:))9)pourquoi)le)choix)des)microservices,)quels)en)sont)les)challenges,)comment)u'liser)les)modèles)des)géants)du)Net)comme)NeClix)?))9)comment)construire)une)applica'on)à)base)de)micro9services)avec)les)services)Spring)Cloud)NeClix)Eureka/Service)Discovery))et)Hystrix/Circuit)Breaker))9)comment)déployer)et)opérer)votre)applica'on)micro)services)sur)une)plate9forme)de)PaaS)Pivotal)Cloud)Foundry!)

4 © 2015 Pivotal Software, Inc. All rights reserved.

Agenda !  Les)micro)services,)quelles)défini'ons)?)!  Quels)challenges)!  Pourquoi)le)choix)des)microservices)!  S’inspirer)et)u'liser)les)modèles)de)NeClix)?)!  Construire)une)applica'on)à)base)de)micro9services)avec)les)services)Spring)Cloud)NeClix)Eureka/Service)Discovery))et)Hystrix/Circuit)Breaker))

!  Déployer)votre)applica'on)micro)services)sur)une)plate9forme)de)PaaS)Pivotal)Cloud)Foundry))

!  Q)/)R)

5 © 2015 Pivotal Software, Inc. All rights reserved.

6 © 2015 Pivotal Software, Inc. All rights reserved.

Microservice: une définition

Loosely coupled service oriented architecture with bounded contexts

If every service has to be updated in concert, it’s not loosely coupled!

If you have to know about surrounding services you don’t have a bounded context.

Adrian Cockcroft, former Netflix Chief Cloud Architect

7 © 2015 Pivotal Software, Inc. All rights reserved.

Microservice: Bounded Context

http://martinfowler.com/bliki/BoundedContext.html

8 © 2015 Pivotal Software, Inc. All rights reserved.

9 © 2015 Pivotal Software, Inc. All rights reserved.

Not Monoliths

Relational Database

Data Access

Service

HTML JavaScript MVC

Service

Monolithic Application Browser

10 © 2015 Pivotal Software, Inc. All rights reserved. 10

Monolithic Architectures

•  « Easy » but complex •  Modularity Dependent Upon Language / Frameworks

•  Change Cycles Tightly Coupled / Obstacle to Frequent Deploys •  Inefficient Scaling

•  Can be Intimidating to New Developers

•  Obstacle to Scaling Development •  Requires Long-Term Commitment to Technical Stack

11 © 2015 Pivotal Software, Inc. All rights reserved. 11

How you should scale

12 © 2015 Pivotal Software, Inc. All rights reserved.

Organize Around Business Capabilities

12

Data Access

Service

HTML JavaScript MVC

Service

UI S

pecialists

Middlew

are S

pecialists

DB

As

Business C

apability

Business C

apability

Business C

apability Siloed Functional Teams

http://martinfowler.com/articles/microservices.html#OrganizedAroundBusinessCapabilities

Siloed Application Architectures

Cross- functional Teams

Microservice Architectures

13 © 2015 Pivotal Software, Inc. All rights reserved.

http://tech.gilt.com/post/102628539834/making-architecture-work-in-microservice

14 © 2015 Pivotal Software, Inc. All rights reserved.

Microservices Overview

14

15 © 2015 Pivotal Software, Inc. All rights reserved.

Microservice Architecture

15

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

AMQP AMQP

Relational DB

Key/Value Store

Graph DB

HTTP

16 © 2015 Pivotal Software, Inc. All rights reserved. 16

Microservice Architectures

•  « Simple » system / Hard to work with •  Modularity Based on Component Services

•  Change Cycles Decoupled / Enable Frequent Deploys •  Efficient Scaling

•  Individual Components Less Intimidating to New Developers

•  Enables Scaling of Development •  Eliminates Long-Term Commitment to Technical Stack

17 © 2015 Pivotal Software, Inc. All rights reserved.

But Microservices!

18 © 2015 Pivotal Software, Inc. All rights reserved.

Enabling Continuous Delivery

Product Mgr UX Dev QA DBA Sys

Admin Net

Admin Storage Admin

BUSINESS CAPABILITY TEAMS USING MICROSERVICES

PLATFORM OPERATIONS TEAM

Self Service

API

Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin

19 © 2015 Pivotal Software, Inc. All rights reserved.

But no Microservice is an Island…

20 © 2015 Pivotal Software, Inc. All rights reserved.

The Dark side of distributed systems

•  See the Great article by Chris Richardson : http://www.infoq.com/articles/microservices-intro

!  Configuration Management

!  Service Registration & Discovery

!  Routing & Load Balancing

!  Fault Tolerance (Circuit Breakers!)

!  Monitoring

!  Multiple remote calls, entity relationships

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Spring Cloud

22 © 2015 Pivotal Software, Inc. All rights reserved.

Dedicated Spring Cloud Netflix module

Netflix OSS

•  Eureka •  Hystrix + Turbine

•  Ribbon

•  Feign

•  Zuul • …

24 © 2015 Pivotal Software, Inc. All rights reserved.

Breaking the Monolith

Service A

Service C

Service B

25 © 2015 Pivotal Software, Inc. All rights reserved.

Now microservices

HelloServer HelloClient

Service C

26 © 2015 Pivotal Software, Inc. All rights reserved.

Finding services

? ?

Client

? ?

27 © 2015 Pivotal Software, Inc. All rights reserved.

Service Discovery Eureka

HelloClient

1.Register

HelloServer

3.Connect Consumer

HelloServer

Producer

2.Discover

28 © 2015 Pivotal Software, Inc. All rights reserved.

Running a Eureka Server

@SpringBootApplication @EnableEurekaServer public class EurekaApplication {

public static void main(String[] args) { SpringApplication.run(EurekaApplication.class, args); }

}

29 © 2015 Pivotal Software, Inc. All rights reserved.

Client load Balancing ribbon

Passport

Contact #1 Contact

#2

Contact #3

ribbon Round robin

30 © 2015 Pivotal Software, Inc. All rights reserved.

Cascading faults

Service A

Service B

31 © 2015 Pivotal Software, Inc. All rights reserved.

Circuit breaker hystrix

Service A

Service B

Fallback

32 © 2015 Pivotal Software, Inc. All rights reserved.

Service Registration/Discovery

Demo !

34 © 2015 Pivotal Software, Inc. All rights reserved. 34 © Copyright 2015 Pivotal. All rights reserved.

http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html

35 © 2015 Pivotal Software, Inc. All rights reserved.

Paying for your lunch… !  Significant Operations Overhead

!  Substantial DevOps Skills Required

!  Implicit Interfaces

!  Duplication of Effort

!  Distributed System Complexity

!  Asynchronicity is Difficult!

!  Testability Challenges

36 © 2015 Pivotal Software, Inc. All rights reserved.

It takes a platform…

Cloud Foundry Spring Cloud Services

37 © 2015 Pivotal Software, Inc. All rights reserved.

Code Open Source

Clouds'privés'Clouds'publics'

CUSTOM SERVICES

Cloud Foundry: Open PaaS

CUSTOM RUNTIMES

Mul0ples'Distribu0ons'

Fondation Cloud Foundry

& Gouvernance

38 © 2015 Pivotal Software, Inc. All rights reserved.

Cloud Foundry Features / Service suite !  Environment Provisioning

!  On-Demand/Automatic Scaling

!  Failover/Resilience

!  Routing/Load Balancing

!  Data Service Operations

!  Monitoring

Config Server Service Registry Circuit Breaker

Dashboard

Spring Cloud Services

39 © 2015 Pivotal Software, Inc. All rights reserved.

μServiceswith

Bindable Services

In-App Support Libraries

BETATo come soon

40 © 2015 Pivotal Software, Inc. All rights reserved.

Published March 16, 2015 Available to you compliments of Pivotal! http://bit.ly/cloud-native-book

41 © 2015 Pivotal Software, Inc. All rights reserved.

Where to start ?

42 © 2015 Pivotal Software, Inc. All rights reserved.

Bibliographie / sources !  h:p://cloud.spring.io/spring9cloud9neClix/spring9cloud9neClix.html)!  h:p://www.infoq.com/ar'cles/boot9microservices)!  Mar'n)Fowler):)h:p://mar'nfowler.com/ar'cles/microservices.html)!  h:ps://github.com/ms'ne)!  Adrian)CockcroX,)Chief)Cloud)Architect,)NeClix:)h:ps://vimeo.com/78414823)!  Domain9Driven)Design:)Tackling)Complexity)in)the)Heart)of)SoXware)!  h:p://blog.pivotal.io/podcasts9pivotal/features/pivotal9conversa'ons9so9isnt9microservices9just9soa9with9json)

!  h:p://www.ac'vestate.com/blog/2015/05/microservices9'ps9tricks)!  h:p://tech.gilt.com/post/102628539834/making9architecture9work9in9microservice)