SlideShare a Scribd company logo
Building 
Java 
applica.ons 
for 
the 
Cloud: 
The 
DHARMA 
principles 
Daniel 
Bryant 
Principal 
Consultant, 
Open 
Credo 
daniel.bryant@opencredo.com 
@danielbryantuk
What 
to 
expect 
• Problems 
when 
developing 
for 
the 
Cloud 
– “LiG 
and 
shiG” 
– Smashing 
the 
monolith 
– Greenfield 
(“Cloud 
na.ve”) 
• Some 
sugges.ons 
on 
where 
to 
focus 
efforts 
– Not 
specific 
plaPorm/framework 
reviews 
• Tools 
and 
techniques 
• Lots 
of 
informa.on… 
(slides 
will 
be 
available) 
14/10/2014 
@danielbryantuk
Who 
Am 
I? 
• LJC 
• Principal 
Associate 
• Adopt 
Consultant 
at 
OpenCredo 
ü Agile 
transforma.ons 
ü DevOps 
ü Microservices 
and 
Cloud 
OpenJDK 
and 
JSR 
14/10/2014 
@danielbryantuk
The 
Current 
Industry 
Wish 
List… 
• Service-­‐Oriented 
Architecture 
• Cloud-­‐based 
deployments 
• DevOps 
Culture 
14/10/2014 
@danielbryantuk
The 
Current 
Industry 
Wish 
List… 
• Service-­‐Oriented 
Architecture 
– Twi`er’s 
Story 
(bit.ly/1j1WbmI) 
• Cloud-­‐based 
deployments 
– Today! 
• DevOps 
Culture 
– Devoxx 
UK 
talk 
(bit.ly/1BylnZb) 
– Previous 
LJC 
Event 
(bit.ly/1elVPJz) 
14/10/2014 
@danielbryantuk
Common 
Cloud 
Problems 
TL;DR… 
14/10/2014 
@danielbryantuk
Not 
respec<ng 
the 
underlying 
environment 
14/10/2014 
@danielbryantuk
Lack 
of 
applica<on/plaDorm 
monitoring… 
14/10/2014 
@danielbryantuk
Bizarre 
failure 
modes… 
14/10/2014 
@danielbryantuk
Difficulty 
in 
understanding 
the 
new 
architecture 
14/10/2014 
@danielbryantuk
Confusion 
over 
environment 
provisioning 
and 
config 
14/10/2014 
@danielbryantuk
Not 
tes<ng 
in 
the 
Cloud… 
(hint: 
here 
be 
dragons!) 
14/10/2014 
@danielbryantuk
We’ve 
created 
the 
“Cloud 
DHARMA 
Principles” 
to 
act 
as 
a 
checklist 
when 
building 
Cloud 
apps 
14/10/2014 
@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) 
14/10/2014 
@danielbryantuk
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
14/10/2014 
@danielbryantuk
Documenta.on 
(just 
enough) 
• Provide 
a 
map 
for 
developers 
• Component 
purpose 
(and 
contract) 
• Ini.alisa.on 
instruc.ons 
(mocks/stubs) 
• Highlights 
areas 
of 
opera.onal 
risk 
14/10/2014 
@danielbryantuk
Simon 
Brown’s 
C4 
Model 
14/10/2014 
@danielbryantuk 
www.codingthearchitecture.com
14/10/2014 
@danielbryantuk
1144//1100/2/201041 
4 
@@ddaanniieellbbrryyaanntutuk 
k
API 
Docs 
with 
Swagger 
14/10/2014 
@danielbryantuk 
helloreverb.com/developers/swagger
Create 
a 
PACT 
14/10/2014 
@danielbryantuk 
github.com/DiUS/pact-­‐jvm
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
High 
Cohesion 
/ 
Loose 
Coupling 
(all 
the 
way 
down…) 
• Code 
• Architecture 
– Components 
– Services 
• Public 
API 
– PayPal 
(bit.ly/1hnZNly) 
14/10/2014 
@danielbryantuk
Smashing 
the 
Monolith… 
• Business 
func.onality 
-­‐“Cart 
Service” 
• Technology 
chunk 
-­‐ 
“Email 
Service” 
• Ver.cal 
Slice 
– “Registra.on” 
(Groupon: 
vimeo.com/105880150) 
• Horizontal 
Slice 
– “User 
Repo” 
(Microservices: 
oreil.ly/1pp6qmx) 
14/10/2014 
@danielbryantuk
Microservices 
• Probably 
won’t 
catch 
on… 
;-­‐) 
14/10/2014 
@danielbryantuk
Twelve 
Factor 
Apps 
14/10/2014 
@danielbryantuk 
h`p://12factor.net/
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
Automated 
from 
Commit 
to 
Cloud 
• Con.nuous 
Integra.on 
• Con.nuous 
Deployment 
• Con.nuous 
Delivery 
14/10/2014 
@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 
14/10/2014 
@danielbryantuk
Our 
Build 
Pipeline 
• Component 
Build 
– Compile 
– Unit 
Tests 
(surefire) 
– Integra.on 
Tests 
(failsafe) 
• Deployment 
onto 
QA 
Cloud 
– Python 
Scripts 
+ 
Chef 
to 
provision 
– Verify 
success 
using 
Python 
– Serverspec 
serverspec.org 
14/10/2014 
@danielbryantuk
Our 
Build 
Pipeline 
• Acceptance 
Tests 
– Cucumber 
(and 
Selenium) 
• Performance 
Tests 
– Jmeter 
+ 
Jenkins 
performance 
plugin 
– Make 
sure 
environment 
is 
realis.c!! 
• Live 
Deployment? 
14/10/2014 
@danielbryantuk
Automa.ng 
QA 
• Intra-­‐component 
integra.on 
tes.ng 
– U.lise 
embedded 
datastore/middleware 
– “Scassandra” 
(github.com/scassandra) 
– Service 
virtualisa.on 
(www.mbtest.org) 
• Inter-­‐component 
integra.on 
tes.ng 
– The 
hardest 
part 
of 
SOA… 
– Consider 
‘synthe.c 
txns’ 
(ac.ve 
monitoring) 
14/10/2014 
@danielbryantuk
Infrastructure: 
Say 
No 
To 
Snowflakes! 
• Automate 
all 
provisioning 
(store 
in 
SCM) 
• Fry... 
– Chef, 
Puppet, 
SaltStack, 
Ansible 
– Bash, 
Python 
(Fabric) 
– Vendor 
APIs 
• …or 
bake? 
– Packer.io 
– NePlix 
Aminator 
14/10/2014 
@danielbryantuk
Infrastructure: 
Say 
No 
To 
Snowflakes! 
• Doing 
“Proper 
Development” 
– Gareth 
Rushgrove 
at 
CraG 
Conf 
(bit.ly/1njuc49) 
– Chef 
Conf 
(www.youtube.com/user/getchef) 
• Local 
tooling/tes.ng 
– Vagrant 
(www.vagrantup.com) 
– Docker 
(www.docker.io) 
14/10/2014 
@danielbryantuk
Configuring 
the 
Cloud 
• Bundle 
config 
with 
app 
– Upload 
new 
config 
file 
– Re-­‐deploy 
en.re 
app 
(easier 
with 
Docker?) 
• Store 
externally 
– Zookeeper 
& 
Curator 
curator.apache.org 
– NePlix 
Archaius 
github.com/NePlix/archaius 
– etcd 
github.com/coreos/etcd 
– Consul.io 
www.consul.io 
14/10/2014 
@danielbryantuk
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
Deployment 
PlaPorm: 
What 
you’ve 
got… 
14/10/2014 
@danielbryantuk
What 
you 
think 
you 
want… 
14/10/2014 
@danielbryantuk
What 
you 
actually 
get… 
Fact: 
9 
out 
of 
10 
cheetahs 
prefer 
the 
taste 
of 
an 
Ops 
team 
over 
<nned 
food 
14/10/2014 
@danielbryantuk
Thou 
Shalt 
Know 
thy 
Cloud… 
• AWS 
“Magne.c” 
EBS 
100 
IOPS 
– New 
SSD 
EBS 
3K 
IOPS 
(burst, 
PIOPS 
available) 
– My 
Mac 
SSD 
does 
49K 
IOPS 
• 1000Mbps 
network 
max 
transfer 
~125MB/s 
– My 
Mac 
does 
400+ 
MB/s 
Sequen.al 
Write 
to 
SSD 
Reference 
for 
Mac 
sta.s.cs: 
bit.ly/1GJZH8 
14/10/2014 
@danielbryantuk
Thou 
Shalt 
Know 
they 
Cloud… 
“Everything 
fails 
all 
the 
<me 
[in 
the 
cloud]” 
Werner 
Vogels, 
CTO, 
Amazon.com 
• Everything 
is 
ephemeral 
• Vola.lity 
• Noisy 
(virtual) 
neighbours 
– bit.ly/1w1HQy7 
14/10/2014 
@danielbryantuk
Thinking/Ac.ng 
Opera.onally 
• Cul.vate 
“Mechanical 
Sympathy” 
• Virtualisa.on 
– Tech 
Target 
(bit.ly/1kDVqyG) 
• Networking 
– ‘Unix 
and 
Linux 
System 
Administra.on 
Handbook’ 
– aws.amazon.com/documenta.on 
14/10/2014 
@danielbryantuk
Thinking/Ac.ng 
Opera.onally 
• Learn 
Linux 
fundamentals 
• Diagnos.c 
skills 
– top, 
netstat, 
vmstat, 
tcpdump 
– Java 
u.ls: 
jps, 
jstat, 
jmap, 
jhat 
– “DevOps 
Troubleshoo.ng” 
by 
K. 
Rankin 
14/10/2014 
@danielbryantuk
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
Monitor 
All 
The 
Things! 
• Infrastructure 
monitoring 
– Nagios 
/ 
Zabbix 
– AppDynamics 
• Distributed 
Tracing 
– twi`er.github.io/zipkin 
• Centralised 
Logging 
– logstash.net 
14/10/2014 
@danielbryantuk
Component 
Metrics 
• Dropwizard’s 
Metrics 
– metrics.codahale.com 
– Spring 
Boot 
(bit.ly/1rGo76V) 
• NePlix’s 
Servo 
– github.com/NePlix/servo 
• Etsy’s 
StatsD 
– github.com/etsy/statsd/wiki 
14/10/2014 
@danielbryantuk
Health 
Checks 
14/10/2014 
@danielbryantuk
Gauges, 
Counters, 
Meters, 
Timers… 
14/10/2014 
@danielbryantuk
Graph 
It! 
14/10/2014 
@danielbryantuk 
dashing.io
14/10/2014 
@danielbryantuk 
Phrase 
borrowed 
from 
Etsy!
14/10/2014 
@danielbryantuk
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
An.fragile 
• The 
opposite 
of 
fragile? 
– Robust… 
– An.fragile… 
• NePlix 
are 
best-­‐in-­‐class 
– bit.ly/1gs5n3q 
• System 
must 
be 
robust 
first! 
14/10/2014 
@danielbryantuk
Design 
for 
Failure 
• Distributed 
Compu.ng 
Principles 
– ‘For 
young 
bloods’ 
(bit.ly/1pKVepz) 
– NePlix 
(bit.ly/1h5GMid) 
• Design 
pa`erns 
– Timeouts 
/ 
retries 
– Bulkheads 
/ 
circuit-­‐breakers 
14/10/2014 
@danielbryantuk
Retries 
14/10/2014 
@danielbryantuk 
github.com/rholder/guava-­‐retrying
Circuit-­‐breaker 
14/10/2014 
@danielbryantuk 
github.com/NePlix/Hystrix 
github.com/NePlix/Hystrix/tree/master/hystrix-­‐contrib/hystrix-­‐javanica 
java.dzone.com/ar.cles/hystrix-­‐and-­‐spring-­‐boot 
projects.spring.io/spring-­‐cloud/
An.fragile 
Pa`erns: 
Async 
FTW 
Asynchronous 
Communica.on 
-­‐ 
queues, 
pub/sub 
Command 
Query 
Responsibility 
Segrega.on 
(CQRS) 
Event 
Sourcing 
(ES) 
mar.nfowler.com/bliki/CQRS.html 
14/10/2014 
@danielbryantuk
An.fragile 
Pa`erns: 
Respect 
the 
CAP 
Eventual 
consistency 
(ACID 
vs 
BASE) 
Clever 
caching 
(soG-­‐state) 
en.wikipedia.org/wiki/CAP_theorem 
cloudshankar.blogspot.co.uk/2013/05/eventual-­‐consistency.html 
www.dataversity.net/acid-­‐vs-­‐base-­‐the-­‐shiGing-­‐ph-­‐of-­‐database-­‐transac.on-­‐processing/ 
14/10/2014 
@danielbryantuk
An.fragile 
Pa`erns: 
Elas.c 
Scaling 
Stateless 
components 
Distributed 
data 
stores 
/ 
caches 
14/10/2014 
@danielbryantuk
So, 
Cloud 
Apps 
are 
‘done’ 
when… 
Documented 
(just 
enough) 
Highly 
cohesive/loosely 
coupled 
(all 
the 
way 
down) 
Automated 
from 
commit 
to 
Cloud 
Resource 
aware 
Monitored 
thoroughly 
An.fragile 
14/10/2014 
@danielbryantuk
Thanks 
For 
Listening 
• Massive 
thanks 
to 
all 
the 
OpenCredo 
team! 
• Ques.ons 
/ 
comments? 
– daniel.bryant@opencredo.com 
– @danielbryantuk 
14/10/2014 
@danielbryantuk

More Related Content

PPTX
JavaOne 2014: Cloud Developer's DHARMA: Redefining 'done' for Cloud applications
PPTX
LJC: "Chuck Norris Doesn't Do DevOps...but Java developers might benefit"
PPTX
LJC 05/14 "Cloud Developer's DHARMA"
PDF
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
PDF
Cooking with Chef, Knife, Vagrant and Co
PPTX
LSCC 2014 "Crafting DevOps: Applying Software Craftsmanship to DevOps"
PDF
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
PDF
Jenkins Shared Libraries
JavaOne 2014: Cloud Developer's DHARMA: Redefining 'done' for Cloud applications
LJC: "Chuck Norris Doesn't Do DevOps...but Java developers might benefit"
LJC 05/14 "Cloud Developer's DHARMA"
DevoxxUK 2014 "Moving to a DevOps Mode: Easy, Hard, or Just Plain Terrifying?"
Cooking with Chef, Knife, Vagrant and Co
LSCC 2014 "Crafting DevOps: Applying Software Craftsmanship to DevOps"
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
Jenkins Shared Libraries

Similar to Building effective Java applications for the Cloud: The DHARMA principles - Daniel Bryant (20)

PPTX
JAX London 2014 "Building Java Applications for the Cloud: The DHARMA princip...
PPTX
muCon 2014 "Building Java Microservices for the Cloud"
PPTX
LJC Mashup "Building Java Microservices for the Cloud && Chuck Norris Doesn't...
PDF
BETA: "Cloud Developers DHARMA: Redefining 'done' for Cloud applications"
PDF
Promise of DevOps
PPTX
Kubernetes Infra 2.0
PPTX
Devops architecture
PPTX
J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"
PDF
Confoo - DevOps & Agile Infrastructure
KEY
Nuxeo on the Cloud - Nuxeo World 2011
PDF
Yale Jenkins Show and Tell
PDF
CNCF Webinar Series: "Creating an Effective Developer Experience on Kubernetes"
PDF
Getting to Walk with DevOps
PPTX
DevOps introduction helpful present.pptx
PPTX
Cloud Orchestration is Broken
PDF
Architecting for the Cloud using NetflixOSS - Codemash Workshop
PDF
Migrating to Public Cloud
PDF
Infrastructure as Code
PDF
Cloud Native Dünyada CI/CD
PPTX
Cloud Native Transformation (Alexis Richardson) - Continuous Lifecycle 2018 ...
JAX London 2014 "Building Java Applications for the Cloud: The DHARMA princip...
muCon 2014 "Building Java Microservices for the Cloud"
LJC Mashup "Building Java Microservices for the Cloud && Chuck Norris Doesn't...
BETA: "Cloud Developers DHARMA: Redefining 'done' for Cloud applications"
Promise of DevOps
Kubernetes Infra 2.0
Devops architecture
J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"
Confoo - DevOps & Agile Infrastructure
Nuxeo on the Cloud - Nuxeo World 2011
Yale Jenkins Show and Tell
CNCF Webinar Series: "Creating an Effective Developer Experience on Kubernetes"
Getting to Walk with DevOps
DevOps introduction helpful present.pptx
Cloud Orchestration is Broken
Architecting for the Cloud using NetflixOSS - Codemash Workshop
Migrating to Public Cloud
Infrastructure as Code
Cloud Native Dünyada CI/CD
Cloud Native Transformation (Alexis Richardson) - Continuous Lifecycle 2018 ...
Ad

More from JAXLondon2014 (20)

PDF
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
PDF
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
PPTX
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
PDF
Conditional Logging Considered Harmful - Sean Reilly
PDF
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
PPT
API Management - a hands on workshop - Paul Fremantle
PDF
'Bootiful' Code with Spring Boot - Josh Long
PDF
The Full Stack Java Developer - Josh Long
PDF
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
PDF
Dataflow, the Forgotten Way - Russel Winder
PDF
Habits of Highly Effective Technical Teams - Martijn Verburg
PDF
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
PPTX
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
PDF
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
PDF
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
PDF
Spocktacular Testing - Russel Winder
PDF
Server Side JavaScript on the Java Platform - David Delabassee
PDF
Reflection Madness - Dr. Heinz Kabutz
PDF
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
PDF
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
GridGain 6.0: Open Source In-Memory Computing Platform - Nikita Ivanov
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
How to randomly access data in close-to-RAM speeds but a lower cost with SSD’...
Conditional Logging Considered Harmful - Sean Reilly
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
API Management - a hands on workshop - Paul Fremantle
'Bootiful' Code with Spring Boot - Josh Long
The Full Stack Java Developer - Josh Long
The Economies of Scaling Software - Josh Long and Abdelmonaim Remani
Dataflow, the Forgotten Way - Russel Winder
Habits of Highly Effective Technical Teams - Martijn Verburg
The Lazy Developer's Guide to Cloud Foundry - Holly Cummins
Testing within an Agile Environment - Beyza Sakir and Chris Gollop
Testing the Enterprise Layers - the A, B, C's of Integration Testing - Aslak ...
Squeezing Performance of out of In-Memory Data Grids - Fuad Malikov
Spocktacular Testing - Russel Winder
Server Side JavaScript on the Java Platform - David Delabassee
Reflection Madness - Dr. Heinz Kabutz
Rapid Web Application Development with MongoDB and the JVM - Trisha Gee
Pushing Java EE outside of the Enterprise: Home Automation and IoT - David De...
Ad

Recently uploaded (20)

PPTX
An Unlikely Response 08 10 2025.pptx
PPTX
Impressionism_PostImpressionism_Presentation.pptx
PPTX
Human Mind & its character Characteristics
PPTX
Understanding-Communication-Berlos-S-M-C-R-Model.pptx
PPTX
fundraisepro pitch deck elegant and modern
DOCX
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
DOC
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
PPTX
Relationship Management Presentation In Banking.pptx
PDF
Instagram's Product Secrets Unveiled with this PPT
PPTX
worship songs, in any order, compilation
PPTX
Emphasizing It's Not The End 08 06 2025.pptx
PPTX
Role and Responsibilities of Bangladesh Coast Guard Base, Mongla Challenges
PDF
Parts of Speech Prepositions Presentation in Colorful Cute Style_20250724_230...
PPTX
Hydrogel Based delivery Cancer Treatment
PPTX
Introduction to Effective Communication.pptx
PDF
Nykaa-Strategy-Case-Fixing-Retention-UX-and-D2C-Engagement (1).pdf
PPTX
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
PPTX
Self management and self evaluation presentation
PPTX
Primary and secondary sources, and history
PPTX
Tour Presentation Educational Activity.pptx
An Unlikely Response 08 10 2025.pptx
Impressionism_PostImpressionism_Presentation.pptx
Human Mind & its character Characteristics
Understanding-Communication-Berlos-S-M-C-R-Model.pptx
fundraisepro pitch deck elegant and modern
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
Relationship Management Presentation In Banking.pptx
Instagram's Product Secrets Unveiled with this PPT
worship songs, in any order, compilation
Emphasizing It's Not The End 08 06 2025.pptx
Role and Responsibilities of Bangladesh Coast Guard Base, Mongla Challenges
Parts of Speech Prepositions Presentation in Colorful Cute Style_20250724_230...
Hydrogel Based delivery Cancer Treatment
Introduction to Effective Communication.pptx
Nykaa-Strategy-Case-Fixing-Retention-UX-and-D2C-Engagement (1).pdf
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
Self management and self evaluation presentation
Primary and secondary sources, and history
Tour Presentation Educational Activity.pptx

Building effective Java applications for the Cloud: The DHARMA principles - Daniel Bryant

  • 1. Building Java applica.ons for the Cloud: The DHARMA principles Daniel Bryant Principal Consultant, Open Credo daniel.bryant@opencredo.com @danielbryantuk
  • 2. What to expect • Problems when developing for the Cloud – “LiG and shiG” – Smashing the monolith – Greenfield (“Cloud na.ve”) • Some sugges.ons on where to focus efforts – Not specific plaPorm/framework reviews • Tools and techniques • Lots of informa.on… (slides will be available) 14/10/2014 @danielbryantuk
  • 3. Who Am I? • LJC • Principal Associate • Adopt Consultant at OpenCredo ü Agile transforma.ons ü DevOps ü Microservices and Cloud OpenJDK and JSR 14/10/2014 @danielbryantuk
  • 4. The Current Industry Wish List… • Service-­‐Oriented Architecture • Cloud-­‐based deployments • DevOps Culture 14/10/2014 @danielbryantuk
  • 5. The Current Industry Wish List… • Service-­‐Oriented Architecture – Twi`er’s Story (bit.ly/1j1WbmI) • Cloud-­‐based deployments – Today! • DevOps Culture – Devoxx UK talk (bit.ly/1BylnZb) – Previous LJC Event (bit.ly/1elVPJz) 14/10/2014 @danielbryantuk
  • 6. Common Cloud Problems TL;DR… 14/10/2014 @danielbryantuk
  • 7. Not respec<ng the underlying environment 14/10/2014 @danielbryantuk
  • 8. Lack of applica<on/plaDorm monitoring… 14/10/2014 @danielbryantuk
  • 9. Bizarre failure modes… 14/10/2014 @danielbryantuk
  • 10. Difficulty in understanding the new architecture 14/10/2014 @danielbryantuk
  • 11. Confusion over environment provisioning and config 14/10/2014 @danielbryantuk
  • 12. Not tes<ng in the Cloud… (hint: here be dragons!) 14/10/2014 @danielbryantuk
  • 13. We’ve created the “Cloud DHARMA Principles” to act as a checklist when building Cloud apps 14/10/2014 @danielbryantuk
  • 14. 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) 14/10/2014 @danielbryantuk
  • 15. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 16. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 18. Documenta.on (just enough) • Provide a map for developers • Component purpose (and contract) • Ini.alisa.on instruc.ons (mocks/stubs) • Highlights areas of opera.onal risk 14/10/2014 @danielbryantuk
  • 19. Simon Brown’s C4 Model 14/10/2014 @danielbryantuk www.codingthearchitecture.com
  • 22. API Docs with Swagger 14/10/2014 @danielbryantuk helloreverb.com/developers/swagger
  • 23. Create a PACT 14/10/2014 @danielbryantuk github.com/DiUS/pact-­‐jvm
  • 24. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 25. High Cohesion / Loose Coupling (all the way down…) • Code • Architecture – Components – Services • Public API – PayPal (bit.ly/1hnZNly) 14/10/2014 @danielbryantuk
  • 26. Smashing the Monolith… • Business func.onality -­‐“Cart Service” • Technology chunk -­‐ “Email Service” • Ver.cal Slice – “Registra.on” (Groupon: vimeo.com/105880150) • Horizontal Slice – “User Repo” (Microservices: oreil.ly/1pp6qmx) 14/10/2014 @danielbryantuk
  • 27. Microservices • Probably won’t catch on… ;-­‐) 14/10/2014 @danielbryantuk
  • 28. Twelve Factor Apps 14/10/2014 @danielbryantuk h`p://12factor.net/
  • 29. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 30. Automated from Commit to Cloud • Con.nuous Integra.on • Con.nuous Deployment • Con.nuous Delivery 14/10/2014 @danielbryantuk
  • 31. 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 14/10/2014 @danielbryantuk
  • 32. Our Build Pipeline • Component Build – Compile – Unit Tests (surefire) – Integra.on Tests (failsafe) • Deployment onto QA Cloud – Python Scripts + Chef to provision – Verify success using Python – Serverspec serverspec.org 14/10/2014 @danielbryantuk
  • 33. Our Build Pipeline • Acceptance Tests – Cucumber (and Selenium) • Performance Tests – Jmeter + Jenkins performance plugin – Make sure environment is realis.c!! • Live Deployment? 14/10/2014 @danielbryantuk
  • 34. Automa.ng QA • Intra-­‐component integra.on tes.ng – U.lise embedded datastore/middleware – “Scassandra” (github.com/scassandra) – Service virtualisa.on (www.mbtest.org) • Inter-­‐component integra.on tes.ng – The hardest part of SOA… – Consider ‘synthe.c txns’ (ac.ve monitoring) 14/10/2014 @danielbryantuk
  • 35. Infrastructure: Say No To Snowflakes! • Automate all provisioning (store in SCM) • Fry... – Chef, Puppet, SaltStack, Ansible – Bash, Python (Fabric) – Vendor APIs • …or bake? – Packer.io – NePlix Aminator 14/10/2014 @danielbryantuk
  • 36. Infrastructure: Say No To Snowflakes! • Doing “Proper Development” – Gareth Rushgrove at CraG Conf (bit.ly/1njuc49) – Chef Conf (www.youtube.com/user/getchef) • Local tooling/tes.ng – Vagrant (www.vagrantup.com) – Docker (www.docker.io) 14/10/2014 @danielbryantuk
  • 37. Configuring the Cloud • Bundle config with app – Upload new config file – Re-­‐deploy en.re app (easier with Docker?) • Store externally – Zookeeper & Curator curator.apache.org – NePlix Archaius github.com/NePlix/archaius – etcd github.com/coreos/etcd – Consul.io www.consul.io 14/10/2014 @danielbryantuk
  • 38. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 39. Deployment PlaPorm: What you’ve got… 14/10/2014 @danielbryantuk
  • 40. What you think you want… 14/10/2014 @danielbryantuk
  • 41. What you actually get… Fact: 9 out of 10 cheetahs prefer the taste of an Ops team over <nned food 14/10/2014 @danielbryantuk
  • 42. Thou Shalt Know thy Cloud… • AWS “Magne.c” EBS 100 IOPS – New SSD EBS 3K IOPS (burst, PIOPS available) – My Mac SSD does 49K IOPS • 1000Mbps network max transfer ~125MB/s – My Mac does 400+ MB/s Sequen.al Write to SSD Reference for Mac sta.s.cs: bit.ly/1GJZH8 14/10/2014 @danielbryantuk
  • 43. Thou Shalt Know they Cloud… “Everything fails all the <me [in the cloud]” Werner Vogels, CTO, Amazon.com • Everything is ephemeral • Vola.lity • Noisy (virtual) neighbours – bit.ly/1w1HQy7 14/10/2014 @danielbryantuk
  • 44. Thinking/Ac.ng Opera.onally • Cul.vate “Mechanical Sympathy” • Virtualisa.on – Tech Target (bit.ly/1kDVqyG) • Networking – ‘Unix and Linux System Administra.on Handbook’ – aws.amazon.com/documenta.on 14/10/2014 @danielbryantuk
  • 45. Thinking/Ac.ng Opera.onally • Learn Linux fundamentals • Diagnos.c skills – top, netstat, vmstat, tcpdump – Java u.ls: jps, jstat, jmap, jhat – “DevOps Troubleshoo.ng” by K. Rankin 14/10/2014 @danielbryantuk
  • 46. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 47. Monitor All The Things! • Infrastructure monitoring – Nagios / Zabbix – AppDynamics • Distributed Tracing – twi`er.github.io/zipkin • Centralised Logging – logstash.net 14/10/2014 @danielbryantuk
  • 48. Component Metrics • Dropwizard’s Metrics – metrics.codahale.com – Spring Boot (bit.ly/1rGo76V) • NePlix’s Servo – github.com/NePlix/servo • Etsy’s StatsD – github.com/etsy/statsd/wiki 14/10/2014 @danielbryantuk
  • 49. Health Checks 14/10/2014 @danielbryantuk
  • 50. Gauges, Counters, Meters, Timers… 14/10/2014 @danielbryantuk
  • 51. Graph It! 14/10/2014 @danielbryantuk dashing.io
  • 52. 14/10/2014 @danielbryantuk Phrase borrowed from Etsy!
  • 54. Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 55. An.fragile • The opposite of fragile? – Robust… – An.fragile… • NePlix are best-­‐in-­‐class – bit.ly/1gs5n3q • System must be robust first! 14/10/2014 @danielbryantuk
  • 56. Design for Failure • Distributed Compu.ng Principles – ‘For young bloods’ (bit.ly/1pKVepz) – NePlix (bit.ly/1h5GMid) • Design pa`erns – Timeouts / retries – Bulkheads / circuit-­‐breakers 14/10/2014 @danielbryantuk
  • 57. Retries 14/10/2014 @danielbryantuk github.com/rholder/guava-­‐retrying
  • 58. Circuit-­‐breaker 14/10/2014 @danielbryantuk github.com/NePlix/Hystrix github.com/NePlix/Hystrix/tree/master/hystrix-­‐contrib/hystrix-­‐javanica java.dzone.com/ar.cles/hystrix-­‐and-­‐spring-­‐boot projects.spring.io/spring-­‐cloud/
  • 59. An.fragile Pa`erns: Async FTW Asynchronous Communica.on -­‐ queues, pub/sub Command Query Responsibility Segrega.on (CQRS) Event Sourcing (ES) mar.nfowler.com/bliki/CQRS.html 14/10/2014 @danielbryantuk
  • 60. An.fragile Pa`erns: Respect the CAP Eventual consistency (ACID vs BASE) Clever caching (soG-­‐state) en.wikipedia.org/wiki/CAP_theorem cloudshankar.blogspot.co.uk/2013/05/eventual-­‐consistency.html www.dataversity.net/acid-­‐vs-­‐base-­‐the-­‐shiGing-­‐ph-­‐of-­‐database-­‐transac.on-­‐processing/ 14/10/2014 @danielbryantuk
  • 61. An.fragile Pa`erns: Elas.c Scaling Stateless components Distributed data stores / caches 14/10/2014 @danielbryantuk
  • 62. So, Cloud Apps are ‘done’ when… Documented (just enough) Highly cohesive/loosely coupled (all the way down) Automated from commit to Cloud Resource aware Monitored thoroughly An.fragile 14/10/2014 @danielbryantuk
  • 63. Thanks For Listening • Massive thanks to all the OpenCredo team! • Ques.ons / comments? – daniel.bryant@opencredo.com – @danielbryantuk 14/10/2014 @danielbryantuk