Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures

Post on 21-Jan-2017

122 views 0 download

transcript

@burrsutter 1

Develop & Deploy Cloud-native Apps as Resilient Microservices Architectures

@burrsutter

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

http://bit.ly/msa-instructions

@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

@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

MicroProfile 1.0 Available!Optimizing Enterprise Java for Microservices

Microservice Collaboration and Innovation in the Java Community

Learn more at microprofile.io

@burrsutter@burrsutter developers.redhat.com

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

@burrsutter

Microservices is about

Agility

Continuous Delivery, Deployment, Improvement

@burrsutter

Peak of Inflated Expectations

Microservices

x

Trough of Disillusionment

Serious Hotness

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

@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

@burrsutter

Green vs Brown (shades Brown)

GREENBROWN

@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

@burrsutter

Programmers(18) Operators

(6)

DBAs(3)

Project Managers

(2)

Business Analysts

(4)

QualityAssurance

(6)

Security & Compliance

(2)

@burrsutter

2-Pizza TeamsYou Build It, You Own it

@burrsutter

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

24 Weeks

Monolithic System

BusinessChange

Requests

@burrsutter

Getting a little Agile - thinking in small batches

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests

@burrsutter

Automated TestingContinuous Integration & Build Automation

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests12 Weeks

@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

@burrsutter

Continuous Delivery Pipeline

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests612 Weeks 9 Weeks

@burrsutter

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

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests6 312 Weeks 9 Weeks

@burrsutter

High Trust Environment

24 Weeks 8 of 3 week sprints

Monolithic System

BusinessChange

Requests6 3 1 112 Weeks 9 Weeks 1

@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

@burrsutter

10 Deploys a Day

How is that possible?

@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

@burrsutter

@burrsutter

Enterprise Service Bus

@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

@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

@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

@burrsutter

Independenceaids Agility

@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

@burrsutter

Decentralized Data Management

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

Deployment independence requires owning your own schema

@burrsutter

Microservice Concerns

MyService

Resilience

Discovery

Load BalancingScaling / Elasticity Logging

Monitoring

Build,Deployment

PipelineTracing

InvocationMessaging /

IPC

API Authentication

@burrsutter

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

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

@burrsutter

Patterns

@burrsutter

Browser

@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

@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...

@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

@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

@burrsutter

API “Gateway”

@burrsutter

API “Gateway” (Fail)

X

@burrsutter

Chaining

@burrsutter

Chaining (Fail)

X

@burrsutter

Chaining (Cascading Fail)

XXXXX

@burrsutter

Mixed

@burrsutter

Microservices Playgroundbit.ly/msa-instructions

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

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

Helloworld MSA

@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

@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/

@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

@burrsutter

Service A Service B

Circuit Breaker

@burrsutter

Service A Service B

Hystrix - circuit-breaker, bulkhead

@burrsutter

Distributed Tracing

MSA running in Container Development Kit

Hypervisor

RHEL VM Image

● OpenShift● Kubernetes● Docker

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

@burrsutter

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

Microservices are not for everybody :-)

@burrsutter

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

Monolith First

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

@burrsutter

Release It!Michael T. Nygard

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

brilliant)

Where circuit breaker was born

@burrsutter

Monolith to Microservices

@burrsutter

Strangler Fig

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

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter

Strangle the Monolith

@burrsutter@burrsutter developers.redhat.com