This short article explains the costs of operating browser games, importance of caching and why GameArter is not so fast as it could be. The post is suitable for all game developers and operators of any data-heavy websites.
You read it everywhere, everyday - speed, speed, speed. By default, today's internet users expect pages to be loaded within 2 seconds. Every next second reduces conversions (and revenues) by 7%.
Let's take a look on how we at GameArter deal with the speed of our servers and pages. We look at speed as a combination of 2 factors:
- speed of server apps
- speed of data transfers
Dealing with speed of server app is quite simple and cheap. Just select right hardware configuration, technologies and be clever about writing server applications. Based on application, there may be a maximum required processing time in tens of milliseconds.
Dealing with speed of data transfers is considerably more time demanding and expensive. There are 2 important factors we track:
TTFB (Time to first byte)
This is time between start of a request made by client to server till first byte of data is returned. TTFB is combination of server app speed and time of the data on the route. This time presents function of distance between client and server, line speed and server app speed. Importance of these three factors depends mostly on the distance. Even when we take TIER1 lines with pings on a level of physical values, TTFB between Europe and US may be near 700 milliseconds. According webpagetest.org, worst possible TTFB rating - F. With growing distance, optimizing speed of server app loses all sense. On server, you can get maximally low tens of milliseconds which you often need to reduce by hundreds of milliseconds. There are 2 way to achieve this:
- Run more servers in various geo locations. Server that is located closer to ending user greatly reduces time required for route of first byte between server and user. If you run worldwide-available service, you can have 3 servers - 1 in US, 1 in a central Europe and 1 in Russia. Accessing them may be done via load GEO balancer provided by Cloudflare.
- Use Cloudflare's novelty called Argo Smart Routing. Argo Smart routing is able to optimize route of web traffic and data in real time to find the fastest way to deliver data to a client. Based on our tests, Argo Smart Routing reduces time of TTFB by up to 60%. This way, even with one server available in central europe you can achieve great TTFB times in US and Russia, similar like in a case of 3 servers. On average, Argo Smart routing reduces the time required for all data transfers by 30%.
Time to download static content
Once html wrapper is generated in server app and returned to user's browser, all static files begin to be downloaded, uncompressed and loaded. These data are usually hosted via CDN (content delivery network) services with servers all around the world and thus near ending user which results in fast loading of required static files.
Price of it
From previous paragraphs you probably concluded, that delivering webpages and data in a short time is quite expensive operation. Let's look at real numbers:
Related TTFB optimizations, we mentioned a variant with more servers and load geo balancer provided by Cloudflare. Pricing of load balancer is dependent on number of requests. First 500,000 is free, included in a price of subscription ($5-$50), all next additional 500,000 queries are charged 50 cents, see Load balancer pricing section.
Next mentioned variant was Argo Smart routing. In this case, the price is $0.10 for every transferred GB of data (plus $5 to enable Argo). See more at Argo Smart routing pricing section.
Right selection between more servers with geo load balancer and Argo smart routing is always relative to ending use case and traffic. For everyone a different solution may be most cost effective.
However, needless to say that neither of these two is really optimal due to the lack of optimizations possibilities. Usually, static files are run from a cheaper CDN services with servers all over the world (we will look at this in next paragraph). In this case, files are already loaded from closer server to eding user so TTFB as well as transaction speed is usually sufficient. However, whether you use geo load balancer, or Argo Smart routing, you still pay for every request / transferred gigabyte of transferred data provided from the CDN. This fact increases costs significantly.
Price of CDN services is very variable, depending on amount of transferred data, zone, into which the data are transferred and especially selected CDN company. Most popular CDN service is CLaudflare which allows basic caching for free (limited to certain amount of transferred data).Cheapest CDN services are available deep below $0.05/GB.
What if we need as fast as possible TTFB and transaction speed?
Typical representative of this use case is provider of multiplayer solution for games - PhotonEngine. It's pricing consists of 2 parts - subscription with certain “bought” data limit (number of CCU * 3GB) and then payment of all transfered data over the limit. Similar to CDN services, price of data transfers is different for various zones. Here's its pricing for selected zones:
|Price per 1GB||Locations|
|$0.05||Europe / Canada, East / Russia / Russia, East / USA, East / USA, West|
|$0.10||Asia / Australia / Chinese Mainland / India / Japan / South America / South Korea|
As we can see from the pricing examples above, cost of quickly transferred 1GB of data is often $0.1.
There will be very interesting to see pricing set for Google's new project Stadia which is based on transfering huge amount of data in a lowest possible time. This may indicate not public cost of data transfers from a position of Google itself.
Price of running games
GameArter has filesize of games limited to 100mb. The price of loading 1 game reaching this limit with $0.1/GB, would be $0.01. On 1000 game launches, it would be $10.
Considering an 1 displayed ad per 1 game launch, we would need to reach CPM $10 only to cover the costs for transferring the data. If you are familiar with revenue from ads in various geo locations, you know that operating games with full speeds of data transfers is not profitable. Thus, GameArter had to go out of this route.
Data transfers are very expensive matter and thus there is need to keep game file sizes as low as possible, always with active caching. Although GameArter uses much cheaper, hybrid solution while speeds are still sufficient, data size is something every developer should really take care about, not only due to decrease user losses during game loading.