This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
(They are not. Let cloud vendor handle service operations. Use
services. You focus on your app.)
Anti-Pattern #1
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.
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.
One-size-fits-all architecture
Anti-Pattern #2
[Cloud] Anti-Pattern Causes
• Abstraction misalignment• Not reading the fine print• Insufficient ongoing attention to cost• Insufficient ongoing attention to
automation
www.pageofphotos.com (PoP)
Move Simple PoP App to Cloud
WHAT NOW?
Scalability &
Performance &
Cost&
Automation
Time passes…
PoP has lots of photos
www.pageofphotos.com
One-size-fits-all data storage
(perf, scalability, cost)
Anti-Pattern #3
Upgrade to scenario-specific storage
Some$, Perf, Scale
benefits
PoP uses Valet Key Pattern
Even more$, Perf, Scale
benefits
CDN for public content
Many, many other storage options also available: NoSQL varieties, caches, etc.
Always access raw data (regardless of distance, cost)
(performance, scalability, cost)
Anti-Pattern #4
PoP web tier goes multi-instance…
Users experiencing login issues*
*Depending on configuration …
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
Running stateful VMs in web / service tiers
(Limits horizontal scalability & complicates autoscale – but
sometimes is reasonable option)
Anti-Pattern #5
I don’t have a slide on this, but …
sharding
Reliability
PoP Adding Video Support
(uh oh!)
Current
Let’s extend PoP with a Service Tier
REQUEST / RESPONSE(http + json)
OPTION 1: Request/Response Services
Serv
ices
Tie
r
Web
Tie
r
Dat
a Ti
er
Stateless StatelessServices
webbrowser
Coupling Between Tiers(reliability, scalability, cost)
(Situational: I frequently violate!Also relates to microservices.)
Anti-Pattern #6
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
Basic Idea
ReliableQueue
WorkProducers
WorkConsumers
OPTION 2: Async Services
Serv
ices
Tie
r
Web
Tie
r
Dat
a Ti
er
Stateless StatelessServices
webbrowser
push pull
StatelessServices
Notice anything “missing”
?
There is no transaction
Get used to idea of eventual
consistency
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
Enables More Reliable Service
• Decoupled front/back provides insulation• Blocking is bane of scalability
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)
Enables Cost-Efficient Scaling
• Loosely coupled, concern-independent scaling• Get Scale Units right• Optimize for CO$T EFFICIENCY
• GOAL:
cost α benefit
How about the queue API?
A reliable queue works just like any other queue,
right?
(beware the abstraction mismatch)
Anti-Pattern #7
Reliable Queue & 2-step Delete
WebTier
Service Tier
var url = “http://pageofphotos.blob.core.windows.net/up/<guid>.png”;queue.AddMessage( new CloudQueueMessage( url ) );
1FAsingle-factor auth(2FA/MFA is widely available)
Anti-Pattern #12
Service Level Agreements (SLA)
PoP (pageofphotos.com) adds paid plans to corporate partners
– wants to offer an SLA
What is “the SLA” for storage?
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.”
• 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
SLA Penalties
• Limited to the service costs– Service costs != your business losses
• Multiple instances might be needed to be eligible
Passing along the SLA
The cloud SLA becomes my service’s SLA
Anti-Pattern #13
Compose to boost reliability
The architecture of a cloud-native application is aligned with the
architecture of the underlying cloud platform.
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)