Betting on Software Architecture as Code a note on hypothesis-driven - - PowerPoint PPT Presentation

betting on software architecture as code
SMART_READER_LITE
LIVE PREVIEW

Betting on Software Architecture as Code a note on hypothesis-driven - - PowerPoint PPT Presentation

Betting on Software Architecture as Code a note on hypothesis-driven architecture James Lewis : @boicy Betting on Software Architecture as Code Software architecture is those decisions which are both important and hard to change Martin


slide-1
SLIDE 1

Betting on Software Architecture as Code

a note on hypothesis-driven architecture

James Lewis : @boicy

slide-2
SLIDE 2

Betting on Software Architecture as Code

“Software architecture is those decisions which are both important and hard to change”

Martin Fowler* * but may have been said earlier by Ralph Johnson (or even by someone in this room!)

slide-3
SLIDE 3

Betting on Software Architecture as Code

“Software architecture is those decisions which are both important and hard to change”

Martin Fowler* * but may have been said earlier by Ralph Johnson (or even by someone in this room!)

Programming language Domain Application Protocol Process Boundaries Integration protocol Hardware Environment Deployment Topology

slide-4
SLIDE 4

What happens if these properties become easy to change?

slide-5
SLIDE 5

Betting on Software Architecture as Code

“Software architecture is those decisions which are both important and hard to change”

Martin Fowler* * but may have been said earlier by Ralph Johnson (or even by someone in this room!)

Programming language Domain Application Protocol Process Boundaries Integration protocol Hardware Environment Deployment Topology

slide-6
SLIDE 6

How do we usually make decisions about these things?

based on experience based on gut feel and often times up front

slide-7
SLIDE 7

Can we make decisions more systematically?

and what would that look like?

more cheaply

slide-8
SLIDE 8 4
slide-9
SLIDE 9
slide-10
SLIDE 10
slide-11
SLIDE 11
slide-12
SLIDE 12

History

The lawful good product owners of the publishing house had long lived in awe and fear of their publishing systems. In awe, for they had made a tremendous amount of Gold, but in fear of the time taken to change them, their slowness and their fragility. A messenger was sent to fetch help from a distant land famed for it’s mighty wizards. You have taken up the challenge…

link to close link hello close

slide-13
SLIDE 13

1.

You must save the product owners by rebuilding their website. You start off the project. In the course of discussions you discover that your goals are three fold:

  • 1. improve availability
  • 2. improve performance
  • 3. reduce the cost of delay

An Enterprise Architect approaches and addresses you. You may use:

Summon Walking Skeleton

?

turn to 4 Analysis Paralysis turn to 3

If you have none of these you will have to draw your sword and fight (turn to 178)

link to close link hello close

slide-14
SLIDE 14

CFR maturity model

slide-15
SLIDE 15
  • 1. ???

We’ve never heard of this…

  • 2. New

We know what it is but don’t have any understanding of the requirements for the project

  • 3. Requirements Understood

We have defined specific requirements related to this risk / area

  • 4. Requirements Measurable

We are able to give numbers, or other specific information that enables us to measure if we are fulfilling the requirements

  • 5. Requirements demonstrably met

We can demonstrate to you through automated / manual tests or otherwise that we have satisfied the requirements for this area of risk

CFR maturity model

slide-16
SLIDE 16

High Low Low High Impact Maturity I like to have this as a BVC on the wall (postits natch)

slide-17
SLIDE 17

Akamai AWS DAYTON Article Store S3 Article Rendering Preference Service Usage Service Entitlements Customer Related Content Recommendations science/article/pii/ <id> Session Usage A&E Chief Scopus HPCC PDF Store Content Metadata FAST search Search REST REST REST REST REST REST REST SOAP REST ASYNC REST REST REST REST REST REST REST REST

We started off thinking it would look a bit like this

slide-18
SLIDE 18

1.

You must save the product owners by rebuilding their website. You start off the project. In the course of discussions you discover that your goals are three fold:

  • 1. improve availability
  • 2. improve performance
  • 3. reduce the cost of delay

An Enterprise Architect approaches and addresses you. You may use:

Summon Walking Skeleton

?

turn to 4 Analysis Paralysis turn to 3

