+ All Categories
Home > Technology > Best Practices In Building Scalable Cloud Ready Service Based

Best Practices In Building Scalable Cloud Ready Service Based

Date post: 16-Apr-2017
Category:
Upload: igor-moochnick
View: 4,761 times
Download: 0 times
Share this document with a friend
31
Best Practices in building scalable cloud-ready Service based systems Discussion Igor Moochnick IgorShare Consulting [email protected] Blog: www.igorshare.com/blog
Transcript
Page 1: Best Practices In Building Scalable Cloud Ready Service Based

Best Practices in building scalable cloud-ready Service based systems

Discussion

Igor MoochnickIgorShare [email protected]

Blog: www.igorshare.com/blog

Page 2: Best Practices In Building Scalable Cloud Ready Service Based

Is this system scalable?

Page 3: Best Practices In Building Scalable Cloud Ready Service Based

What is scalability?

• Increase resources -> Increase performance proportionally to the amount of added resources

• Increase performance -> more units of works

Page 4: Best Practices In Building Scalable Cloud Ready Service Based

$10,000

machine

$1000machin

e

Scale-up And Scale-outVo

lum

e

$500machine

# MachinesScale Up

$500machin

e

$500machin

e

$500machin

e

Volu

me

$500machin

e

Scale Out

DNSWWW

Page 5: Best Practices In Building Scalable Cloud Ready Service Based

Is this system scalable?

Page 6: Best Practices In Building Scalable Cloud Ready Service Based

Is this system scalable?

Page 7: Best Practices In Building Scalable Cloud Ready Service Based

Is this system scalable?

Page 8: Best Practices In Building Scalable Cloud Ready Service Based

Is this system a scalable MADNESS?

Page 9: Best Practices In Building Scalable Cloud Ready Service Based

Here is the gun. Go kill yourself!

Page 10: Best Practices In Building Scalable Cloud Ready Service Based

Strong

Eventual

Optimistic

Missile Launch

Address Change

Stock Ticker

Now

In the Future

Consistency Level Changes are Visible Example

Maybe in the Future

Some Useful Definitions

Exactly Once

At Least Once

At Most Once

Bank Transfer

Email

Streaming Video

No loss, no duplicates

No loss, duplicates

Assurance Message Delivery Example

Loss, no duplicates

Best Effort Stock TickerLoss, duplicates

Consistency Levels

Message Assurances

Page 11: Best Practices In Building Scalable Cloud Ready Service Based

Where did you start? Where did you end up?Shared State

ACID Transactions

Partitioned, Replicated State

Eventual Consistency

Exactly Once Messaging Best Effort Messaging

Machine Loss is a Catastrophe

Keep Processes Running

Machine Loss is Business As Usual

Recovery-Oriented Computing

The InfrastructureDeveloper's Experience

Page 12: Best Practices In Building Scalable Cloud Ready Service Based

The law

• The least scalable component of your system becomes a bottleneck for the whole system

Page 13: Best Practices In Building Scalable Cloud Ready Service Based

Recipe ingredients (Amazon guidelines)• Autonomy• Asynchrony• Controlled concurrency• Controlled parallelism• Decentralize• Decompose into small well-understood building blocks• Failure tolerant• Local responsibility• Recovery Built-in• Simplicity• Symmetry

Page 14: Best Practices In Building Scalable Cloud Ready Service Based

Key principals

• Things fail all the time!• Machines

– Disposable– Nameless– Self assembled

• State management– Caching– Loose consistency– Relax isolation

• Redundancy• Partitioning

• Loosely coupled messaging• Best effort• Message loss• Retries• Self monitors• Self heals• Designed to expect failures• Continue to work seamlessly

during the failure

Page 15: Best Practices In Building Scalable Cloud Ready Service Based

Application Development Patterns• Architecture

– Choose a high-level framework– Keep service and hosting code separate– Partition

• Design– Use loose coupling– Use caches and stale data– Have just a few simple recovery paths– Be topology-independent– Be hardware-indepedent

Page 16: Best Practices In Building Scalable Cloud Ready Service Based

