Using machine learning for virtual-machine placement in the cloud

In tests, a new way to allocate virtual machines across servers outperforms baselines by 10%.

In the cloud, load balancing, or distributing tasks evenly across servers, is essential to providing reliable service. It prevents individual servers from getting overloaded, which degrades their performance.

The simplest way to prevent server overloads is to cap the number of tasks assigned to each server. But this may result in inefficient resource use, as tasks can vary greatly in their computational demands. The ideal approach to load-balancing would allocate tasks to the minimum number of servers required to prevent overloads.

Last week, at the Conference on Machine Learning and Systems (MLSys), we presented a new algorithm for optimizing task distribution, called FirePlace. FirePlace is built around a decision-tree machine learning model, which we train using simulations based on historical data.

Server-Animation-v3.gif
Deciding how to allocate virtual machines (VMs) to cloud servers is a difficult challenge, as the VMs' resource consumption (represented here by the size of the VMs) varies over time. FirePlace combines simulation and machine learning to address that challenge.
Credit: Glynis Condon

In experiments, we found that FirePlace outperformed both more-complex models, such as long-short-term-memory models and reinforcement learning models, and simpler baselines that have proved effective in practice, such as the power-of-two algorithm.

Firecracker placement

The name FirePlace comes from the Firecracker virtual machine (VM), which is used by Amazon Web Services’ (AWS) Lambda service. Lambda provides function execution as a service, sparing customers from provisioning infrastructure themselves and lowering their costs, since they are billed for function execution duration.

In cloud computing, virtual machines enable secure execution of customer code by moderating that code’s access to server operating systems. Traditionally, a cloud computing service might allot one VM to each application running on its servers. Firecracker, however, allots a separate VM to each function.

Firecracker VMs are secure and lightweight and can be packed densely into servers. Their small size gives them efficiency advantages, but it also makes them less predictable: the resource consumption of a large program is easier to estimate than the resource consumption of a single program function. Optimizing the placement of Firecracker VMs required a new approach to load balancing; hence FirePlace.

FirePlace uses a decision tree model that takes as input the resource consumption status of multiple servers in the fleet; to ensure that the model can deliver a decision within milliseconds, those servers are randomly sampled. The model’s output is the assignment of a new VM to one of the input servers.

Training by simulation

To train the model, we use historical data about real Firecracker VMs’ resource consumption, represented as time series. During training, when the model is presented with a new VM to place, each of the currently allocated VMs is at a particular step in its time series. We run a simulation to compute those VMs’ future resource consumption, and on that basis, we can optimize the placement of the new VM. The optimized placement then becomes the training label for the current input. 

In our experiments, our baseline was the surprisingly effective power-of-two algorithm, which is widely used in cloud computing. It randomly picks two servers as potential recipients for a new VM, then selects the least loaded of the two. 

We also compared our approach to one that used neural networks — a long-short-term-memory network (LSTM) and a temporal convolutional network (TCN) — that were trained to predict the future resource consumption of a given VM, based on its resource consumption up to that time.

Finally, we also compared our system to one that used reinforcement learning to learn optimal placement of a VM, given its previous decisions about VM placement. The learned model performed well for smaller datasets, but as we increase the number of VMs for placement, the complexity of the problem increases, and reinforcement learning models fail to converge to a competitive solution.

We evaluated these approaches according to how many servers they needed to serve a given load, given a fixed limit on server overloads; the lower the number of servers, the better. FirePlace improved upon the power-of-two baseline algorithm by 10%. The LSTM and TCN approaches were too inaccurate to be competitive.

Lambda has begun to introduce the FirePlace approach in production, where in future it can provide real-world validation of our experimental results.

Research areas

Related content