If you have none of these you will have to draw your sword and fight (turn to 178)

link to close link hello close

slide-19
SLIDE 19

3.

You cast Analysis Paralysis at the Enterprise Architect. “Foolish young adventurer” says the architect, “we follow the evolutionary school of architecture and we shall have none of the lawful-evil ways of waterfall”. The last thing you see before everything goes dark is the architect incanting in a strange voice. You have died. Turn to page 1.

link to close link hello close

slide-20
SLIDE 20

1.

You must save the product owners by rebuilding their website. You start off the project. In the course of discussions you discover that your goals are three fold:

  • 1. improve availability
  • 2. improve performance
  • 3. reduce the cost of delay

An Enterprise Architect approaches and addresses you. You may use:

Summon Walking Skeleton

?

turn to 4 Analysis Paralysis turn to 3

If you have none of these you will have to draw your sword and fight (turn to 178)

link to close link hello close

slide-21
SLIDE 21

4.

Your walking skeleton coalesces in a cloud of noxious gasses and solidifies as a java dropwizard application. You reach into your backpack and deploy the content store. Your walking skeleton reaches out it’s skeletal arms and grabs armfuls of raw xml. Would you like to:

S3

Transform the xml inside the skeleton turn to 6 Use a magic box turn to 5

link to close link hello close

slide-22
SLIDE 22

monolithic MVC

  • app. All logic,

transformations and rendering happen in process distributed system Transform content within the walking skeleton create another service to transform content

slide-23
SLIDE 23

So how do you decide which path to follow?

slide-24
SLIDE 24

Betting on Software Architecture as Code

slide-25
SLIDE 25

Betting on Software Architecture as Code

slide-26
SLIDE 26

Option Option Option $ $ $ Evolutionary Architecture allows us to place small bets and then re- evaluate our decisions based on outcomes Option Option Option $ $$$$$$$$$ $ Up front design “bets the house”. It collapses the options by presupposing the answer (and that there is an answer)

slide-27
SLIDE 27

Back to 1961…

slide-28
SLIDE 28

What did the Gantt chart for the Apollo moon landing program look like?

slide-29
SLIDE 29

Design Saturn V Build Saturn V

Launch

Land

Tea and biscuits*

Zoom through space

May 25th, 1961 18th July, 1969

*blocks not to scale apart from tea and biscuits

What did the Gantt chart for the Apollo moon landing program look like?

slide-30
SLIDE 30

President Kennedy’s speech tea and biscuits

slide-31
SLIDE 31
slide-32
SLIDE 32

Can humans survive in space for long enough to get to the moon (and back!)? Can we dock a spacecraft with another? Can we even get to the moon? How do we get the returning spacecraft to land at a pre selected location? What the heck are we going to find when we are there? Is it safe to land on the surface?

slide-33
SLIDE 33

Ranger 1, launched 23 August 1961, lunar prototype, launch failure Ranger 2, launched 18 November 1961, lunar prototype, launch failure Ranger 3, launched 26 January 1962, lunar probe, spacecraft failed, missed Moon Ranger 4, launched 23 April 1962, lunar probe, spacecraft failed, impact Ranger 5, launched 18 October 1962, lunar probe, spacecraft failed, missed Ranger 6, launched 30 January 1964, lunar probe, impact, cameras failed Ranger 7, Impacted Moon 31 July 1964 at 13:25:49 UT Ranger 8, Impacted Moon 20 February 1965 at 09:57:37 UT Ranger 9, Impacted Moon 24 March 1965 at 14:08:20 UT Ranger missions (1961 - 1965) Can we even get to the moon?

slide-34
SLIDE 34

Gemini missions (1962 - 1966) How long can humans survive in space? Can we dock one spacecraft with another? How do we get the returning spacecraft to land at a pre selected location?

slide-35
SLIDE 35

Surveyor missions (1962 - 1966) Is it safe to land on the surface?

slide-36
SLIDE 36
slide-37
SLIDE 37

What did the Gant chart* for the Apollo moon landing programme look like?

Design Saturn V Build Saturn V

Launch

Land

Tea and biscuits

Zoom through space

May 25th, 1961 18th July, 1969

