Architecting for the Clo loud @axelfontaine About Axel Fontaine - - PowerPoint PPT Presentation

architecting for the
SMART_READER_LITE
LIVE PREVIEW

Architecting for the Clo loud @axelfontaine About Axel Fontaine - - PowerPoint PPT Presentation

Architecting for the Clo loud @axelfontaine About Axel Fontaine Founder and CEO of Boxfuse Over 15 years industry experience Continuous Delivery expert Regular speaker at tech conferences JavaOne RockStar in 2014


slide-1
SLIDE 1

Architecting for the

@axelfontaine

Clo loud

slide-2
SLIDE 2
slide-3
SLIDE 3

About Axel Fontaine

  • Founder and CEO of Boxfuse
  • Over 15 years industry experience
  • Continuous Delivery expert
  • Regular speaker at tech conferences
  • JavaOne RockStar in 2014

@axelfontaine

slide-4
SLIDE 4

flywaydb.org

slide-5
SLIDE 5

boxfuse.com

slide-6
SLIDE 6

about

questions

slide-7
SLIDE 7

POLL: what type of infrastructure are you running on?

  • On Premise
  • Colocation
  • Root Server
  • Cloud
slide-8
SLIDE 8

what is special about the cloud ??

slide-9
SLIDE 9

Every day, AWS adds enough server capacity to power the whole $7B enterprise Amazon.com was in 2004. Weekends included.

slide-10
SLIDE 10

"Advanced Test Reactor" by Argonne National Laboratory -

  • riginally posted to Flickr as Advanced Test Reactor core,

Idaho National LaboratoryUploaded using F2ComButton. Licensed under CC BY-SA 2.0 via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Advanced_Test_Reac tor.jpg#mediaviewer/File:Advanced_Test_Reactor.jpg "RIAN archive 341194 Kursk Nuclear Power Plant" by RIA Novosti archive, image #341194 / Sergey Pyatakov / CC-BY-SA 3.0. Licensed under CC BY-SA 3.0 via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:RIAN_archive_341194_ Kursk_Nuclear_Power_Plant.jpg#mediaviewer/File:RIAN_archi ve_341194_Kursk_Nuclear_Power_Plant.jpg

Control Plane Data Plane

slide-11
SLIDE 11

Control Plane Data Plane

slide-12
SLIDE 12

 Shift to a world of abundance (no more resource scarcity)  Clean Control Plane/Data Plane split with API-based provisioning  Cost-based Architectures with the ability to turn infrastructure off

benefits of the cloud

slide-13
SLIDE 13

moving to the cloud

slide-14
SLIDE 14

lift & shift

(= the naïve approach)

slide-15
SLIDE 15

Congratulations! You now have:

  • A more expense Hetzner/OVH
  • Lots of (too much?) trust

in your cloud provider

  • Potential legal trouble

due to data privacy laws

lift & shift

(= the naïve approach)

slide-16
SLIDE 16

understanding the cloud

slide-17
SLIDE 17

regions

slide-18
SLIDE 18

availability zones <<IMAGE GERMANY + two small clouds with racks>>

slide-19
SLIDE 19

building blocks

http://en.wikipedia.org/wiki/Lego#/media/File:Lego_Color_Bricks.jpg

slide-20
SLIDE 20

building blocks Security Storage Network Compute

slide-21
SLIDE 21
slide-22
SLIDE 22

The hard Truth about Security

1. Always breakable with infinite time & resources 2. Must make it more complicated/expensive to break than it’s worth (use defense in depth!) 3. Has a usability cost 4. Almost always about the data

slide-23
SLIDE 23

the 3 states of data Data at Rest Data in Motion Data in Use

slide-24
SLIDE 24

Trusting your neighbors is good. But it’s even better to put a good lock on the door.

Werner Vogels

CTO of an online book shop

http://en.wikipedia.org/wiki/Werner_Vogels#/media/File:Wernervogels_ddp.jpg

slide-25
SLIDE 25

Data in Motion TLS / SSL

slide-26
SLIDE 26

Data in Use & at Rest Client-side encryption

slide-27
SLIDE 27

Client-side encryption

 Encrypt sensitive & personally identifiable data  Use different Encryption key for each field/record  Encrypt Encryption Key using Key encrypting Key  Secure & Rotate the Key encrypting Key

slide-28
SLIDE 28

Key Management In App € KMS €€ HSM €€€€€

slide-29
SLIDE 29

Querying Encrypted Data Other clear text field

Id Encrypted 123 #!azw\b 456 67ftf6&)

Exact Match => Hmac

Hmac Encrypted 5841545832 #!azw\b 0219237127 67ftf6&)

Range => Lower fidelity

Low Fi Encrypted 48.5 #!azw\b 37.2 67ftf6&)

=> Use transparent persistence layer converters!

slide-30
SLIDE 30

Compute

slide-31
SLIDE 31

POLL: which level of automation are you at?

  • Build
  • Unit Tests
  • Continuous Integration
  • Acceptance Tests
  • Continuous Deployment (Code)
  • Continuous Deployment (Code + DB + Configuration)
  • Infrastructure
slide-32
SLIDE 32

Build Test

slide-33
SLIDE 33

Build Test

slide-34
SLIDE 34
  • One immutable unit
  • Regenerated after every change
  • Promoted from Environment to Environment

