58
Cloud Developer’s DHARMA… redefining ‘done’ for Cloud applications Daniel Bryant CTO, Instant Access Technologies [email protected] @danielbryantuk

LJC 05/14 "Cloud Developer's DHARMA"

Embed Size (px)

DESCRIPTION

Building applications for the IaaS Cloud is easy, right? "Sure, no problem - just lift and shift!" all the Cloud vendors shout in unison. However, the reality of building and deploying Cloud applications can often be different. This talk will introduce lessons learnt from the trenches during two years of designing and implementing cloud-based Java applications, which we have codified into our Cloud developer’s 'DHARMA' rules; Documented (just enough); Highly cohesive/loosely coupled (all the way down); Automated from code commit to cloud; Resource aware; Monitored thoroughly; and Antifragile. We will look at these lessons from both a theoretic and practical perspective using a real-world case study from Instant Access Technologies (IAT) Ltd. IAT recently evolved their epoints.com(http://epoints.com/) customer loyalty platform from a monolithic Java application deployed into a data centre on a 'big bang' schedule, to a platform of loosely-coupled JVM-based components, all being continuously deployed into the AWS IaaS Cloud

Citation preview

Page 1: LJC 05/14 "Cloud Developer's DHARMA"

Cloud Developer’s DHARMA…redefining ‘done’ for Cloud

applications

Daniel BryantCTO, Instant Access Technologies

[email protected]@danielbryantuk

Page 2: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Who is this guy?

• My career so far…

• Open source work

• I enjoy coding…

Page 3: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Page 4: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

epoints.com 2012/13 Upgrade…

• Increasing traffic – Scalability being stretched

• Increasingly diverse requirements

• Our starting point– Developers creating monolithic application– Manual QA– Operations deploying to data center

Page 5: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Core Changes…

• Service-Oriented Architecture

• Cloud-based deployments

• DevOps Culture

Page 6: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Core Changes…

• Service-Oriented Architecture– Twitter’s Story (bit.ly/1j1WbmI)

• Cloud-based deployments– Tonight!

• DevOps Culture– Previous LJC Event (bit.ly/1elVPJz)

Page 7: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023

Moving to the Cloud

• IAT chose Amazon Web Services (AWS) IaaS

• IaaS was great, but…– Made a few mistakes – Learnt a lot of lessons

• Bonus! Russ Miles view on PaaS– bit.ly/1neXzaf

@danielbryantuk

Page 8: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Common Cloud Problems

TL;DR…

Page 9: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Page 10: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Common Cloud Problems

• Components– Who does what now?– Configuration issues

• Deployment topology– Cloud networking– “Is that DB local?”

Page 11: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Common Cloud Problems

• Unknown failure modes

– Bang!

– Now you see me…

– Can…you…hear…me?…

– A to B, but not B to A

Page 12: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Common Cloud Problems

• High Availability (HA)– Self-inflicted wounds…

• Snowflake servers

• Monitoring / Diagnostics

Page 13: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Common Cloud Problems

• Not respecting the underlying hardware

• Not testing in the Cloud– Here be dragons!

Page 14: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

We’ve created a “Cloud Developer’s DHARMA” to act as a checklist when building Cloud apps

Page 15: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

dharma/ˈdɑːmə,ˈdəːmə/

noun

1. Signifies behaviors that are considered to be in accord with order that makes life and universe possible (Hinduism)

2. "cosmic law and order”, but is also applied to the teachings of the Buddha (Buddhism)

Page 16: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 17: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 18: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Page 19: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk11/04/2023 @danielbryantuk

Page 20: LJC 05/14 "Cloud Developer's DHARMA"

Documentation (just enough)

• Create a Wiki

• Simon Brown’s C4 Model– bit.ly/StVpa4

• Architectural ‘views’

• Open Source style README.md

Page 21: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 22: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

High Cohesion / Loose Coupling (all the way down…)

• Code

• Architecture– Components– Services

• Public API– PayPal (bit.ly/1hnZNly)

Page 23: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 24: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Automated from Commit to Cloud

• Continuous Integration

• Continuous Deployment

• Continuous Delivery

Page 25: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Our Build Pipeline

Jenkins, with plugins…

• Build Pipeline– wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin

• Parameterized build– wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

• Promoted Builds Plugin– wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin

Page 26: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Our Build Pipeline

• Component Build– Compile– Unit Tests (surefire)– Integration Tests (failsafe)

• Deployment onto QA Cloud– Python Scripts + Chef to provision– Verify success using Python

Page 27: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Our Build Pipeline

• Acceptance Tests– Cucumber and Selenium– Work in progress…

• Performance Tests– Jmeter– Jenkins Jmeter performance plugin

• Live Deployment– “Human-based conditional operation”

Page 28: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Automating QA

• Intra-component integration testing– Spock is awesome (code.google.com/p/spock)– Utilise embedded datastore/middleware

• Inter-component integration testing– The hardest part of SOA…

• Consumer-based Testing– Brandon Byars (bit.ly/1lmcoaD)

Page 29: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Infrastructure: Say No To Snowflakes!

• Automate all provisioning– Chef, Puppet, SaltStack– Bash, Python– AWS API / CLI

• “Infrastructure as Code”– Version control everything

Page 30: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Infrastructure: Say No To Snowflakes!

• Doing “Proper Development”– Gareth Rushgrove at Craft Conf (bit.ly/1njuc49)– Chef Conf (www.youtube.com/user/getchef)

• Local tooling/testing– Vagrant (www.vagrantup.com)– Docker (www.docker.io)

Page 31: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 32: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Deployment Platform: What you’ve got…

Page 33: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

What you think you want…

Page 34: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

What you get…

Fact: 9 out of 10 cheetahs prefer the taste of an Ops team over tinned food

Page 35: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Thou Shalt Know thy Cloud…

• AWS EBS 100 IOPS (by default)– My Mac SSD does 49K IOPS

• 1000Mbps network max transfer ~125MB/s– My Mac does 400+ MB/s Sequential Write to SSD

• “Noisy [virtual] Neighbours”

Reference for Mac statistics: bit.ly/1ftJZH8

Page 36: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Thinking/Acting Operationally

• Cultivate “Mechanical Sympathy”

• Virtualisation – Tech Target (bit.ly/1kDVqyG)

• Networking– ‘Unix and Linux System Administration Handbook’– aws.amazon.com/documentation

Page 37: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Thinking/Acting Operationally

• Learn Linux fundamentals

• Diagnostic skills– top, netstat, vmstat, tcpdump– Java utils: jps, jstat, jmap, jhat– “DevOps Troubleshooting” by K. Rankin

• Maybe grow a beard…

Page 38: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 39: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Monitor All The Things!

• Infrastructure monitoring– Nagios– Zabbix– Splunk– AppDynamics

• Distributed Tracing – twitter.github.io/zipkin

Page 40: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Component Metrics

• Dropwizard’s Metrics– metrics.codahale.com

• Netflix’s Servo– github.com/Netflix/servo

• Etsy’s StatsD– github.com/etsy/statsd/wiki

Page 41: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Gauges, Counters, Meters, Timers…

Page 42: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Graph It!

Page 43: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Page 44: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Page 45: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Health Checks

Page 46: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

Page 47: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Antifragile

• The opposite of fragile?– Robust…– Antifragile…

• Netflix are best-in-class– bit.ly/1gs5n3q

• System must be robust first!

Page 48: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Design for Failure

• Design patterns– Timeouts / retries– Bulkheads / circuit-breakers

• Inspiration– Chris Richardson (slidesha.re/1ft3vsg)– Netflix (bit.ly/1h5GMid)

Page 49: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Retries

https://github.com/rholder/guava-retrying

Page 50: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Circuit-breaker

https://github.com/Netflix/Hystrix

Page 51: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Robust in the Cloud

• Distributed Computing Principles– ‘For young bloods’ (bit.ly/1pKVepz)

• “Multi-AZ”

Page 52: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Robust in the Cloud

Page 53: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Robust in the Cloud

• Careful caching…

• Make apps “Cluster-aware”– MongoDB– SolrCloud– RabbitMQ

Page 54: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Real Antifragility

• Autoscaling

Page 55: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Antifragile Patterns

• Stateless components• Distributed data stores / caches

Page 56: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Antifragile Patterns

• Eventual consistency• Asynchronous communication

http://cloudshankar.blogspot.co.uk/2013/05/eventual-consistency.html

Page 57: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Documented (just enough)

Highly cohesive/loosely coupled (all the way down)

Automated from commit to Cloud

Resource aware

Monitored thoroughly

Antifragile

So, Cloud Apps are ‘done’ when…

Page 58: LJC 05/14 "Cloud Developer's DHARMA"

11/04/2023 @danielbryantuk

Thanks For Listening

• Massive thanks to all the IAT team!

• Questions / comments?– [email protected]– @danielbryantuk

• Join us at Devoxx UK!– www.devoxx.co.uk