*blocks not to scale X

slide-38
SLIDE 38
slide-39
SLIDE 39

Back to 1945…

slide-40
SLIDE 40
slide-41
SLIDE 41

“He (General Groves) had to begin building before he knew precisely what to build. He worked from the general to particular, from outline to detail.”

slide-42
SLIDE 42

gaseous diffusion EM separation

slide-43
SLIDE 43
slide-44
SLIDE 44

Forward to 2011…

slide-45
SLIDE 45

How to land on Mars? How to test

slide-46
SLIDE 46

What do these great endeavours have in common? High Risk (losing people, losing a war, losing a billion dollar lander) Putting a person on the moon (and getting them home!): Multiple parallel streams of work, rapid experimentation to solve individually identified problems Hard to test (don’t want to lose people, can’t use redundancy, new science) Curiosity: Simulations, Models Manhattan: Concurrent set based engineering, working with imperfect information, simulations, models (monte carlo came from Los Alamos)

slide-47
SLIDE 47 47

to overcome seemingly insurmountable obstacles they created options and ran experiments

slide-48
SLIDE 48

All of these are examples of creating options placing bets for only the money we can afford to lose which is a great risk reduction technique But it actually gets better than that. Because options have value

slide-49
SLIDE 49
slide-50
SLIDE 50

Black–Scholes 𝜏 term is volatility - traders like volatility

slide-51
SLIDE 51

‘10 ‘11 ‘12 ‘13 ‘14 ‘15 ‘16

DVCS JS as a first class language CD, EA, ED, build pipelines Google Wave Git in trial Clojure, Scala Neo4J, Mongo, Triple Stores CD, EA, ED, Polyglot dev Azure off Hold Visualisation & metrics NoSql JVM as a Platform Using basic web techniques effectively Diversity and depth in Cloud Focus on CD and tools to deliver it New approaches to BI Simple techniques for performance testing Better tools for dev and test of Mobile Smaller, simpler faster applications and services Increasing diversification and rigour in browser based languages Treat all code with respect (from UI to tests) Continued development of SQL alts Data persistence done right Reproducible environments Simple Architectures Accessible analytics Mobile (!) Infrastructure as code Lightweight options for analytics Applying proven practices to areas that missed them Falling boundaries and perimeterless enterprise Merging of Physical and Digital The JS juggxrnaught rolls on Privacy and big data Early warning and recovery in prod Churn in the JS world Conway’s Law Microservices and the rise of the API Redecentralisation Devs focus on security minded tooling Next gen data platforms gain traction (ML) Explosive growth in the Devops arena Security struggles continue in the enterprise A new wave of openness at Microsoft Innovation in architectures (ms and cloud native) Security is everybody’s problem JS tooling settles to merely chaotic Microservices and related tools continue to gain in popularity Docker incites container explosion Over Reactive? DOCKER! DOCKER! DOCKER! Parsing the PaaS puzzle OSS as a virtuous by product

‘17

Microservices as programming model Intelligent Empowerment Holistic effect of team structure AR and VR easing to mainstream Conversational UI and natural language Intelligence as a Service Developer experience as differentiator Rise of the Platforms Pervasive Python

slide-52
SLIDE 52

So by creating options we not only reduce risk but also take advantage of volitility

slide-53
SLIDE 53

back to the story

slide-54
SLIDE 54

5.

You throw the magic box in between the walking skeleton and the content store. A villager approaches and exclaims: “this beautiful content I see in front

  • f me seems to take an awful long

time to get here” You must somehow make the content arrive faster. If you have a http cache in your inventory, you may use it now.

S3

Cache in between S3 and content turn to 10

content

Cache in between skeleton and content turn to 33

link to close link hello close

slide-55
SLIDE 55

ESI / Templating

Computationally expensive service

  • ther service
  • ther service

XML in S3 Xslt

slide-56
SLIDE 56

0.8 seconds for first byte 1.5 seconds for page load

slide-57
SLIDE 57

Page Load (sec) 10 20 30 40 Initial observations 1 35

0.8 seconds for first byte 1.5 seconds for page load

slide-58
SLIDE 58

ESI / Templating