Challenges Of Scalability

• How do I ensure incoming requests are processed at the right location?– Partition on service-specific input– Dynamically route to correct node– Fail over seamlessly

• How do I manage state inside my service?– Take a hard look at consistency requirements– Aggressively cache and use transient data– Partition the Storage Tier

Page 17: Best Practices In Building Scalable Cloud Ready Service Based

ACID vs. BASE

• ACID– Atomic– Consistent– Isolated– Durable

• Modern BASE-based systems– Basically Available– Soft-state (or scalable)– Eventually consistent

Page 18: Best Practices In Building Scalable Cloud Ready Service Based

What is the problem?

• Only two of three:– Strong Consistency

• All clients see the same view during updates– High Availability

• Some data replica is always available despite failures

– Partition tolerance• All the properties hold even if partitioned

Page 19: Best Practices In Building Scalable Cloud Ready Service Based

Techniques

• Expiration based caching: AP• Quorum / majority algorithms: PC• Two-phase commit: AC

Page 20: Best Practices In Building Scalable Cloud Ready Service Based

Scaling data in 3 steps

• Partitioning• Routing• State management

Page 21: Best Practices In Building Scalable Cloud Ready Service Based

Solving the data congestion

• Throttling (especially on startup after failure)• Denormalization• Scale vs. Performance• Fault Tolerance and recoverability• Geo-distribution• Content distribution providers (like Akamai)

Page 22: Best Practices In Building Scalable Cloud Ready Service Based

Fault tolerance

• Throttling incoming traffic• Limit retries• Server failover• Data center failover• Consider using queues

Page 23: Best Practices In Building Scalable Cloud Ready Service Based

Monitoring

• Monitor data about what the user sees – this is what is most important

• Make sure not to overdo – kills the components you rely on

• Be frugal– Built in counters and monitor the trends - can help you to

predict the spikes and allocate on demand extra resources

Page 24: Best Practices In Building Scalable Cloud Ready Service Based

Monitoring

• Availability• Performance• Alerts• Auto throttling• Capacity thresholds• Load• Transactions• Should measure

realistic/relevant actions and behavior!

Importance

Page 25: Best Practices In Building Scalable Cloud Ready Service Based

Diagnosing & Logging

• Non-blocking• Asynchronously• Size – can be too big (there is “too much of a good thing”)

– Have control over “what” and “how much”• Performance hit (“do no harm”)• Should not become a bottleneck• Be careful what you log

– Horizontally– Vertically

• Should be able to replay logs and correlate the requests– <time><correlate-id><node-id><action><data><result>

Page 26: Best Practices In Building Scalable Cloud Ready Service Based

Troubleshooting the distributed systems• Decoupling• Role isolation• Single box

• Allow to separate the functionality from the rest of the system

• Allow to run all from a single box• Have stubs and simulators• Be able to “replay” the logs

Page 27: Best Practices In Building Scalable Cloud Ready Service Based

Deployments

• Deployment packaging• Rolling out gradually or

atomically• Automatic deployments• Staging environment• Building confidence with

real customer data• Rolling back• Security trumps feature• Load balancing

• Consider linear scale• Keep IT in mind• Upgradability

Page 28: Best Practices In Building Scalable Cloud Ready Service Based

Deployment

• It’s hard• It’s hard to make it right• Automate everything – simplifies the repeatability• Version Forward/Backward compatible• Rolling upgrade and rollback• Be nice to your friends• Know and manage your environments

• Compensate for gradual system recovery• Clean queues

Page 29: Best Practices In Building Scalable Cloud Ready Service Based

Resources

• Availability & Consistency presentation of Amazon CTO Dr. Werner Vogel http://www.infoq.com/presentations/availability-consistency

• Microsoft PDC’08 Presentationshttps://sessions.microsoftpdc.com/timeline.aspx

Page 30: Best Practices In Building Scalable Cloud Ready Service Based

Q&A

Page 31: Best Practices In Building Scalable Cloud Ready Service Based

Thank you!


Recommended