Upload
vincent-thavonekham-pro
View
184
Download
0
Tags:
Embed Size (px)
Citation preview
Microsoft Azure #gwab #ViseoSpirit
GAB 2015 LYON ORAGANIZER
LOCAL SPONSORS WORLDWIDE SPONSORS
…
#gwab #ViseoSpirit
Microsoft Azure #gwab #ViseoSpirit
• Welcome to your new job • Cloud cost efficiency defined • Avoiding waste • Architecting for cost efficiency • Choosing Azure services • Deployment strategy • Measuring cost efficiency
Presentation
Microsoft Azure #gwab #ViseoSpirit
The Cloud introduces a revolution …
• Everything you do now has a direct impact on costs !
6
Microsoft Azure #gwab #ViseoSpirit
This leads to …
• Cost Driven Design • Huge opportunities for systems which are cheaper and more reliable!
8
Microsoft Azure #gwab #ViseoSpirit
CLOUD COST EFFICIENCY DEFINED
What is it and why would you care ?
Microsoft Azure #gwab #ViseoSpirit
Cost efficiency, why would you care ?
When you scale, every cost optimization pays *10000
– Selling many robots, – many connected cars, – having many players on your game …
Microsoft Azure #gwab #ViseoSpirit
And because when it’s cheap, you can do even crazier things !
– GMail pre-opening/rendering all your email attachments
Cost efficiency, why would you care ?
Microsoft Azure #gwab #ViseoSpirit
Definition
• Very different from pure performance. • We’re not looking for the fastest Web stack here.
Microsoft Azure #gwab #ViseoSpirit
Measuring perf
• Perf. – Fairly easy – Concepts well defined
• Throughput (Req/s, DataVolume/s, …), Latency, Consistency of response times, …
Microsoft Azure #gwab #ViseoSpirit
Measuring perf
• Perf. – Fairly easy – Tons of tools and litterature
• Tools to replay, to load-test, to graph results …
Microsoft Azure #gwab #ViseoSpirit
Classification of requests by response time
Average response time for each « competitors »
Microsoft Azure #gwab #ViseoSpirit
Measuring costs
• Cost – Fairly easy – Once you know how to precisely measure it
Microsoft Azure #gwab #ViseoSpirit
Mesuring Quality of service
• QoS – Much harder – How you, as a user of the system, perceive its usage
Microsoft Azure #gwab #ViseoSpirit
Mesuring Quality of service – Cloud solutions bring new opportunities to lower costs – But sometimes at the expense of QoS !
• Which is why is very important to consider the costEff and not just the cost
Microsoft Azure #gwab #ViseoSpirit
QoS - Examples
• Perfect(costEff) – A system that is ‘on’ only when a user request comes in
• Nearly infinite cost efficiency (by moving the cost toward 0)
Microsoft Azure #gwab #ViseoSpirit
COST OPTIMIZATION MATURITY LEVELS From the obvious to the most advanced techniques
Microsoft Azure #gwab #ViseoSpirit
Cloud cost maturity level
Initial
Monitored
Allocated
Business valued
1 Cost are not estimated or monitored and are are to predict
1 Costs are monitored at a global level, or per account
1 Costs are monitored by amount of business transactions
1 Costs are monitored and allocated to business units, products, …
Microsoft Azure #gwab #ViseoSpirit
• Don’t let things running if you don’t use them – Easier said than done ! How do you know what is used
and what is not ? – – Examples of pure waste
• Don’t keep 'stopped' Azure Applications in any other tier than the 'F1 Free tier' (automation helps here)
Pure Waste
Microsoft Azure #gwab #ViseoSpirit
• Ensure you use what has been pre-purchased at the optimal price – Avoid using rogue Subscriptions that would be at on-
demand (instead of within Enterprise Agreement) prices
Less obvious waste
Microsoft Azure #gwab #ViseoSpirit
ARCHITECTING FOR COST EFFICIENCY The most decisive factor impacting costs
Microsoft Azure #gwab #ViseoSpirit
Follow the (sun / users)
• Autoscale
• Reducing cost by Right-sizing in real-time
Microsoft Azure #gwab #ViseoSpirit
Follow the users
Credit : CMG Workshop / November 2013 / Adrian Cockcroft
Microsoft Azure #gwab #ViseoSpirit
Follow the users
Credit : CMG Workshop / November 2013 / Adrian Cockcroft
Microsoft Azure #gwab #ViseoSpirit
Means scaling Up and Down
Credit : CMG Workshop / November 2013 / Adrian Cockcroft
Microsoft Azure #gwab #ViseoSpirit
Exemple of expensive resources
• Caviar in cloud = outgoing traffic – Can you implement efficient client-side caching ? – Can you move part of the trafic to a CDN (hopefully
less expensive) ?
Microsoft Azure #gwab #ViseoSpirit
Pricing keeps changing
• What is expensive varies a lot • Over the various providers • Over time for each provider
Microsoft Azure #gwab #ViseoSpirit
Don’t burn too much CPU
• Reduce resources consumption
• Obvious, but many people don’t really pay attention …
Microsoft Azure #gwab #ViseoSpirit
How can you act on that ? – Thread swapping is a major SYSTEM CPU cycles
burner !
• Real customer story about this
Microsoft Azure #gwab #ViseoSpirit
New concerns
• Speed of boot – Wasn’t a concern up to now
• Now, slow booting speed is a major pain in some Cloud environments (Jersey + Google AppEngine for instance)
• And the Azure Cloud …
Microsoft Azure #gwab #ViseoSpirit
CONCRETE EXEMPLES
Exemple of how to reduce spending without reducing QoS
Microsoft Azure #gwab #ViseoSpirit
Ex1 – Web site with external depend.
• Web site making many calls to slow payment APIs
Microsoft Azure #gwab #ViseoSpirit
Ex1 – Web site with external depend.
• Move to non-blocking I/O – Runtime cost divided by 8 !
• For the exact same service, same QoS, same SLA • 4 Xlarge instances become 2 small instances • Tomcat/Java => NodeJS (would be the same with
RxJava/…)
Microsoft Azure #gwab #ViseoSpirit
Ex1 – Web site with external depend.
• The perfect « ad » for NodeJS – This is not always the case, as we will see in the
following examples
– Actually perfect Ad for any Reactive framework (NodeJS based or not)
Microsoft Azure #gwab #ViseoSpirit
Ex2 – Unfreq. used service
• Web site with unfrequently called micro-service
• Only called once each time a new user creates an account
Microsoft Azure #gwab #ViseoSpirit
Ex2 – Unfreq. used service – Perfect candidate for onDemand short duration
instances + – Non-blocking I/Os
• Would bring the cost close to 0
Microsoft Azure #gwab #ViseoSpirit
Ex2 – Need ultra fast resp.
• BUT … – Users won’t wait for an instance to boot (value would
decrease)
Microsoft Azure #gwab #ViseoSpirit
Ex2 – Need ultra fast resp.
• So we keep an instance idle • A CSP with very very fast booting instances could
solve it though ! – => cf AWS Lambda (should appear in Azure shortly)
Microsoft Azure #gwab #ViseoSpirit
Ex3 – Web ticketing
• Looks like another ideal case for non blocking I/O – Cut the number of instances from 54 to 9
Microsoft Azure #gwab #ViseoSpirit
Ex3 – Web ticketing
• Looks like another ideal case for non blocking I/O – BUT why not cut it to 0 ?
Microsoft Azure #gwab #ViseoSpirit
Ex3 – Web ticketing
• Actually another ideal case for Object Storage – Amazon S3, Azure Blob Storage, Google GCS, …
• Just need one instance (non-blocking) to generate self-signed URLs
Microsoft Azure #gwab #ViseoSpirit
DEPLOYMENT STRATEGY
The more flexible and the more automated your deployments are, the more opportunities there are for cost optimization
Microsoft Azure #gwab #ViseoSpirit
What’s the link between « Deployment automation » and
« Cloud cost Efficiency » ???
Microsoft Azure #gwab #ViseoSpirit
• You need to be able to shut things DOWN and turn them ON very regularly – It shouldn’t take long to switch power ON/OFF – You can’t spend several minutes every morning and
night switching things on and off. With the potentiel errors that would come with it
Deployment automation benefits
Microsoft Azure #gwab #ViseoSpirit
• You need to be able to test several variants of your systems – Test with different instance types – Test various configurations
Deployment automation benefits
Microsoft Azure #gwab #ViseoSpirit
• You need to be able to test several variants of your systems regularly – Things change fast in the Cloud world
Deployment automation benefits
Microsoft Azure #gwab #ViseoSpirit
• Continuous cost improvement – Continuous deployment (Infra + App) – Load generation – Cost measurement – Comparison with previous runs
=> Feedback for architects and developers
Deployment automation benefits
Microsoft Azure #gwab #ViseoSpirit
Repeatability
• Thanks to scripting, things are precisely repeatable – And we can assign a testId to every test execution
Microsoft Azure #gwab #ViseoSpirit
Measuring tests costs
• Measuring small cost increments (few mins)
• Tags (Need to change tag values on each run) • Need to change instances (1h / 10min) • Need to use taggable servicesTag *all* services
Microsoft Azure #gwab #ViseoSpirit
Measuring tests costs
• Cost-allocate every test execution – Tag all the resources created
• Propagate tags to elements which are not tagged by default
• If some elements are not taggeable, run them on specific subscriptions (cost are per subscriptions)
tag[TestId]=bfd3e690-ce14-11e3-9c1a-0800200c9a66
Microsoft Azure #gwab #ViseoSpirit
Measuring tests costs (continued)
• With some Cloud providers, you can retrieve specific debug cost information – Detailed cost items provided by the Cloud provider – For instance, Google AppEngine log lines contain cost
information • Very precise because isolated per requests but no
global overview
Microsoft Azure #gwab #ViseoSpirit
Collect the cost data (after test execution)
• Scan through detailed cost logs – Detailed Billing Files provided by Azure (equivalent to
the information provided by AWS or Google Cloud) – Cost data coming after a delay (4 to 24h)
Microsoft Azure #gwab #ViseoSpirit
Collect the business value data (after exec)
• Scan through application logs and performance logs – Application logs to determine the value produced – Performance logs for the QoS computation
Microsoft Azure #gwab #ViseoSpirit
Compute your cost-efficiency level
• « Cost of test run » + « Generated business throughput » => « Cost by business metrics » – Exemple : 3.47€ HT per 100 « vehicule configuration
simulation »
Microsoft Azure #gwab #ViseoSpirit
Cost by business metrics analysis
• Iterate, improve – Continuously