BlogsModalResource Solver

Resource Solver

Resource Solver

1
posts
2025

Modal's platform now utilizes a sophisticated resource solver, powered by linear programming (LP) and the GLOP solver, to dynamically manage cloud compute resources. This system optimizes instance procurement based on real-time demand, pricing, and availability across multiple cloud providers. It ensures customers receive scalable compute at predictable and favorable prices, while also identifying arbitrage opportunities to reduce operational costs. The solver balances the dual mandates of rapid scaling and cost-efficiency, incorporating heuristics and feedback loops to maintain predictable solve times and adapt to observed cloud provider capacity limits.

2025

Linear programming for fun and profit

5/7/2025

This post introduces Modal's 'resource solver' system, which uses linear programming (LP) to manage cloud compute resources. It details how the system addresses the volatility of the GPU market by optimizing instance selection and scaling to meet customer demand at predictable prices. The post explains the evolution from a simple demand-satisfaction script to a complex LP problem involving multiple instance types, resource constraints (CPU, RAM, GPU), varying user demand, and fluctuating cloud provider prices. It highlights the use of Google's GLOP solver for production reliability and discusses the implementation details, including heuristics for pruning instance types to ensure fast solve times and a feedback loop for observed scaling limits. The solver's dual mandate of speed and cost-optimality is emphasized, positioning it as a core component for Modal's serverless infrastructure.