SlideShare a Scribd company logo
AutoSpoting - an automated EC2
spot market bidder
GDG Berlin Golang - Clowdy Gophers
30 May 2016
Cristian Măgherușan-Stanciu
HERE Maps, Berlin
About me
SysAdmin at HERE Maps, Berlin, supporting maps.here.com(https://maps.here.com)
Background: networking, Linux, AWS, C/Shell/Perl/Ruby/Python
Passionate about automation
Spare-time gopher for a few months now, and I love it
Agenda
The idea
Implementation details
Challenges and future plans
Conclusions
Q&A
The idea
AWS Spot Market Automation
Needed a non-trivial problem for learning Go in my spare time
First discussed on an AWS Berlin meet-up
Interesting, it got me thinking
Decided to 'go build' it in my spare time
AutoSpoting
Simple solution to reliably use the AWS spot market, for production use-cases
Easy to use
Simple design and implementation
Maximize cost savings without sacri cing high availability
AWS Spot Market - Intro
Unused EC2 capacity sold to the highest paying bidders
Prices based on supply/demand
Considerable variation per region, instance type and even availability zone
Not all of them are available on the market
AWS Spot Market - Typical Prices, Savings and Risks
Starts from 10% the on-demand price, peaks as high as 10x
Savings >80% of on-demand are common, or ~5x capacity for the same costs
But spot instances are terminated with a 2 minute notice when outbid!!!
m3.large in Virginia, last 30 days
AWS Spot Market - Challenges
Instances could be terminated at any time
The application must be designed with this in mind
Not applicable for everything
Rewards cloud'y designs
AWS Spot Market - Achieving High Availability with Manual Bidding
Place large bids and hope for the best
Spread over multiple pricing zones
Carefully pick region, instance type and availability zone
AWS o ers helper tools
AWS Spot Bid Advisor
AWS Spot Market - Automation Bidding Solutions
AWS o ers just building blocks
AutoScaling native integration - supports a single instance type
SpotFleet - entirely di erent API, has some limitations (scaling, ELB...)
Also there are many 3rd party & custom tools
My Solution - AutoSpoting
Leverage recent autoscaling features to replace on-demand instances with spot
equivalents
Spread over multiple instance types in each availability zone
AutoScaling handles instance terminations and ELB integration for the spot
instances
Easy to install and con gure against existing AutoScaling groups
Serverless and low overhead
Implementation details
Architecture
Work ow - Request New Spot Instance
Work ow - Swap Instances
After the spot instance has been running for longer than the group's grace period
Work ow - Swapped Instances
Work ow - Terminate On-Demand Instance
Work ow - Instance Replaced
Work ow - Loop until done
Repeat this until we have no on-demand instances left in the group
Work ow - Final State
Algorithm details
The Lambda JavaScript shim automatically updates to the latest released binary
that is implementing all the logic and runs it
The Go program downloads data describing instance specs and on-demand
pricing (compiled by ec2instances.info)
Goroutines are then processing in parallel all the regions and enabled groups
The spot instance type and bid price are determined for each group, based on the
on-demand running instances and current spot prices
Instance replacement is performed as described in the work ow
High Availability
Spot instance termination, when outbid
Handled by AutoScaling like any instance failure
AutoScaling will launch on-demand instances to compensate for lost capacity
Those will in turn be replaced with spot instances later, as per the work ow
Low likelihood of service downtime, with enough pricing zones and redundancy
Installation details
Easy deployment via CloudFormation stack
Enable/disable per AutoScaling group using a custom tag, o by default
Have a look on my my blog(http://mcristi.wordpress.com)for detailed installation instructions
Challenges and future plans
Challenges
Needs automated testing, currently I mostly do it manually
Automated testing needs some internal redesign (WIP)
Still trying to gure out testing with the AWS SDK for Go
How to do table-structured tests with big/mocked data structures
Future Plans
Finish preparing for automated testing
Write tests
Use information about termination likelihood from the Spot Bid Advisor
Make some parameters of the algorithm con gurable
React on the 2min termination notice, with code running on spot instances
Allow keeping some on-demand capacity if con gured
Open source the code
Conclusions
What I like about Go
Easy to learn
Easy refactoring
Easy to do concurrency
Error handling
Static binaries allow me to deploy easily
If you also have an interesting idea, 'go build' it!
Questions and Answers
Thank you
Cristian Măgherușan-Stanciu
HERE Maps, Berlin
cristian.magherusan-stanciu@here.com(mailto:cristian.magherusan-stanciu@here.com)
https://mcristi.wordpress.com(https://mcristi.wordpress.com)
@magheru_san(http://twitter.com/magheru_san)

More Related Content

Similar to Autospoting - an automated EC2 spot market bidder

Reduce Your Cloud Spending With AWS Spot Instances
Reduce Your Cloud Spending With AWS Spot InstancesReduce Your Cloud Spending With AWS Spot Instances
Reduce Your Cloud Spending With AWS Spot Instances
Intelligentia IT Systems Pvt. Ltd.
 
(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands
Amazon Web Services
 
Cloudreach Voices EC2 Making Sense of the Cost Options
Cloudreach Voices EC2 Making Sense of the Cost Options  Cloudreach Voices EC2 Making Sense of the Cost Options
Cloudreach Voices EC2 Making Sense of the Cost Options
Cloudreach
 
This One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You ThousandsThis One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You Thousands
Amazon Web Services
 
AWS Cost Opt Meetup 2 - News corp - Spot On deep dive
AWS Cost Opt Meetup 2 - News corp - Spot On deep diveAWS Cost Opt Meetup 2 - News corp - Spot On deep dive
AWS Cost Opt Meetup 2 - News corp - Spot On deep dive
Peter Shi
 
Cut AWS Costs: Using Spot Instances for More Than Batch
Cut AWS Costs: Using Spot Instances for More Than BatchCut AWS Costs: Using Spot Instances for More Than Batch
Cut AWS Costs: Using Spot Instances for More Than Batch
RightScale
 
An introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - WebinarAn introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - Webinar
CMPUTE
 
AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...
AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...
AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...
Amazon Web Services
 
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Amazon Web Services
 
AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...
AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...
AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...
Cobus Bernard
 
Introduction to Amazon EC2 Spot
Introduction to Amazon EC2 SpotIntroduction to Amazon EC2 Spot
Introduction to Amazon EC2 Spot
Amazon Web Services
 
Introduction to Amazon EC2 Spot
Introduction to Amazon EC2 Spot Introduction to Amazon EC2 Spot
Introduction to Amazon EC2 Spot
Amazon Web Services
 
AWS Cloud cost optimization
AWS Cloud cost optimizationAWS Cloud cost optimization
AWS Cloud cost optimization
Yogesh Sharma
 
Getting Started with EC2 Spot - November 2016 Webinar Series
Getting Started with EC2 Spot - November 2016 Webinar SeriesGetting Started with EC2 Spot - November 2016 Webinar Series
Getting Started with EC2 Spot - November 2016 Webinar Series
Amazon Web Services
 
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
Amazon Web Services
 
How to Reduce your Spend on AWS
How to Reduce your Spend on AWSHow to Reduce your Spend on AWS
How to Reduce your Spend on AWS
Joseph K. Ziegler
 
AWS APAC Webinar Series: How to Reduce Your Spend on AWS
AWS APAC Webinar Series: How to Reduce Your Spend on AWSAWS APAC Webinar Series: How to Reduce Your Spend on AWS
AWS APAC Webinar Series: How to Reduce Your Spend on AWS
Amazon Web Services
 
Optimizing Costs and Efficiency of AWS Services
Optimizing Costs and Efficiency of AWS Services Optimizing Costs and Efficiency of AWS Services
Optimizing Costs and Efficiency of AWS Services
Amazon Web Services
 
Workshop; Deploy a Deep Learning Framework on Amazon ECS and Spot Instances
Workshop; Deploy a Deep Learning Framework on Amazon ECS and Spot InstancesWorkshop; Deploy a Deep Learning Framework on Amazon ECS and Spot Instances
Workshop; Deploy a Deep Learning Framework on Amazon ECS and Spot Instances
Amazon Web Services
 
Leveraging elastic web scale computing with AWS
 Leveraging elastic web scale computing with AWS Leveraging elastic web scale computing with AWS
Leveraging elastic web scale computing with AWS
Shiva Narayanaswamy
 

Similar to Autospoting - an automated EC2 spot market bidder (20)

Reduce Your Cloud Spending With AWS Spot Instances
Reduce Your Cloud Spending With AWS Spot InstancesReduce Your Cloud Spending With AWS Spot Instances
Reduce Your Cloud Spending With AWS Spot Instances
 
(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands
 
Cloudreach Voices EC2 Making Sense of the Cost Options
Cloudreach Voices EC2 Making Sense of the Cost Options  Cloudreach Voices EC2 Making Sense of the Cost Options
Cloudreach Voices EC2 Making Sense of the Cost Options
 
This One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You ThousandsThis One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You Thousands
 
AWS Cost Opt Meetup 2 - News corp - Spot On deep dive
AWS Cost Opt Meetup 2 - News corp - Spot On deep diveAWS Cost Opt Meetup 2 - News corp - Spot On deep dive
AWS Cost Opt Meetup 2 - News corp - Spot On deep dive
 
Cut AWS Costs: Using Spot Instances for More Than Batch
Cut AWS Costs: Using Spot Instances for More Than BatchCut AWS Costs: Using Spot Instances for More Than Batch
Cut AWS Costs: Using Spot Instances for More Than Batch
 
An introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - WebinarAn introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - Webinar
 
AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...
AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...
AWS re:Invent 2016: Dollars and Sense: Technical Tips for Continual Cost Opti...
 
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
 
AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...
AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...
AWS EMEA Online Summit - Blending Spot and On-Demand instances to optimizing ...
 
Introduction to Amazon EC2 Spot
Introduction to Amazon EC2 SpotIntroduction to Amazon EC2 Spot
Introduction to Amazon EC2 Spot
 
Introduction to Amazon EC2 Spot
Introduction to Amazon EC2 Spot Introduction to Amazon EC2 Spot
Introduction to Amazon EC2 Spot
 
AWS Cloud cost optimization
AWS Cloud cost optimizationAWS Cloud cost optimization
AWS Cloud cost optimization
 
Getting Started with EC2 Spot - November 2016 Webinar Series
Getting Started with EC2 Spot - November 2016 Webinar SeriesGetting Started with EC2 Spot - November 2016 Webinar Series
Getting Started with EC2 Spot - November 2016 Webinar Series
 
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
AWS re:Invent 2016: Save up to 90% and Run Production Workloads on Spot - Fea...
 
How to Reduce your Spend on AWS
How to Reduce your Spend on AWSHow to Reduce your Spend on AWS
How to Reduce your Spend on AWS
 
AWS APAC Webinar Series: How to Reduce Your Spend on AWS
AWS APAC Webinar Series: How to Reduce Your Spend on AWSAWS APAC Webinar Series: How to Reduce Your Spend on AWS
AWS APAC Webinar Series: How to Reduce Your Spend on AWS
 
Optimizing Costs and Efficiency of AWS Services
Optimizing Costs and Efficiency of AWS Services Optimizing Costs and Efficiency of AWS Services
Optimizing Costs and Efficiency of AWS Services
 
Workshop; Deploy a Deep Learning Framework on Amazon ECS and Spot Instances
Workshop; Deploy a Deep Learning Framework on Amazon ECS and Spot InstancesWorkshop; Deploy a Deep Learning Framework on Amazon ECS and Spot Instances
Workshop; Deploy a Deep Learning Framework on Amazon ECS and Spot Instances
 
Leveraging elastic web scale computing with AWS
 Leveraging elastic web scale computing with AWS Leveraging elastic web scale computing with AWS
Leveraging elastic web scale computing with AWS
 

Recently uploaded

Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 

Recently uploaded (20)

Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 

Autospoting - an automated EC2 spot market bidder

  • 1. AutoSpoting - an automated EC2 spot market bidder GDG Berlin Golang - Clowdy Gophers 30 May 2016 Cristian Măgherușan-Stanciu HERE Maps, Berlin
  • 2. About me SysAdmin at HERE Maps, Berlin, supporting maps.here.com(https://maps.here.com) Background: networking, Linux, AWS, C/Shell/Perl/Ruby/Python Passionate about automation Spare-time gopher for a few months now, and I love it
  • 3. Agenda The idea Implementation details Challenges and future plans Conclusions Q&A
  • 5. AWS Spot Market Automation Needed a non-trivial problem for learning Go in my spare time First discussed on an AWS Berlin meet-up Interesting, it got me thinking Decided to 'go build' it in my spare time
  • 6. AutoSpoting Simple solution to reliably use the AWS spot market, for production use-cases Easy to use Simple design and implementation Maximize cost savings without sacri cing high availability
  • 7. AWS Spot Market - Intro Unused EC2 capacity sold to the highest paying bidders Prices based on supply/demand Considerable variation per region, instance type and even availability zone Not all of them are available on the market
  • 8. AWS Spot Market - Typical Prices, Savings and Risks Starts from 10% the on-demand price, peaks as high as 10x Savings >80% of on-demand are common, or ~5x capacity for the same costs But spot instances are terminated with a 2 minute notice when outbid!!! m3.large in Virginia, last 30 days
  • 9. AWS Spot Market - Challenges Instances could be terminated at any time The application must be designed with this in mind Not applicable for everything Rewards cloud'y designs
  • 10. AWS Spot Market - Achieving High Availability with Manual Bidding Place large bids and hope for the best Spread over multiple pricing zones Carefully pick region, instance type and availability zone AWS o ers helper tools AWS Spot Bid Advisor
  • 11. AWS Spot Market - Automation Bidding Solutions AWS o ers just building blocks AutoScaling native integration - supports a single instance type SpotFleet - entirely di erent API, has some limitations (scaling, ELB...) Also there are many 3rd party & custom tools
  • 12. My Solution - AutoSpoting Leverage recent autoscaling features to replace on-demand instances with spot equivalents Spread over multiple instance types in each availability zone AutoScaling handles instance terminations and ELB integration for the spot instances Easy to install and con gure against existing AutoScaling groups Serverless and low overhead
  • 15. Work ow - Request New Spot Instance
  • 16. Work ow - Swap Instances After the spot instance has been running for longer than the group's grace period
  • 17. Work ow - Swapped Instances
  • 18. Work ow - Terminate On-Demand Instance
  • 19. Work ow - Instance Replaced
  • 20. Work ow - Loop until done Repeat this until we have no on-demand instances left in the group
  • 21. Work ow - Final State
  • 22. Algorithm details The Lambda JavaScript shim automatically updates to the latest released binary that is implementing all the logic and runs it The Go program downloads data describing instance specs and on-demand pricing (compiled by ec2instances.info) Goroutines are then processing in parallel all the regions and enabled groups The spot instance type and bid price are determined for each group, based on the on-demand running instances and current spot prices Instance replacement is performed as described in the work ow
  • 23. High Availability Spot instance termination, when outbid Handled by AutoScaling like any instance failure AutoScaling will launch on-demand instances to compensate for lost capacity Those will in turn be replaced with spot instances later, as per the work ow Low likelihood of service downtime, with enough pricing zones and redundancy
  • 24. Installation details Easy deployment via CloudFormation stack Enable/disable per AutoScaling group using a custom tag, o by default Have a look on my my blog(http://mcristi.wordpress.com)for detailed installation instructions
  • 26. Challenges Needs automated testing, currently I mostly do it manually Automated testing needs some internal redesign (WIP) Still trying to gure out testing with the AWS SDK for Go How to do table-structured tests with big/mocked data structures
  • 27. Future Plans Finish preparing for automated testing Write tests Use information about termination likelihood from the Spot Bid Advisor Make some parameters of the algorithm con gurable React on the 2min termination notice, with code running on spot instances Allow keeping some on-demand capacity if con gured Open source the code
  • 29. What I like about Go Easy to learn Easy refactoring Easy to do concurrency Error handling Static binaries allow me to deploy easily
  • 30. If you also have an interesting idea, 'go build' it!
  • 32. Thank you Cristian Măgherușan-Stanciu HERE Maps, Berlin cristian.magherusan-stanciu@here.com(mailto:cristian.magherusan-stanciu@here.com) https://mcristi.wordpress.com(https://mcristi.wordpress.com) @magheru_san(http://twitter.com/magheru_san)