develop and deploy cloud-native apps as resilient microservice architectures

71
@burrsutter 1 Develop & Deploy Cloud-native Apps as Resilient Microservices Architectures @burrsutter http://developers.redhat.com http://bit.ly/helloworldmsa http://bit.ly/msa-instructions

Upload: all-things-open

Post on 21-Jan-2017

121 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter 1

Develop & Deploy Cloud-native Apps as Resilient Microservices Architectures

@burrsutter

http://developers.redhat.comhttp://bit.ly/helloworldmsa

http://bit.ly/msa-instructions

Page 2: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Change History0.9 - NYC Java Meetup1.0 - Great India Developer Summit - fail slides, title change1.1 - Added link to recorded demo1.2 - switched out developers.redhat.com pages2.0 - switched out monolith over time charts - 11 to 20 - faster monoliths2.1 - added logos slide - some of the places Red Hat contributes2.2 - added Strangler2.3 - updated characteristics/principles slide, added Microprofile slide2.4 - Added MicroDuke :-)2.5 - Added Martin Fowler’s You Must Be This Tall slide (similar to evolution)2.6 - Added Other Presentations slide

Page 3: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Other Presentationshttp://bit.ly/cicdpipeline - focused on CI/CD Pipelineshttp://bit.ly/reactivemsa - focused on Vert.x and Microserviceshttp://bit.ly/javadockkube - more on Docker & Kuberneteshttp://bit.ly/12factors-app - 12 Factorshttp://bit.ly/kubernetes-intro - Kubernetes Lab/Introductionhttp://bit.ly/thedeploymaster - Deployment Patternshttp://bit.ly/IoTwithApache - Internet of Things

Page 4: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

MicroProfile 1.0 Available!Optimizing Enterprise Java for Microservices

Microservice Collaboration and Innovation in the Java Community

Learn more at microprofile.io

Page 5: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures
Page 6: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter@burrsutter developers.redhat.com

Page 7: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

389 project | aeolus-configure | anaconda | attr | Audrey | Augeas | AuthHub | Autofs | Avahi | Beaker | Boxes | Btrfs | CacheFS | Cairo | candlepin | certmonger | CIFS | Cluster 3 | cobbler | colord | Completely Fair Scheduler | Conductor Control Group Configuration Library | Corosync | CRaSH | Crypto API | Cumin | Cygwin | D-Bus | Dashbuilder | Data Grids for the Java Platform | device-mapper | DeviceKit | DistributionUtilities | dlm | Dogtag | DPDK | Dracut | Editline Library EDS | EJB 3 | elfutils | elfutils | Embedded Jopr | Evolution | Evolution-exchange | eXo JCR | ext3 | ext4 | fence-agents | fence-virt | Flannel | fontconfig | func | Gamin | GateIn Portal | gcc | gcc | gcj | gdb | GFS | GFS2 | glib | gss-proxy GTK+ | gvfs | gzip | HTCondor | ID Utils | imagefactory | IPSec-Tools | iptraf-ng | Jandex | Java | JGroups | Jreadline | JRuby | JSFUnit | jUDDI | Katello | Kerberos | Kimchi | Koji | libguestfs | libibverbs | libminidump | libnotify | libqb libstoragemgmt | libuser | libvirt | libxml2 | libxslt | Linux Audit | Linux Infiniband Project | Linux Kernel | Linux PAM | linux-nfs | Luci | LVM2 | LVM2 | lynx | ManageIQ | Matahari | Maven Integration for Eclipse | Maven Integration for Web Tools Platform | Mock | mod_cluster | moVirt | nautilus | netfilter | NetworkManager | NFS-Ganesha | nmap | Open vSwitch | openais | OpenDaylight | OpenJDK | OpenSSH | OpenSSL | OPNFV | OProfile | oVirt | oVirt Engine | oVirt Node | OVMF | Oz pacemaker | PackageKit | PackageKit | pango | PAPI | Paradyn | patchutils | Performance Co-Pilot | PicketBox | PicketLink | piglit | pixman | polkit | Polkit Qt | Poppler | Portlet Bridge | PostgreSQL | PressGang psmisc | Pulp | PulseAudio | pungi | pynfs | QEMU | Red Hat Update Agent | RESTEasy | rgmanager | RHQ | rpm | rpmgrill | RSYSLOG | Samba | Samba | SETroubleshoot ShrinkWrap | slapi-ns | Smokestack | Spacewalk Spherical | Spice | Spice-gtk | Spice-protocol | Stilts | suds | SWI Prolog | SwitchYard | syslog-ng | System Security Services Daemon | systemd | SystemTap | The Foreman | Thin Crust | tin | UberFire | udev udisks | udisks | UPower | util-linux | Valgrind | vc-dwim | vdagent | vdsm | vfs | Virt-clone | Virt-image | Virt-Install | Virt-manager | Virt-viewer | Virtual memory manager | Wallaby | Wayland | Wise | XFS | xinput | XNIO | Xorg | XrandR | yum

