anti-fragile cloud architectures - jug da · grails full stack, web xd streams, taps, jobs boot...

65
Anti-fragile Cloud Architectures Agim Emruli - @aemruli - mimacom

Upload: others

Post on 28-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Anti-fragile Cloud Architectures Agim Emruli - @aemruli - mimacom

Page 2: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

“Antifragility is beyond resilience or robustness. The resilient resists shocks and stays the same; the antifragile gets better.” Nasim Nicholas Taleb

Page 3: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Fragile Robust ANTI-FragileNon-linear (Konkav)

linear Non-linear (Konvex)

Post-traumatic Syndrom

Post-traumatic Growth

Centralized Decentralized

Page 4: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Fragile Robust

Page 5: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Fragile Anti-Fragile

Page 6: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Dem

and

Time

Page 7: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Scale cube

Start

Infinite Scale

Mod

ular

ize

Duplicate

Partition

Page 8: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Start

Page 9: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Duplication

Page 10: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Dem

and

Time

Page 11: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Modularization

Page 12: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Dem

and

Time

Page 13: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

EuropeNorth America

PArtioning

Page 14: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Dem

and

Time

Page 15: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

{you Name it} Service

Page 16: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

a microservices architecture IS a service-oriented architecture composed of loosely coupled elements that have bounded contexts

Page 17: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Hospital

Patient Product

DosingTherapy

product Management

Therapy Dose Calculation

Patients

Shared Kernel

Partner Conformist

Page 18: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Component Component

ComponentComponent

Page 19: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

The network is reliable

Latency is zero

Bandwith is Infinite

The network is secure

Topology doesn’t Change

There is one Administrator

Transport cost is zero

The network is homogeneous

Page 20: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

The network is reliable

Latency is zero

Bandwith is Infinite

The network is secure

Topology doesn’t Change

There is one Administrator

Transport cost is zero

The network is homogeneous

http://www.rgoarchitects.com/Files/fallacies.pdf

The network Fallacies

Page 21: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Timeout

Page 22: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

public class MessageReceiver { private Session session; private Destination destination; public void doReceive() throws Exception{ MessageConsumer consumer = session.createConsumer(destination); consumer.receive(); } }

Page 23: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

public class MessageReceiver { private Session session; private Destination destination; public void doReceive() throws Exception{ MessageConsumer consumer = session.createConsumer(destination); consumer.receive(20L); } }

Page 24: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

public class HttpReceiver { public String getResource() throws IOException { URL url = new URL("http://www.google.de"); InputStream inputStream = url.openStream(); return “…”; } }

Page 25: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

public class HttpReceiver { public String getResource() throws IOException { URL url = new URL("http://www.google.de"); URLConnection urlConn = url.openConnection(); urlConn.setConnectTimeout(10); urlConn.setReadTimeout(10); InputStream inputStream = url.getInputStream(); return “…”; }}

Page 26: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

public class DataSourceConfig { public void DataSource setupDataSource(){ BasicDataSource basicDataSource = new BasicDataSource(); basicDataSource.setMaxWait(30L); }}

Page 27: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Add Latency

tcqdiscadddeveth0rootnetemcorrupt5%

tcqdiscadddeveth0rootlatencydelay1000ms500ms

Corrupt Packages

Drop Packagestcqdiscadddeveth0rootnetemloss7%25%

Block DNSiptables-AINPUT-ptcp-mtcp--dport53-jDROP

Page 28: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

PatternsStability Capacity Transparency

Page 29: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Internet Traffic

37%

Page 30: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

CLOUD

SERVICE REGISTRY,CIRCUIT BREAKER, METRICS

CORE

FRAMEWORK SECURITY GROOVY REACTOR

IO E

XECU

TION

IO F

OUND

ATIO

N

GRAILS

FULL STACK, WEB

XD

STREAMS, TAPS, JOBS

BOOT

BOOTABLE, MINIMAL, OPS-READY

BATCH

JOBS, STEPS, READERS, WRITERS

DATA

RELATIONAL DATA NON-RELATIONAL DATA

BIG DATA

INGESTION, EXPORT,ORCHESTRATION, HADOOP

WEB

CONTROLLERS, REST,WEBSOCKET

INTEGRATION

CHANNELS, FILTERS,ADAPTERS, TRANSFORMERS

IO C

OORD

INAT

ION

Page 31: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Application

Tomcat (Jetty, Undertow)

Actuator

Data Source

java -jar myapplication.jar

Java Runtime Environment

Page 32: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Circuit Breaker

Page 33: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Fragile Robust ANTI-FragileNo Timeout Timeout CIRCUIT-BREAKER

Page 34: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Execute Command

Run

Fallback

Page 35: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Execute Command