US, WA, Seattle
Are you excited about using economic reasoning to shape decisions that affect millions of customers? Do you want to tackle ambiguous, high-impact problems where your analysis directly influences strategy and investment? We are looking for a Senior Economist to join Amazon and drive economic solutions for complex business challenges. In this role, you will define and prioritize analytical approaches, build rigorous econometric models, and translate findings into actionable recommendations for leadership. You will partner with engineers, product managers, scientists, and business leaders to deliver measurable outcomes. If you thrive on turning unstructured problems into clear, data-driven strategies, this is the role for you. Key job responsibilities - Lead the design, implementation, and delivery of economic analyses for complex or ambiguous business problems, providing strategic direction that informs organizational goals and investment decisions. - Develop and apply econometric models—including causal inference, structural estimation, and forecasting methods—choosing the right approach for each problem and validating results through rigorous testing. - Collaborate with cross-functional partners including engineers, product managers, and applied scientists to implement scalable solutions and translate economic insights into product and business improvements. - Communicate findings through clear narratives and technical documents for audiences ranging from peer economists to senior leaders, building consensus and influencing key decisions. - Evaluate and integrate generative AI tools where appropriate to augment research productivity, while mentoring other economists and raising the bar on analytical best practices across the team. A day in the life You might start your morning reviewing model performance metrics and refining an econometric specification before a working session with engineers on data pipeline requirements. After lunch, you could present preliminary findings from a causal analysis to business stakeholders, fielding questions and aligning on next steps. Later in the afternoon, you join a peer review for a fellow economist's research design, offering constructive feedback. Throughout the day, you balance hands-on analytical work with strategic conversations that connect your research to real business outcomes. About the team Our team of economists partners across Amazon to solve some of the company's most consequential business questions. We combine deep expertise in economic theory and applied econometrics with access to rich, large-scale data to deliver insights that shape long-term strategy. We value intellectual curiosity, collaborative problem-solving, and a commitment to rigorous science. If you are looking for an environment where your economic thinking directly drives impact at scale, we would love to hear from you.
US, WA, Redmond
Amazon Leo is building a low Earth orbit satellite broadband network to bring fast, affordable connectivity to customers worldwide. We're looking for a Senior Applied Scientist to invent the machine learning that will let the network predict, explain and prevent its own failures. You'll work on open research problems at large scale. These include anomaly detection on non-stationary, high-dimensional telemetry, causal root-cause inference over constantly changing satellite and ground network graphs, and trustworthy ML for operators making decisions under pressure. You'll own the science agenda, from forming hypotheses and designing new models to putting them into production systems that protect customer connectivity. Export Control Requirement: Due to applicable export control laws and regulations, candidates must be a U.S. citizen or national, U.S. permanent resident (i.e., current Green Card holder), or lawfully admitted into the U.S. as a refugee or granted asylum. Key job responsibilities Define and lead a multi-year applied research agenda in network observability, anomaly prediction and availability modeling. Invent new time-series and spatio-temporal graph models, such as graph neural networks (GNNs), foundation models and dynamic baselining, to predict network and ground-segment failures before customers are affected. Develop causal inference and causal discovery methods for automated root-cause attribution across a large, interdependent event surface. Research probabilistic models that break availability and throughput into causal drivers (coverage, ground, network, terminal, payload, planning) and separate true signal from noise. Advance methods for alert correlation, deduplication, uncertainty quantification and metric-quality scoring. Explore large language models (LLMs) and agentic approaches for reasoning over telemetry, logs and incident narratives. Design rigorous offline and online evaluation, including backtesting against real closed incidents and gameday-based benchmarks. Take research into production on AWS (SageMaker, Bedrock), working with engineers on scalability, drift detection and explainability. Publish at top-tier venues, file patents and raise the scientific bar through mentoring and design reviews. A day in the life You might start the morning reading new literature on causal discovery and sketching how it applies to Leo's network graph. Later you could review a scientist's experiment design and debate the best evaluation methodology. During an event, you would test your attribution model live on the incident call. You might finish the day prototyping a new spatio-temporal anomaly detector and backtesting it against last quarter's incidents. About the team Amazon Leo Networking Software builds the software behind Leo's satellite and ground network. Our applied science team works on hard, open-ended problems with real-world impact. We value scientific rigor, curiosity and ownership, and we encourage publishing and contributing to the research community. As a Senior Applied Scientist, you'll help build this science function from the ground up and set the technical bar for the scientists who join after you.
US, WA, Bellevue
We are seeking a Senior Applied Scientist to push the state of the art in robot learning and help bring capable robots out of the lab and into everyday homes at Fauna Robotics. In this role, you will design novel algorithms across perception, manipulation, sim2real transfer, reinforcement learning, and multi-task learning, closing the gap between research and real-world deployment. You will work where robotics research meets production systems. You'll combine hands-on technical work with scientific leadership to guide the team toward the most promising directions. Working closely with software engineers and scientists, you will turn new ideas into robust solutions for dynamic, unstructured home environments. Homes bring challenges that structured settings like warehouses don't, and consumer-grade sensors and actuators have real limits, so this work calls for creative, out-of-the-box approaches. Key job responsibilities - Lead technical initiatives in areas such as robotics foundation models, reinforcement learning and manipulation - - Design experiments to identify the limitations of current state-of-the-art models and developing new models or techniques that can surpass these models - Design and implement novel deep learning architectures that push the boundaries of what robots can understand and accomplish - Mentor fellow scientists while maintaining strong individual technical contributions - Collaborate with engineering teams to optimize and scale models for real-world applications - Influence technical decisions and implementation strategies within your area of focus - Experienced in communicating complex technical work to a non-technical audience - The ability to work with minimal guidance, be proactive and to handle ambiguity and the challenge of quickly evolving goals About the team Fauna Robotics, an Amazon company, is building capable, safe, and genuinely delightful robots for everyday life. Our goal is simple: make robots people actually want to live and interact with in everyday human spaces. We believe that future won’t arrive until building for robotics becomes far more accessible. Today, too much effort is spent reinventing the fundamentals. We’re changing that by developing tightly integrated hardware and software systems that make it faster, safer, and more intuitive to create real-world robotic products. Our work spans the full stack: mechanical design, control systems, dynamic modeling, and intelligent software. The focus is not just functionality, but experience. We’re building robots that feel responsive, expressive, and genuinely useful. At Fauna, you’ll work at the frontier of this space, helping define how robots move, manipulate, and interact with people in natural environments. It’s an opportunity to solve hard problems across hardware and software with a team focused on making robotics accessible and joyful to build. If you care about making robotics real for everyone and building systems that are as delightful as they are capable, we’re interested in hearing from you.
US, WA, Seattle
MULTIPLE POSITIONS AVAILABLE Employer: AMAZON.COM SERVICES LLC Offered Position: Research Scientist II Job Location: Seattle, Washington Job Number: AMZ10564041 Position Responsibilities: Interact with various software and business groups to develop an understanding of their business requirements and operational processes. Utilize acquired knowledge and business judgment to build decision-supporting and operational tools to improve the bottom line. Build quantitative mathematical models to represent a wide range of supply chain, transportation and logistics systems. Implement these models and tools through the use of modeling languages and engineering code in software languages such as Java, C++, C# or C. Gather required data for analysis and mathematical model building by writing ad-hoc scripts and database queries. Perform quantitative, economic, and numerical performance analyses of these systems under uncertainty using statistical and optimization tools. Create computer simulations to support operational decision-making. Identify areas with potential for improvement and work with internal teams to generate requirements to realize improvements. Design optimal or near optimal solution methodologies to be used by in-house decision support tools and software. Create software prototypes to verify and validate the devised solutions methodologies. Integrate prototypes into production systems using standard software development tools and methodologies. 40 hours / week, 8:00am-5:00pm, Salary Range: $136,000/year to $184,000/year Amazon is a total compensation company. Dependent on the position offered, equity, sign-on payments, and other forms of compensation may be provided as part of a total compensation package, in addition to a full range of medical, financial, and/or other benefits. For more information, visit: https://www.aboutamazon.com/workplace/employee-benefits. Amazon.com is an Equal Opportunity-Affirmative Action Employer – Minority / Female / Disability / Veteran / Gender Identity / Sexual Orientation.#0000
US, NY, New York
MULTIPLE POSITIONS AVAILABLE Employer: AMAZON.COM SERVICES LLC Offered Position: Applied Scientist II Job Location: New York, New York Job Number: AMZ10564066 Position Responsibilities: Participate in the design, development, evaluation, deployment and updating of data-driven models and analytical solutions for machine learning (ML) and/or natural language (NL) applications. Develop and/or apply statistical modeling techniques (e.g. Bayesian models and deep neural networks), optimization methods, and other ML techniques to different applications in business and engineering. Routinely build and deploy ML models on available data. Research and implement novel ML and statistical approaches to add value to the business. Mentor junior engineers and scientists. 40 hours / week, 8:00am-5:00pm, Salary Range: $172,400/year to $223,400/year. Amazon is a total compensation company. Dependent on the position offered, equity, sign-on payments, and other forms of compensation may be provided as part of a total compensation package, in addition to a full range of medical, financial, and/or other benefits. For more information, visit: https://www.aboutamazon.com/workplace/employee-benefits. Amazon.com is an Equal Opportunity-Affirmative Action Employer – Minority / Female / Disability / Veteran / Gender Identity / Sexual Orientation.#0000
US, TX, Austin
MULTIPLE POSITIONS AVAILABLE Employer: AMAZON.COM SERVICES LLC Offered Position: Data Scientist III Job Location: Austin, Texas Job Number: AMZ10593703 Position Responsibilities: Own the data science elements of various products to help with data-based decision making, product performance optimization, and product performance tracking. Work directly with product managers to help drive the design of the product. Work with Technical Product Managers to help drive the build planning. Translate business problems and products into data requirements and metrics. Initiate the design, development, and implementation of scientific analysis projects or deliverables. Own the analysis, modelling, system design, and development of data science solutions for products. Write documents and make presentations that explain model/analysis results to the business. Bridge the degree of uncertainty in both problem definition and data scientific solution approaches. Build consensus on data, metrics, and analysis to drive business and system strategy. Position Requirements: Master's degree or foreign equivalent degree in Statistics, Applied Mathematics, Economics, Engineering, Computer Science or a related field and two years of experience in the job offered or a related occupation. Employer will accept a Bachelor's degree or foreign equivalent degree in Statistics, Applied Mathematics, Economics, Engineering, Computer Science, or a related field and five years of progressive post-baccalaureate experience in the job offered or a related occupation as equivalent to the Master's degree and two years of experience. Must have one year of experience in the following skills: (1) building statistical models and machine learning models using large datasets from multiple resources; (2) building complex data analyses by leveraging scripting languages including Python, Java, or related scripting language; and (3) communicating with users, technical teams, and management to collect requirements, evaluate alternatives, and develop processes and tools to support the organization. Amazon.com is an Equal Opportunity-Affirmative Action Employer – Minority / Female / Disability / Veteran / Gender Identity / Sexual Orientation. 40 hours / week, 8:00am-5:00pm, Salary Range $159,200/year to $215,300/year. Amazon is a total compensation company. Dependent on the position offered, equity, sign-on payments, and other forms of compensation may be provided as part of a total compensation package, in addition to a full range of medical, financial, and/or other benefits. For more information, visit: https://www.aboutamazon.com/workplace/employee-benefits. #0000
US, WA, Bellevue
Within Amazon's North American Operations, we are tackling mission-critical problems to optimize network operations. We build complex causal, forecasting, and optimization models to better understand, predict, and govern processes across hundreds of warehouses. We are seeking a Data Scientist to drive the development of these models, deeply integrate with business stakeholders, and leverage generative AI to more intelligently build for our customers. Check out the hiring managers background - https://www.linkedin.com/pulse/from-nuclear-power-network-intelligence-david-plews-brittany-sdkbe/ Key job responsibilities - Interfacing with stakeholders to understand business problems and translating these into high and low-level design documents. - Building machine learning, optimization, and causal inference models that target business-specific challenges. - Sourcing, cleaning, and analyzing large and complex data sets associated with warehouse operations to provide business-critical insights at scale. - Leveraging AI-based solutions to drive development and provide nuanced insights into model outcomes. A day in the life You will be a single-threaded owner of projects within Amazon Operations, owning project scoping, stakeholder engagement, data enablement, and model development. Your work will be directly consumed by partner teams throughout Operations and Finance, and hence a strong sense of ownership is required to educate both technical and non-technical stakeholders on developed science solutions. About the team Our team is comprised of Data Scientists, Applied Scientists, and Economists, and are trusted to make data-driven solutions that power operations decision making. We strive to build consensus on divisive topics through clear presentation of problem statements paired with deep analyses that gain visibility throughout all levels of the organization from operators to executives.
US, CA, Santa Clara
Amazon Customer Service (CS) org’s mission is to make customer service interactions so good they become the primary reason customers choose Amazon. Customer Experience Products (CXP) supports this vision by building customer-facing solutions customers prefer because they work - reducing effort, shortening time to resolution, and building trust with every interaction. Our science team evaluates AI and Large Language Models (LLM)-driven solutions for both consumer-facing and CS associates-facing AI applications. We evaluate multi-modal, multi-turn, goal-oriented dialog systems (e.g. chatbot, voicebot) that can resolve customer issues and provide informational answers grounded by Amazon policy and help articles, at Amazon scale across multiple languages, intents and locales. These fine-tuned LLM solutions are designed to adapt to changing company policies and automate solutions to customer problems with conversational intelligence. Additionally, we're exploring with the partner associate-facing org on defining quality of LLM capabilities to improve the productivity of associates. Key job responsibilities - Lead development of Customer Service specific multi modal foundational models that improve chat and voice experiences. - Establish and evaluate rigorous testing and validation protocols for AI-driven systems. - Lead ongoing quality improvements for launched AI solutions - Collaborate closely with Product Managers, UX Designers, Applied Scientists, and Software Development Engineers. - Practice thought leadership and contribute to the overall science vision and strategic direction for AI-driven customer experience transformation initiatives. - Stay at the forefront of AI and machine learning technologies.
US, WA, Redmond
Amazon Leo is building a low Earth orbit satellite broadband network to deliver fast, affordable connectivity to customers around the world, including those underserved by traditional infrastructure. Operating a live constellation and its ground network at scale means service disruptions are an inevitable reality, and how quickly we detect them, understand them, and prevent them from recurring defines the trust we earn as a connectivity provider. We are seeking a talented Senior Data Scientist to build the next generation of observability and availability science for the Leo network. Leo already detects outages, notifies affected customers, and restores service. The frontier is prediction and prevention: reasoning over complex network and ground-segment telemetry to autonomously detect anomalies before they reach customers, attribute root cause automatically across a sprawling event surface, and rationalize a large, still-maturing metric set so responders trust what the system tells them. In this role you will work backwards from the needs of customers and operations teams. You will own the scientific direction end to end, partnering closely with network engineers, the Network Operations Center, and the Incident Management team, and the Software and Networking orginization to translate a long-term science vision into concrete research and delivery roadmaps. Export Control Requirement: Due to applicable export control laws and regulations, candidates must be a U.S. citizen or national, U.S. permanent resident (i.e., current Green Card holder), or lawfully admitted into the U.S. as a refugee or granted asylum. Key job responsibilities * Own the observability and availability science end to end, from long-term vision to research roadmap to production delivery, working backwards from the needs of customers, the NOC, and network engineering. * Develop time-series and graph-based models with dynamic baselining that detect network and ground-segment anomalies before they cross the High Severity threshold, enabling proactive investigation rather than reactive response. * Reason over complex, multi-system telemetry to attribute cause automatically during live HSEs and LSEs, so Call Leaders and engineers spend time mitigating, not hunting. * Provide the science behind the network's bucketed availability decomposition (geometric and satellite coverage, ground and network segments, customer terminals, payload, and planning), attributing every movement to a true cause rather than noise, so leadership steers on signal and engineering effort lands where it actually moves availability and throughput. * Deliver the models, analyses, and metrics that feed the daily system readiness and validation review consumed by senior leadership and product and engineering, turning availability and throughput data into a defensible, evidence-based read on progress against GA entry criteria. * Own the recurring, fleet-wide "hot topic" investigations that span ASIC, firmware, payload, network, and planning, separating correlated symptoms from true root cause across thousands of nodes, quantifying how much availability or throughput each is costing, and answering whether it is a launch-blocking risk and whether it is improving. * Deliver alert correlation and deduplication, false-positive reduction, and metric-quality scoring so responders trust what the system tells them, directly supporting a large, still-maturing KPI set. * Tie your science to the unit the org actually measures: reduce detection and attribution time, raise availability against the network's bar, and increase the share of events prevented before customer impact. * Partner day to day with the Network Operations Center, Network Engineering, and the Incident Management (Call Leader) program; sit on live HSE/LSE bridges as the science partner and turn event learnings into model improvements. * Feed COEs and RCAs back into detection and attribution so recurring signatures are caught earlier, and help design and score gamedays that stress-test both the network and your models against real, closed events. * Build and deploy production pipelines on AWS (e.g., SageMaker, Bedrock, Glue) with model validation, monitoring, drift detection, and explainability, because operations teams must be able to trust and act on model output under pressure. * Set data-science standards, mentor scientists, and drive best practices across the Leo networking organization as the science function scales. * Produce explainable output and written narratives that let responders and leaders three or more levels up act on your models during and between events. A day in the life You might start by reviewing overnight anomaly detections and availability movements, join an HSE bridge as the science partner by midday, and spend the afternoon refining root-cause attribution models or presenting availability findings at the readiness review. About the team Amazon Leo Networking Software builds and operates the software behind Leo's satellite and ground network. Our science function partners with the NOC, Network Engineering and Incident Management to make the network more available and resilient, moving from reacting to outages to predicting and preventing them. As a Data Scientist III, you'll help shape that function as it grows.
US, NY, New York
MULTIPLE POSITIONS AVAILABLE Employer: AMAZON.COM SERVICES LLC Offered Position: Data Scientist III Job Location: New York, New York Job Number: AMZ10444216 Position Responsibilities: Own the data science elements of various products to help with data-based decision making, product performance optimization, and product performance tracking. Work directly with product managers to help drive the design of the product. Work with Technical Product Managers to help drive the build planning. Translate business problems and products into data requirements and metrics. Initiate the design, development, and implementation of scientific analysis projects or deliverables. Own the analysis, modelling, system design, and development of data science solutions for products. Write documents and make presentations that explain model/analysis results to the business. Bridge the degree of uncertainty in both problem definition and data scientific solution approaches. Build consensus on data, metrics, and analysis to drive business and system strategy. Position Requirements: Master's degree or foreign equivalent degree in Statistics, Applied Mathematics, Economics, Engineering, Computer Science or a related field and two years of experience in the job offered or a related occupation. Employer will accept a Bachelor's degree or foreign equivalent degree in Statistics, Applied Mathematics, Economics, Engineering, Computer Science, or a related field and five years of progressive post-baccalaureate experience in the job offered or a related occupation as equivalent to the Master's degree and two years of experience. Must have one year of experience in the following skills: (1) building statistical models and machine learning models using large datasets from multiple resources; (2) building complex data analyses by leveraging scripting languages including Python, Java, or related scripting language; and (3) communicating with users, technical teams, and management to collect requirements, evaluate alternatives, and develop processes and tools to support the organization. Amazon.com is an Equal Opportunity-Affirmative Action Employer – Minority / Female / Disability / Veteran / Gender Identity / Sexual Orientation. 40 hours / week, 8:00am-5:00pm, Salary Range $175,100/year to $236,900/year. Amazon is a total compensation company. Dependent on the position offered, equity, sign-on payments, and other forms of compensation may be provided as part of a total compensation package, in addition to a full range of medical, financial, and/or other benefits. For more information, visit: https://www.aboutamazon.com/workplace/employee-benefits.#0000