Except where noted contents © 2014 Development Partners Software Corporation Cloud Architecture...

76
• Except where noted contents © 2014 Development Partners Software Corporation http://www.devpartners.com Cloud Architecture Anti-Patterns A concise overview of some bad ideas Bill Wilder, Finomial CTO @codingoutloud [email protected] blog.codingoutloud.com linkedin.com/in/ billwilder O’Reilly Architecture Conference 18-Mar-2015 (10:45-12:15) Room 306

Transcript of Except where noted contents © 2014 Development Partners Software Corporation Cloud Architecture...

Page 1: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

• Except where noted contents © 2014 Development Partners Software Corporation • http://www.devpartners.com •

Cloud Architecture Anti-Patterns

A concise overview of some bad ideas

Bill Wilder, Finomial CTO@codingoutloudcodingoutloud@gmail.comblog.codingoutloud.comlinkedin.com/in/billwilder

O’Reilly Architecture Conference18-Mar-2015 (10:45-12:15) Room 306

Page 2: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

• Except where noted contents © 2014 Development Partners Software Corporation • http://www.devpartners.com •

Cloud Architecture Anti-Patterns

A concise overview of some bad ideas

Bill Wilder, Finomial CTO@codingoutloudcodingoutloud@gmail.comblog.codingoutloud.comlinkedin.com/in/billwilder

O’Reilly Architecture Conference18-Mar-2015 (10:45-12:15) Room 306

Find this slide deck here

Page 3: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

• Except where noted contents © 2014 Development Partners Software Corporation • http://www.devpartners.com •

Cloud Micro-Service Anti-Patterns for the Internet of Things written in GoA certifiably buzzworthy presentation

Bill Wilder, Finomial CTO@codingoutloudcodingoutloud@gmail.comblog.codingoutloud.comlinkedin.com/in/billwilder

O’Reilly Architecture Conference18-Mar-2015 (10:45-12:15) Room 306

Page 4: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Who is Bill Wilder?

www.devpartners.com

www.bostonazure.org

www.cloudarchitecturepatterns.com

Book signing2:45 – 3:30 today

Page 5: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Lots of ♥ to all the clouds

etc…

Page 6: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

7

Page 7: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

ArchitectSkills

Technical Business Decisions

Page 8: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

9

Famous Architect: AristotleOn Properties:• Essential property = must

have • Accidental property =

happens to have but could lack

For effective software architect, all are Essential Properties

Technology Skills

Ability to Communicate

Business Awareness

Page 9: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

11

Top 10 “Blunders” by Enterprise Architects

#3. Not engaging the business partners#2. Insufficient understanding and support

from stakeholders#1. The Wrong Lead Architect (for non-

technical reasons)#7. Not … Communicating the Impact#10. Not Spending Enough Time on

Communications Source http://www.sdtimes.com/link/33787 The top 10 enterprise architecture

blunders By Alex Handy, September 25, 2009

Page 10: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

To cloud or not to cloud?

control vs. cost

Page 11: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Ctrl

€$¥

Page 12: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Ctrl

€$¥Technology Skills

Ability to Communicate

Business Awareness

Page 13: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Cloud Services … in the Cloud“who would’ve thought”

Cloud is a business innovation technology services + flexible rental model new types and combinations of services

Page 14: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

1/9th above w

ater

Services: TTM & Sleeping well

Page 15: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Treating your ops team as equivalent to the cloud

vendor’s ops team

(They are not. Let cloud vendor handle service operations. Use

services. You focus on your app.)

Anti-Pattern #1

Page 16: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

What is an Anti-Pattern