Page 8: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Microservices is about

Agility

Continuous Delivery, Deployment, Improvement

Page 9: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Peak of Inflated Expectations

Microservices

x

Trough of Disillusionment

Serious Hotness

Page 10: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

Your Journey to Microservices :-)

Self-Service,On-Demand,

Elastic,Infrastructure

asCode

(Cloud)

Re-Org toDevOps

AutomationPuppet, Chef,

Ansibleand/or

Containers

CI & CDDeployment

Pipeline

OneMicroservice

SiliconValley

DotComStartup

Page 11: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

You Must Be This Tall1. Self-Service, on-demand, elastic infrastructure as code

(how many days/weeks to provision a new VM?)2. Dev vs Ops

(who is on the pager for production app outage?)3. Automation

(phoenix vs snowflake?)4. CI & CD5. Deployment Pipeline

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

Page 12: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Green vs Brown (shades Brown)

GREENBROWN

Page 13: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Operating System

Java Virtual Machine

Application Server

EAR - Enterprise Archive

.WAR .WAR.WAR.WAR

.JAR.JAR.JAR

.JAR.JAR.JAR

.JAR.JAR

.JAR.JAR

.JAR.JAR.JAR

DTOsEntities3rd Party Maven Dependencies

Page 14: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Programmers(18) Operators

(6)

DBAs(3)

Project Managers

(2)

Business Analysts

(4)

QualityAssurance

(6)

Security & Compliance

(2)

Page 15: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

2-Pizza TeamsYou Build It, You Own it

Page 16: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Big Team, Big Effort, High Ceremony DeploymentCode offers no value until it survives in production

24 Weeks

Monolithic System

BusinessChange

Requests

Page 17: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Getting a little Agile - thinking in small batches

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests

Page 18: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Automated TestingContinuous Integration & Build Automation

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests12 Weeks

Page 19: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Linux Containers (e.g. docker)Automation via Orchestration (allows Devs to become DevOps)

Infrastructure as Code

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests12 Weeks 9 Weeks

Page 20: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Continuous Delivery Pipeline

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests612 Weeks 9 Weeks

Page 21: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Zero-Downtime Deployment Strategies (Blue/Green, Canary)

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests6 312 Weeks 9 Weeks

Page 22: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

High Trust Environment

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests6 3 1 112 Weeks 9 Weeks 1

Page 23: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests6 3 1 112 Weeks 9 Weeks 1

Deploying faster than 3-week sprint cycles?

Patches to your application as well as your “stack” are also deployments.Your stack consisting of the OS, JVM, runtime engine (e.g. Tomcat, Vert.x, JBoss EAP), frameworks (e.g. Spring) all should be regularly patched via

your CD Pipeline

Page 24: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

10 Deploys a Day

How is that possible?

Page 25: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

10 Microservices

D

BA

F J

C H

EG

I

DeploymentWeek 1: A, C, DWeek 2: A.1, H, GWeek 3: B, F, I, J, A.2Week 4: A, C, D, EWeek 5: H, G, C.1, D.1Week 6: B, F, I, J, G.1, A.3Week 7: A, C, D, E, G.2

Each microservice has its own independent team, practicing continuous delivery, typically deploying at the end of their independent 3-week sprints.

However, App and Stack patches may also need to be deployed mid-sprint.

Deployment frequency grows as organizational confidence grows

BUM - Break Up Monolith

Page 26: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Page 27: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Enterprise Service Bus

Page 28: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

The One ESBOne bus to rule them all,

One bus to find them,One bus to bring them all

And in the darkness bind them

Page 29: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

WITH GREAT POWER THERE MUST ALSO COME -- GREAT RESPONSIBILITY!

Amazing Fantasy #15 (August 1962)

Photo taken with Burr’s iPhoneThe Amazing Spider-Man Omnibus Vol 1

Page 30: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Conway’s Law"Any organization that designs a system (defined more broadly here than just

information systems) will inevitably produce a design whose structure is a copy of the organization's communication structure."

https://www.thoughtworks.com/insights/blog/demystifying-conways-law

Page 31: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Independenceaids Agility

Page 32: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter@burrsutter

Microservice Principles/Characteristics1. Deployment Independence - updates to an individual

microservice have no negative impact to any other component of the system. Optimized for Replacement

2. Organized around business capabilities3. Products not Projects4. API Focused5. Smart endpoints and dumb pipes6. Decentralized Governance7. Decentralized Data Management8. Infrastructure Automation (infrastructure as code)9. Design for failure

10. Evolutionary Design

Page 33: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Decentralized Data Management