Run

Fallback

Circuit Open ?

Close Circuit

Page 36: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Tomcat Thread Pool

Thre

ad -

1Service

Service

Service ServiceTh

read

- 2

Thre

ad -

3X

Thre

ad -

4

Thre

ad -

5

Thre

ad -

6

Thre

ad -

7

Thre

ad -

8

Page 37: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

COMMAND THREAD

COMMAND THREAD

COMMAND THREAD

Page 38: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

COMMAND THREAD

COMMAND THREADTRACE --- [http-nio-auto-1-exec-10] outside command TRACE --- [hystrix-RestCurrencyExchange-10] inside command

Thread locals

Page 39: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

@SpringCloudApplication public class SearchGateway { @HystrixCommand(fallbackMethod = "fallback") public List<SearchHit> search(String query) { return …; } public List<SearchHit> fallback() { return Collections.emptyList(); } }

Page 40: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data
Page 41: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Service Registry

Page 42: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Fragile Robust ANTI-FragilePoint-To-Point Service-Registry

Page 43: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Service

Service

Service Service v1.0

Client

Service v1.1

Page 44: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Eureka Consul ZookeeperAvailability Partitioning

Consistency Availability

Consistency Availability

Page 45: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Avai

labi

lity

Time

Eureka

Zookeeper

Page 46: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

EuropeNorth America

Eureka Eureka

PArtioning

Page 47: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Discovery

Page 48: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Client Discovery

Client

Service Registry

Service InstanceService InstanceService Instance

Execution Environment

DNS

Consul

KubernetesLoad Balance

Page 49: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Client Discovery

Client

Service Registry

Service InstanceService InstanceService Instance

Execution Environment

Api

Load Balance

Discovery Client

Page 50: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Server Discovery

Client

Service Registry

Service InstanceService InstanceService Instance

Execution Environment

Proxy

Load Balance

Sidecar

Page 51: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Server Discovery

Client

Execution Environment

RequestZUUL Edge Gateway

Service Registry

Service InstanceService InstanceService InstanceLoad

Balance

Page 52: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Client

Service Service

Round Robin

Client

Service Service

Availability Filtering

XClient

Service 2.3

Service 0.7

Weighted Response Time

Load Balancing

LINEAR NON-LInear NON-LInear

Page 53: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Add Latency

tcqdiscadddeveth0rootnetemcorrupt5%

tcqdiscadddeveth0rootlatencydelay1000ms500ms

Corrupt Packages

Drop Packagestcqdiscadddeveth0rootnetemloss7%25%

Block DNSiptables-AINPUT-ptcp-mtcp--dport53-jDROP

whiletrue;

doddif=/dev/urandomof=/burnbs=1Mcount=1024iflag=fullblockdone

Simulate heavy IO

whiletrue;doopensslspeed;done

Burn CPU

Page 54: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

API Gateway

Page 55: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Client

Resource

Resource

Resource

Resource

API G

atew

ay

Client

Client

Client

Client

Clie

nt

(C OR R1 OR R2 OR R3 OR R4) (C OR A) AND (R1 OR R2 OR R3 OR R4)

Page 56: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Running Distributed Architectures

Page 57: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Load Performance Stress

Page 58: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

RobustAt 12:24 PM Pacific Time on December 24 network traffic stopped on a few ELBs….. At around 3:30 PM on December 24, network traffic stopped on additional ELBs …..Netflix is designed to handle failure of all or part of a single availability zone in a region as we run across three zones and operate with no loss of functionality on two.  We are working on ways of extending our resiliency to handle partial or complete regional outages.

Page 59: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data
Page 60: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Hormesis

Impa

ct

Time

Page 61: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data
Page 62: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

On Sunday, at 2:19am PDT, there was a brief network disruption that impacted…….. So, when the network disruption occurred on Sunday morning, and a number of storage servers simultaneously requested their membership data,….. By 2:37am PDT, the error rate in customer requests to DynamoDB had risen far beyond any level experienced in the last 3 years…… After several failed attempts at adding capacity, at 5:06am PDT, we decided to pause requests to the metadata service.

Anti-fragile

Page 63: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Despite being run entirely from AWS' cloud platform the online streaming giant Netflix reports a quick recovery from Sunday's disruption - demonstrating the importance of its approach of building cloud-based systems to "fail".

Anti-fragile

Page 64: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

AWS:REBOOT 2700+ NodesCassandra

218 Rebooted 22 Dead

Page 65: Anti-fragile Cloud Architectures - JUG DA · grails full stack, web xd streams, taps, jobs boot bootable, minimal, ops-ready batch jobs, steps, readers, writers data relational data

Thanks Agim Emruli - mimacom @aemruli