Wikipedia says: (http://en.wikipedia.org/wiki/Anti-pattern)

“A common response to a recurring problem that is usually ineffective and risks being highly counterproductive.”

Bill’s amplification:“An anti-pattern approach may seem reasonable, or actually be reasonable in other contexts. There may be problems that are not yet be apparent.” Often depends on the situation.

This talk will span:

Architecture and Architects

Page 17: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

• N-tier, SOA, μSvcs• Multi-data center• Horizontal scaling• Expects failure• Eventual consist

Traditional Cloud-Native

• 2-tier• Single data center• Vertical scaling• Ignores failure• Transactional consist

• Less flexible• More manual/attention• Less reliable (SPoF)• Maintenance window• Less scalable, more $$

• Agile/faster TTM• Auto-scaling• Self-healing• HA• Geo-LB/FO

TELL

S/CL

UES

CON

SEQ

UEN

CES

Tells: Traditional vs Cloud-Native

Which is “best” architecture?

There is no “best” architecture – it is situational, a Technical Business Decision.

Cloud-native popularity growing in proportion to the shrinking cost

and competitive benefits.

Page 18: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

One-size-fits-all architecture

Anti-Pattern #2

Page 19: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

[Cloud] Anti-Pattern Causes

• Abstraction misalignment• Not reading the fine print• Insufficient ongoing attention to cost• Insufficient ongoing attention to

automation

Page 20: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

www.pageofphotos.com (PoP)

Page 21: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Move Simple PoP App to Cloud

WHAT NOW?

Page 22: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Scalability &

Performance &

Cost&

Automation

Page 23: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Time passes…

PoP has lots of photos

Page 24: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

www.pageofphotos.com

Page 25: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

One-size-fits-all data storage

(perf, scalability, cost)

Anti-Pattern #3

Page 26: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Upgrade to scenario-specific storage

Some$, Perf, Scale

benefits

Page 27: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

PoP uses Valet Key Pattern

Even more$, Perf, Scale

benefits

Page 28: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

CDN for public content

Many, many other storage options also available: NoSQL varieties, caches, etc.

Page 29: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Always access raw data (regardless of distance, cost)

(performance, scalability, cost)

Anti-Pattern #4

Page 30: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

PoP web tier goes multi-instance…

Users experiencing login issues*

*Depending on configuration …

Page 31: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Are Cloud Resources Infinite?

“We often hear that public cloud platforms offer the illusion of infinite resources. … This does not mean each resource has infinite capacity, just that you can request as many instances of the type of resource that you need.”Page 21, my (Bill Wilder’s) Cloud Architecture Patterns book

Page 32: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Running stateful VMs in web / service tiers

(Limits horizontal scalability & complicates autoscale – but

sometimes is reasonable option)

Anti-Pattern #5

Page 33: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

I don’t have a slide on this, but …

sharding

Page 34: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Reliability

Page 35: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

PoP Adding Video Support

(uh oh!)

Page 36: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Current

Page 37: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Let’s extend PoP with a Service Tier

Page 38: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

REQUEST / RESPONSE(http + json)

OPTION 1: Request/Response Services

Serv

ices

Tie

r

Web

Tie

r

Dat

a Ti

er

Stateless StatelessServices

webbrowser

Page 39: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Coupling Between Tiers(reliability, scalability, cost)

(Situational: I frequently violate!Also relates to microservices.)

Anti-Pattern #6

Page 40: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Cloud Platform Reliable Queues

• Azure Storage or ServiceBus Queue• AWS Simple Queue Service• Google Pub/Sub

• Durable – won’t lose your data• Reliable – backed by SLA and ops team• Scalable – Internet scale• Approachable – REST + many SDKs

Page 41: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Basic Idea

ReliableQueue

WorkProducers

WorkConsumers

Page 42: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

OPTION 2: Async Services

Serv

ices

Tie

r

Web

Tie

r

Dat

a Ti

er

Stateless StatelessServices

webbrowser

push pull

Page 43: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

StatelessServices

Notice anything “missing”

?

There is no transaction

Get used to idea of eventual

consistency

Page 44: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Enables Responsive UX

• Response to interactive users is as fast as a work request can be persisted

• UX challenge due to async processing– Eventual consistency processing – Eventual satisfaction for users

Page 45: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Enables More Reliable Service

• Decoupled front/back provides insulation• Blocking is bane of scalability

Page 46: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

General Case: Many Queue Types

WebRole(IIS)

WorkerRole

WebRole(IIS)

WebTier

(Public)

WorkerRoleWorker

RoleService

Tier Type 1

WorkerRoleWorker

RoleWorkerRoleWorker

Role Type 2

Queue Type 1

Queue Type 2

Queue Type 1

Queue Type 2

Queue Type 3 Worker

Role Type 2

WorkerRole

Type 2

Service Tier

Type 2

WebTier

(Admin)

Page 47: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Enables Cost-Efficient Scaling

• Loosely coupled, concern-independent scaling• Get Scale Units right• Optimize for CO$T EFFICIENCY

• GOAL:

cost α benefit

Page 48: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

How about the queue API?

Page 49: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

A reliable queue works just like any other queue,

right?

(beware the abstraction mismatch)

Anti-Pattern #7

Page 50: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Reliable Queue & 2-step Delete

WebTier

Service Tier

var url = “http://pageofphotos.blob.core.windows.net/up/<guid>.png”;queue.AddMessage( new CloudQueueMessage( url ) );

var invisibilityWindow = TimeSpan.FromSeconds( 10 );CloudQueueMessage msg = queue.GetMessage( invisibilityWindow );

(… do some processing then …)

Queue

queue.DeleteMessage( msg );

Page 51: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Idempotent Processing

An idempotent operation can be performed more than once

without changing the end result.

Key technique in lieue of

distributed transactions

Page 52: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Poison Message Detection

A poison message is a flawed message that can never be

successfully processed.

Page 53: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Tiers of Cloud Failure

• Transient API/DB connection failures• Temporary/Ephemeral drive loss• DC outage (or smoking hole)• Zone/Region outage (or smoking hole)• Global outage

Page 54: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

“Failure is not an option”

(Failure is routine, at least at lower tiers.)

Anti-Pattern #8

Page 55: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Programming against Cloud Services as though

they were reliable

(Transient Failures handled using Busy Signal Pattern)

Anti-Pattern #9

Page 56: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Security

Page 58: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

unicorn cloud security for apps

Copyright © 2013 Elizabeth B. O’Connor • used with permission • www.elizabethboconnor.com

SQL

INJECTIONSESSION

HIJACKINGCSRF

XSS

Page 59: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Belief in cloud app security unicorns

Reality: your app’s vulnerabilities will port very cleanly to your favorite cloud platform

Anti-Pattern #10

Page 60: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Little Bobby Tables (still a problem)

Page 61: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Conflating App & Platform security

secure compliant

Anti-Pattern #11

Page 62: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Cloud News from June 2014

• http://www.codespaces.com/• A cautionary tale…

– DDoS– Security Breach– Ransom / Extortion– Fighting Back– Malicious Destruction of Assets– Business Failure EL

APSE

D T

IME

12 H

OU

RS

Page 63: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

1FAsingle-factor auth(2FA/MFA is widely available)

Anti-Pattern #12

Page 64: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Service Level Agreements (SLA)

Page 65: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

PoP (pageofphotos.com) adds paid plans to corporate partners

– wants to offer an SLA

Page 66: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

What is “the SLA” for storage?

Page 67: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

SLA Responsibilities

• From Google Storage (https://cloud.google.com/storage/sla): "Back-off Requirements" means, when an error occurs, the Application is responsible for waiting for a period of time before issuing another request. This means that after the first error, there is a minimum back-off interval of 1 second and for each consecutive error, the back-off interval increases exponentially up to 32 seconds.”

Page 68: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

SLA Math

• All required: 99.994 = 99.96• All required: 99.95 x 99.92 x 99.99 = 99.74• Period of time over which an SLA applies

matters

Page 69: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

SLA Penalties

• Limited to the service costs– Service costs != your business losses

• Multiple instances might be needed to be eligible

Page 70: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Passing along the SLA

The cloud SLA becomes my service’s SLA

Anti-Pattern #13

Page 71: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Compose to boost reliability

Page 72: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

The architecture of a cloud-native application is aligned with the

architecture of the underlying cloud platform.

Page 73: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

Hiring!

HIRING at Finomial Corporation• Are you a talented senior engineer/architect

interested in financial services in Boston area?• Technology stack is ASP.NET on Azure + SPA• Downtown Boston (startup space)• [email protected] (or grab a biz card)

Page 74: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

• Except where noted, slide deck is © 2014 Development Partners Software Corporation • http://www.devpartners.com •

And….

Bill Wilder@codingoutloudcodingoutloud@gmail.comblog.codingoutloud.comlinkedin.com/in/billwilder

Find this slide deck here

See you at Boston Azure

bostonazure.org

Book signing2:45 – 3:30 today

Page 75: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.
Page 76: Except where noted contents © 2014 Development Partners Software Corporation   Cloud Architecture Anti-Patterns.

des questions?