Yashveer Singh
Connect
<- All posts
Software Costs and Budgeting6 min read

Hosting Cost Optimization: From Ten Thousand to a Million Users

Hosting cost optimization is the process of matching your infrastructure spend to your actual usage patterns at each stage of growth. The goal is not to run the cheapest infrastructure. The goal is to avoid paying for capacity you do not have and to avoid running out of capacity at the moment you need it most.

Written by Yashveer Singh, founder of Yashveer Labs.

What you need to know

  • Hosting costs scale non-linearly. A setup that costs 200 dollars per month at ten thousand users can cost 8,000 dollars per month at a million users if no optimization happens in between.
  • The biggest savings opportunities are usually in compute right-sizing, database connection management, and egress cost reduction, not in switching cloud providers.
  • Most hosting cost problems are architecture problems in disguise. Unindexed queries, N+1 patterns, and missing caches show up first as scaling costs.
  • Every cloud provider has a free tier and a commitment discount tier. Understanding which workloads qualify for each one is worth a few hours of your engineer's time.
  • The best time to optimize hosting costs is just before you hit a pricing step function, not after the bill arrives.

The core argument

The startup hosting cost conversation usually happens in two moments: when the founder first sets up infrastructure and when they receive a bill that surprises them. Neither moment is the right one. The right moment is the transition from each user tier to the next, because that is when the architecture decisions made in the previous tier become visible as costs in the next one. A monolithic server that worked at ten thousand users does not fall over at a hundred thousand. It just costs three times as much to keep running at the same performance level, and you pay that cost every month until you fix the underlying structure.

The optimization levers change at each scale point. At ten thousand users, the primary lever is right-sizing compute. Most early-stage apps are massively over-provisioned because the default instance sizes are generous and the pain of being under-provisioned once is still fresh in the founder's memory. At a hundred thousand users, the leverage shifts to caching and database optimization. The queries that ran fine at low volume now show up in the slow query log, and the origin server is serving files it should be serving from a CDN. At a million users, the optimization becomes architectural: read replicas, regional distribution, background job separation, and egress routing.

The practical trap I see most often is founders who optimize the wrong layer. Switching from AWS to a cheaper provider while leaving N+1 queries in the codebase saves twenty percent on compute and loses it again in database costs within sixty days. The cost problem is almost never the provider. It is the pattern. I have worked through this optimization path on several client projects, and the sequence that works is always: fix the queries, add the cache, right-size the compute, then consider provider or commitment pricing. Doing it in any other order wastes the engineer's time and gives you a lower bill for the wrong reason.

Common mistakes

  1. Switching cloud providers to save money without addressing architecture. The cost difference between major cloud providers is smaller than the cost of moving and the cost of fixing bad patterns. Fix the patterns first.
  1. Over-provisioning compute as a buffer against performance issues. Excess compute is expensive and often masks application problems that will surface at larger scale anyway. Monitor actual utilization and size accordingly.
  1. Not using a CDN for static assets. Serving images, CSS, and JavaScript from your origin server when a CDN would cost less and deliver faster is one of the most common early-stage hosting mistakes.
  1. Ignoring data egress costs in architecture decisions. Moving large amounts of data between services, regions, or out of the cloud adds up quickly. Model these costs before designing data pipelines.
  1. Running development and staging environments on production-grade infrastructure. Non-production environments should run on significantly smaller instances. I have seen staging environments costing more than production because no one questioned the original setup.

Where to start

  1. Pull three months of billing data and find the top three line items. In most cases, compute, database, and bandwidth are the top three. Pick the one with the highest growth rate and investigate it first.
  1. Check your database query performance. Run the slow query log for forty-eight hours. Any query taking more than 100 milliseconds that runs more than a hundred times per day is a hosting cost problem wearing architecture clothes.
  1. Audit your static asset serving. If your origin server is returning images or JS files directly to browsers, add a CDN layer before anything else. The cost reduction is immediate and the performance improvement is measurable.

Related reading

FAQ

Frequently asked

Author

A note from Yashveer Singh

This was written by me, Yashveer Singh. The reason I write at this length and this depth is that the alternative is generic SEO content, and I am not interested in being one more of those. If you found this post useful, that is by design. If you want to talk about the project you are facing, the work happens through one channel: send a message via Instagram, and I will get back to you with a real answer, not a templated reply.

Related reading