Computationally expensive service

  • ther service
  • ther service

XML in S3 Xslt

slide-59
SLIDE 59

We’ve detected performance problems

slide-60
SLIDE 60

lets just add a cache

slide-61
SLIDE 61

ESI / Templating

Computationally expensive service

  • ther service
  • ther service

XML in S3 Xslt

slide-62
SLIDE 62

ESI / Templating

Computationally expensive service

  • ther service
  • ther service

XML in S3 Xslt

slide-63
SLIDE 63

Page Load (secs)

Cache misses predominate

Page Load (secs)

Cache hits predominate

slide-64
SLIDE 64

There are only two hard things in Computer Science: cache invalidation and naming things.

  • - Phil Karlton

Bonus Joke

There are only two hard things in messaging:

  • 2. Exactly Once Delivery
  • 1. Delivery Order
  • 2. Exactly Once Delivery
slide-65
SLIDE 65

said no one ever

lets just add a cache

slide-66
SLIDE 66

Betting on Software Architecture as Code

a note on hypothesis-driven architecture

slide-67
SLIDE 67

a note on hypothesis-driven architecture

slide-68
SLIDE 68

“In general, we look for a new law by the following process: First we guess it; then we compute the consequences of the guess to see what would be implied if this law that we guessed is right; then we compare the result of the computation to nature, with experiment or experience, compare it directly with

  • bservation, to see if it works. If it disagrees with experiment,

it is wrong. In that simple statement is the key to science. It does not make any difference how beautiful your guess is, it does not make any difference how smart you are, who made the guess, or what his name is — if it disagrees with experiment, it is wrong”

How do we decide what bets to place?

slide-69
SLIDE 69

Compute implications Compare with Nature Draw conclusion Observe nature Make a guess

slide-70
SLIDE 70

Compute implications Compare with Nature Draw conclusion Observe nature Make a guess

Observe metrics Measure results Was I right? Make a small change Guess

slide-71
SLIDE 71

Compute implications Compare with Nature Draw conclusion Observe nature Make a guess

Lightweight probes Ability to quickly deploy small changes Observable systems A brain

slide-72
SLIDE 72

practices that enable small bets* *not exhaustive

slide-73
SLIDE 73

Good Monitoring

slide-74
SLIDE 74

What do we mean when we say “monitoring”?

slide-75
SLIDE 75

What do we mean when we say “monitoring”?

Instrumentation Telemetry Visualisation Alerting Predictive alerting

Our code and hardware describes what it’s doing We have a way of gathering the data from our services We can meaningfully visualise our systems behaviour We can take action based on this information We can predict in advance when something may go wrong

credit: Dan North

slide-76
SLIDE 76

Service Service request latency downstream dependencies OS metrics health request tracing

slide-77
SLIDE 77

Codahale Metrics Dropwizard Tenacity Circuit Breakers Breaker Box Yammer Chaos Monkey

slide-78
SLIDE 78
slide-79
SLIDE 79
slide-80
SLIDE 80

Continuous Delivery

Safely and sustainably reduce lead time to value

slide-81
SLIDE 81
slide-82
SLIDE 82
slide-83
SLIDE 83

Compute implications Compare with Nature Draw conclusion Observe nature Make a guess

slide-84
SLIDE 84

https://puppet.com/resources/whitepaper/state-of-devops-report

slide-85
SLIDE 85

https://puppet.com/resources/whitepaper/state-of-devops-report

slide-86
SLIDE 86
slide-87
SLIDE 87
slide-88
SLIDE 88
slide-89
SLIDE 89

ApacheBench

ab -n 100 -c 10 “http://sciencesite.com/articles/9dfa1ae0-6ba5-4f2f-…”

Siege Vegeta

echo "GET http://sciencesite.com/“ | vegeta attack -duration=60s -rate=10

slide-90
SLIDE 90

Cloud native infrastructure as code

slide-91
SLIDE 91
slide-92
SLIDE 92

boto

slide-93
SLIDE 93

Other techniques are incredibly useful for these experiments Canary Releases

slide-94
SLIDE 94

Other techniques are incredibly useful for these experiments Phoenix environments svc svc svc svc svc svc svc svc prod prod Canary Releases

