Comparing Costs: IaaS vs. PaaS vs. SaaS for Mobile Game Servers
Tuomo Jorri •
What are you actually paying for when using IaaS (Infrastructure-as-a-Service), PaaS (Platform-as-a-Service) and SaaS (Software-as-a-Service) solutions for mobile game servers? The quick answer is that the easier a component is to interact with, the higher the costs will be of using it at scale. To understand this further, let's explore some examples in the piece below. By the end, you'll have a comprehensive understanding of the different factors affecting the cost dynamics of cloud service solutions.
In our previous article, we introduced the basic concepts of Infrastructure-As-A-Service (IaaS), Platform-As-A-Service (PaaS), and Software-As-A-Service (SaaS). Now it’s time to dive deeper and zoom into the dynamics of these different solutions in the realm of mobile game servers.
By the end of this article, you’ll have a firmer understanding of what you’re actually paying for when using IaaS, PaaS, and SaaS solutions, specifically with your compute environment and observability tooling.
Breaking Down Costs for PaaS vs. IaaS vs. SaaS
To break down the cost dynamics between IaaS, PaaS, and SaaS, we’ll have to do some generalizations. Although counter-examples can always be found relatively easily, some ways of capturing the differences are noted in the table below:
Should you prioritise control, cost, or ease-of-use in your infrastructure stack?
The general dynamic is that the higher the abstraction level goes (SaaS being the highest level of the three), the more costly the unit of consumed resource becomes.
At the same time, the indirect cost from active management required goes down.
That means the more actively you manage and control something, the cheaper it is to run.
Conversely, the more abstraction layers there are, then the less control and capability to manoeuvre you have, and the more expensive you can expect it to be.
This of course comes with its pros and cons. If you're cloud infra-savvy then more control at a lower cost is somewhat of a no-brainer. But if you're a relative novice and want to get started fast, then it more than likely makes sense to pay for a more plug-and-play solution that's more expensive.
The most typical example of this would be compute. Buying your own servers is expensive upfront, but excluding cost of humans to operate them, they are by far the cheapest long-term way of running compute.
Virtual machines by cloud platforms (i.e. IaaS) are slightly more expensive, but are still considered a commodity, although they again require someone to look after them.
You'll also need to know what you're doing in order to set these up - something we explore in greater detail later.
With PaaS, you start entering the world of managed container platforms, serverless compute, and similar topics, for which the cost goes up even more.
And at the far end, with SaaS, the metrics for what you are paying for might have changed altogether.
How much do compute environments cost?
To put some numbers to these, let’s assume that we need a relatively small, 4 vCPU server with 16 GB of memory and 100 GB of storage.
While estimating server sizing in practice is difficult, we typically start with an estimate of around 1000 concurrent users per core.
This would take us to around 4000 concurrents, or about 200,000 daily active users.
The above example is slightly contrived, but illustrates in a very rough fashion the dynamic of how the cost of a compute environment would behave if we strip it down to a toy example, while ignoring that each of these approaches has different sweet spots where they’d be used.
It's clear that when it comes to compute, IaaS is our cheapest option, but let's break down each of these costs in more detail.
Using A Physical Server For Compute
For example, a rack-mountable, entry-level server with these specifications would cost around 1000-1500 euros.
Using AWS Ec2 Instance For Compute (IaaS)
m6i.xlarge instance (4 vCPU, 16 GB) at 0.192 USD/hour + 100 GB EBS gp3 storage at 0.08/GB-month.
1 month cost: 138.24 USD for instance and 8 USD for storage = 146.24 USD/month.
Using AWS Fargate For Compute (IaaS)
CPU: 0.04048 USD/vCPU/hour, memory: 0.004445 USD/GB/hour, storage: 0.000111 USD/GB/hour.
1 month cost: 116.58 USD for CPU, 51.21 USD for memory, 7.99 USD for storage = 175.89 USD/month.
Using AWS Lambda For Compute (PaaS)
Billed primarily by memory, we’ll assume we want 2 Lambda functions at 8 GB per function running continuously at 0.0000001333 USD/1ms.
1 month cost: 691.03 USD for functions, 8.01 USD for storage.
How much does observability tooling cost?
Another example could be observability tooling, specifically Prometheus (Prometheus is widely used for metric aggregation and as a data source for visualizing metrics and other time series data.)
In this example, an infrastructure stack for a big game backend might include 300,000 active Prometheus time series, with every metric scraped once per 10 seconds.
This is the type of load you would be expecting to see in a very large scale game with multiple millions of daily active users.
For the sake of the example, we will consider three approaches: self-managed Prometheus (IaaS), AWS-managed Prometheus (PaaS), and Grafana Cloud (SaaS).
Again, you can clearly see that the IaaS solution is by far the cheapest option when it comes to how to set up your observability tooling.
Using IaaS For Observability Tooling
Starting with IaaS, we empirically observe this amount of load to consume around 1 vCPU and around 3-6 GB of memory.
The storage varies based on the amount of data retention, but we can assume that 200 GB should be sufficient for covering a couple of weeks of data retention at this sample size.
These specs could be satisfied by an m6i.large, which would cost 0.096 USD/hour or 69.12 USD/month for the instance itself. The storage would be around 16 USD/month for a total of about 85.12 USD/month.
*To keep the example simple, we will assume data transfer costs to be small based on the target metrics being scraped from close proximity.
Using Paas For Observability Tooling
For the AWS-managed Prometheus, the main cost drivers are the amount of samples ingested, metric storage, and querying.
With the same number of active time series (300,000) being scraped once every 10 seconds, we ingest about 77.76 billion samples per month.
Ingest pricing is 0.9 USD/10M samples for the first 2B samples and 0.35 USD/10M samples for the next 250B samples, putting our ingest costs at 2 831.6 USD/month.
With the same 200 GB storage as above, storage costs would be 6 USD/month. Querying costs 0.10 USD/B samples processed, but we won’t delve into that here.
Using Saas For Observability Tooling
Finally, Grafana Cloud charges 8 USD/1000 active series at 1 minute interval. Reducing the scrape interval to 10s would conversely increase costs by 6-fold. With our example case, the 300,000 active series would thus cost around 14.4kUSD/month.
Of course this is again a fairly superficial example and not an entirely apples-to-apples comparison. Each of the approaches has its own tradeoffs and the numbers are not fully comparable, but they are sufficiently in the ball park to illustrate the underlying dynamic in a case where the consumed resource is a metrics platform.
Another takeaway from this example is that even though the IaaS approach is drastically simplified, the fact it's much cheaper than the alternatives does allow ample room to architect a more robust and scalable solution if we only factor in the operational costs.
How much do server engineers cost?
To round off the series of examples, we should understand the cost of labor. Alongside pizza and beer, engineers often require other forms of payment as well, often in hard currency.
This is again a subject which varies greatly depending on many factors, including seniority and geographical location.
But a lazy and easy to calculate approach would be to assume that in Finland a competent cloud engineer would cost perhaps 100,000 EUR annually, including side costs.
With careful geographical selection, this can of course be brought down meaningfully, or by going to Silicon Valley the costs can go up equally meaningfully.
The key point here is that the less abstractions you use in the stack (i.e. choosing IaaS or PaaS services and components over the likes of SaaS) the more you will need to build and operate yourself, and the more you will end up spending money on staff and time in recruitment and management of teams.
To learn more about server costs for mobile games, read our comprehensive guide.