Classic Mis istake: Build per Environment

slide-35
SLIDE 35

Image Instance

Fully Baked Provisioned on Startup

?

slide-36
SLIDE 36

Fully Baked Provisioned on Startup

Most people

 Every Instance 100% identical  Fastest startup  Launch always succeeds

slide-37
SLIDE 37

Fully Baked Provisioned on Startup

Most people

 One immutable unit  Regenerated after every change  Promoted from environment to environment

slide-38
SLIDE 38

Fully Baked

 One immutable unit  Regenerated after every change  Promoted from environment to environment Image

slide-39
SLIDE 39

 One immutable unit  Regenerated after every change  Promoted from environment to environment

slide-40
SLIDE 40

Fully Baked

 One immutable unit  Regenerated after every change  Promoted from environment to environment Image

slide-41
SLIDE 41

Fully Baked

Image Instance

keep your instances stateless

slide-42
SLIDE 42

high uptime is a liability

The longer an instance is up, the harder it becomes to recreate exactly (and it will fail eventually!)

slide-43
SLIDE 43

Focus shift Individual instances become disposable Instance Service

slide-44
SLIDE 44

Treat servers like cattle instead of pets

slide-45
SLIDE 45

What are the implications ???

slide-46
SLIDE 46

scaling

Image Instance

slide-47
SLIDE 47

types of scaling

up down in

  • ut
slide-48
SLIDE 48

scaling triggers for different types of services sync

=> load

async

=> queue depth

cron

=> time

slide-49
SLIDE 49

scaling & costs vs prefer smaller granularity

slide-50
SLIDE 50

instance types

General Purpose

CPU RAM Disk

slide-51
SLIDE 51

How to solve service discovery ?

Use a stable entry point with an internal registry

Instance Instance Instance

?

Elastic Load Balancer

slide-52
SLIDE 52
  • Bake as much configuration as

possible for all environments directly in the Image

  • Use environment detection

and auto-configuration

  • Pass remaining configuration

at startup and expose it as environment variables

Key Value JDBC_URL jdbc:… ENV prod

what about configuration ???

slide-53
SLIDE 53

what about the database ???

  • Keep all persistent state out of the instance,

including the database

  • Use one of the many good hosted solutions

available like Amazon RDS or Google Cloud SQL

  • Use a database migration tool to update the

schema on application startup

Instance

slide-54
SLIDE 54

what about the logs ???

LOG file LOG file LOG file

ssh me@myserver1 tail -f server.log ssh me@myserver2 tail -f server.log ssh me@myserver3 tail -f server.log

slide-55
SLIDE 55

LOG file LOG file LOG file

log server

slide-56
SLIDE 56

Ship logs to a central log server where they can be

  • aggregated
  • stored and backuped
  • indexed
  • searched through a nice web UI

Many good hosted solutions

  • Loggly
  • Logentries
  • Papertrail

=> Think about data privacy!

slide-57
SLIDE 57

what about sessions ???

Keep session in an encrypted and signed cookie

  • avoids session timeouts
  • avoids server clustering & session replication
  • avoids sticky sessions & server affinity
slide-58
SLIDE 58

what about rolling out new versions ???

slide-59
SLIDE 59

Load Balancer

App v1 App v1

Logs

Availability Zone 1 Availability Zone 2

slide-60
SLIDE 60

Load Balancer

App v1 App v1

Logs

Availability Zone 1 Availability Zone 2

slide-61
SLIDE 61

Load Balancer

App v2 App v1 App v2 App v1

Logs

Availability Zone 1 Availability Zone 2

slide-62
SLIDE 62

Load Balancer

App v2 App v1 App v2 App v1

Logs

Availability Zone 1 Availability Zone 2

slide-63
SLIDE 63

what about containers ???

slide-64
SLIDE 64

understanding modern CPUs

Both Intel and AMD have hardware support for virtualization

  • isolation
  • performance
slide-65
SLIDE 65

Image Hardware Hypervisor Image Hardware OS+Container Runtime

Container VM

  • n prem

your responsibility

slide-66
SLIDE 66

cloud your responsibility clo loud responsibility

instance scheduling machine images instances instance volumes instance networking container scheduling container images containers container volumes container networking

Only makes sense if you cannot afford 8.75€/month granularity

slide-67
SLIDE 67

cloud your responsibility clo loud responsibility

instance scheduling machine images instances instance volumes instance networking container scheduling container images containers container volumes container networking

Only makes sense if you cannot afford 0.0 .01€/hour r granularity

slide-68
SLIDE 68

summary

 Put a good lock on the door (use encryption!)  Use fully baked images (build once!)  Treat servers like cattle (disposable!)

slide-69
SLIDE 69

boxfuse.com

  • Fully baked images generated in seconds

(not minutes or hours)

  • Optimized for JVM apps

(Spring Boot, Dropwizard, Tomcat, TomEE, ...)

  • Minimal images just 1% of size of regular OS

(measured in MB not GB)

  • Images work on VirtualBox & AWS

(environment parity from dev to prod)

  • Zero downtime updates on AWS

(fully automatic blue/green deployments)

slide-70
SLIDE 70

final disclaimer

no animals were harmed while making this talk 

slide-71
SLIDE 71
slide-72
SLIDE 72

Thanks !

@axelfontaine

boxfuse.com