slide-95
SLIDE 95

Other techniques useful patterns Canary Releases Phoenix environments Blue / Green deploys

slide-96
SLIDE 96

Production != Live Canary Releases Phoenix environments Blue / Green deploys

slide-97
SLIDE 97

Compute implications Compare with Nature Draw conclusion Observe nature Make a guess

Lightweight probes Ability to quickly deploy small changes Good monitoring A brain

slide-98
SLIDE 98

Putting it all together AKA

slide-99
SLIDE 99
slide-100
SLIDE 100

Page Load (sec) 10 20 30 40 Initial observations 1 35

0.8 seconds for first byte 1.5 seconds for page load

slide-101
SLIDE 101
slide-102
SLIDE 102

Option: Add CPU Option: Cache S3 content Option: Cache Service content

slide-103
SLIDE 103

Compute implications Compare with Nature Draw conclusion Observe nature Make a guess XSLT can be expensive - maybe we are CPU bound Increasing the # of CPU’s could help

slide-104
SLIDE 104

Page load (sec) 10 20 30 40 After adding more CPU’s 1 2 35 6

slide-105
SLIDE 105
slide-106
SLIDE 106

Second Guess: Moving compute to the data

slide-107
SLIDE 107

Page load (sec) 10 20 30 40 Move closer to the data 1 2 3 35 6 4

slide-108
SLIDE 108

Third Guess: Transformations are slow and could be optimised

slide-109
SLIDE 109

Page load (sec) 10 20 30 40 Tune xslt transforms 1 2 3 4 35 6 4 3.5

slide-110
SLIDE 110

Final Guess: And, cache

slide-111
SLIDE 111

ESI / Templating

Computationally expensive service

  • ther service
  • ther service

XML in S3 Xslt

slide-112
SLIDE 112

Page load (sec) 10 20 30 40 After adding a cache 1 2 3 4 5 35 6 4 3.5 0.2

slide-113
SLIDE 113
slide-114
SLIDE 114

Do we add a cache? create another service to transform content

slide-115
SLIDE 115

saves the fetch from S3 saves the xslt transform time saves the fetch from S3 Cache in front of content service Cache in front of S3

slide-116
SLIDE 116

150.

Content trickles into the store. You keep up by listening for the new content and casting “wget” on the cache to keep it refreshed. New types of content appears - content the villagers have never seen

  • before. Content the walking skeleton

is unable to combat. Every time the structure of the content changes, the cache must be

  • refreshed. The cache grows and

grows until it is the size of the Great Wahui of Berathorob. It is no longer possible to refresh it. Latency increases.

link to close link hello close

You have died. Turn to page 1.

slide-117
SLIDE 117

Cache in front of S3 Cache in front of content service

slide-118
SLIDE 118

10.

The cache causes the content load times to drop from 300ms to 150ms. The villager says “this wonderful content is now arriving more swiftly than even the knight-messengers of the Empress”. The villagers are happy but all too soon, all is not well for the content has a long tail. You must work out how to refresh the content when it changes. You can either:

Refresh the content when it appears from the ether turn to 150 Trust that it will be fast enough on first view turn to 22

link to close link hello close

slide-119
SLIDE 119

4.

Your walking skeleton coalesces in a cloud of noxious gasses and solidifies as a java dropwizard application. You reach into your backpack and deploy the S3 content store. Your walking skeleton reaches out it’s skeletal arms and grabs armfuls of raw xml. Would you like to:

Transform the xml inside the skeleton turn to 6 Use a magic box turn to 5

slide-120
SLIDE 120

Real Options, Small Bets

slide-121
SLIDE 121

rapidly change all the things

Cloud Native, CD for infra

run experiments

lightweight probes for fun and profit

  • bserve nature

instrumentation, telemetry, visualisation

slide-122
SLIDE 122

Evolutionary Architecture keeps our options open Continuous Delivery, lean product engineering and Infrastructure as Code reduce the amount of money we need to place a bet (so we can place more) Lightweight experiments allow us to make guesses and test our hypotheses

slide-123
SLIDE 123

Thanks

James Lewis : @boicy

slide-124
SLIDE 124

GNU Terry Pratchett