Your Oracle DBA will hunt you down and hurt you...be ready.

Deployment independence requires owning your own schema

Page 34: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Microservice Concerns

MyService

Resilience

Discovery

Load BalancingScaling / Elasticity Logging

Monitoring

Build,Deployment

PipelineTracing

InvocationMessaging /

IPC

API Authentication

Page 35: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

DemoSpring Boot, Dropwizard, WildFly Swarm, Vert.x,

Hystrix, Zipkin, Blue/Green, Canary, CI/CD via Jenkinsfile

Page 36: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Patterns

Page 37: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Browser

Page 38: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

ExampleACME Laptop 128GB SSD, 8GB RAM

$323.56

Touchscreen128GB SSD 8GB RAMCore i3Windows 10

Add to Cart

In-Store Pickup (15 available)Raleigh, Central Ave, Store #1123

Recommendations

Page 39: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

ExampleACME Laptop 128GB SSD, 8GB RAM

$323.56

Touchscreen128GB SSD 8GB RAMCore i3Windows 10

Add to Cart

In-Store Pickup (15 available)Raleigh, Central Ave, Store #1123

Recommendations

Pricing EngineReviews

Details/Specifications

Location-based availability

People who purchased also...

Page 40: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Example(Fail)

ACME Laptop 128GB SSD, 8GB RAM

$323.56

Touchscreen128GB SSD 8GB RAMCore i3Windows 10

Add to Cart

In-Store Pickup (15 available)Raleigh, Central Ave, Store #1123

Recommendations

Pricing EngineReviews

Details/Specifications

Location-based availability

People who purchased also...

X

Page 41: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Example(Fallback)

ACME Laptop 128GB SSD, 8GB RAM

$323.56

Touchscreen128GB SSD 8GB RAMCore i3Windows 10

Add to Cart

Closest store:Raleigh, Central Ave, Store #1123

Recommendations

Pricing EngineReviews

Details/Specifications

Location-based availability

People who purchased also...

X

Page 42: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

API “Gateway”

Page 43: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

API “Gateway” (Fail)

X

Page 44: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Chaining

Page 45: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Chaining (Fail)

X

Page 46: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Chaining (Cascading Fail)

XXXXX

Page 47: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Mixed

Page 48: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Microservices Playgroundbit.ly/msa-instructions

http://developers.redhat.com/downloadsContainer Development Kit

Recorded Demo: https://youtu.be/SPATMHP-xw8

Helloworld MSA

Page 49: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

DropWizard

www.dropwizard.io

JAX-RS API

First to market

DropWizard Metrics

Embeddable servers:Jetty

Spring Boot

projects.spring.io/spring-boot

Spring API (@RestController)

‘Starter’ POMs: start.spring.io

Embeddable servers:Tomcat, Jetty, Undertow

WildFly Swarm

wildfly-swarm.io

Java EE 7 APIs

‘Starter’ POMs: wildfly-swarm.io/generator

Embeddable servers:WildFly (Undertow)

Opinionated & java -jar myapp.jar

Page 50: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Vert.x(Un-Opinionated) Toolkit for reactive, async applications

Every user has their own Vert.x way

Low-latency microservices that interact using the EventBus

Built in elasticity and resiliency

Interact with anything (.NET, Go, Rust, Cobol, Java EE, Spring...)

vertx.io

http://vertx.io/blog/my-first-vert-x-3-application/

Page 51: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Vert.x EventBus

Ver

ticle

1

Ver

ticle

2

Ver

ticle

3

Ver

ticle

4

Ver

ticle

5

JVM

Vert.x Instance

Ver

ticle

1

Ver

ticle

2

Ver

ticle

6

Ver

ticle

7

JVM

Vert.x Instance

vertx.eventBus

Page 52: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Service A Service B

Circuit Breaker

Page 53: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Service A Service B

Hystrix - circuit-breaker, bulkhead

Page 54: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Page 55: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures
Page 56: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

Distributed Tracing

Page 57: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

MSA running in Container Development Kit

Hypervisor

RHEL VM Image

● OpenShift● Kubernetes● Docker

http://developers.redhat.com/products/cdk/download/

Page 58: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Majestic Monolithhttps://m.signalvnoise.com/the-majestic-monolith-29166d022228

Microservices are not for everybody :-)

Page 59: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

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

Monolith First

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

Page 60: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Release It!Michael T. Nygard

(note: Java references are a bit dated but the fail stories are

brilliant)

Where circuit breaker was born

Page 61: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Monolith to Microservices

Page 62: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangler Fig

http://www.martinfowler.com/bliki/StranglerApplication.html

Page 63: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 64: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 65: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 66: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 67: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 68: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 69: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 70: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter

Strangle the Monolith

Page 71: Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

@burrsutter@burrsutter developers.redhat.com