Pages

Oct 16, 2012

Costs of a cloud gaming backend


There's a critical eye on Cloud Gaming right now, especially with the purchase of Gaikai by Sony and OnLive’s metamorphosis having just occurred. So the question lately has been “Is cloud-gaming still the future?”  In order to answer that, we will need to have a technical look at the process involved, and hopefully understand a bit more about the cost of this process.
Mario knew what it took to get cloud-gaming working; Cutting corners at all costs.


Understanding how a video service works


Most video services, like YouTube work by caching the video data on a CDN, serving the content to clients via video streaming. A technology that will send small chunks of compressed video content to the client, which consumes and combines to display to the user while new chunks are coming in. Which takes advantage of the fact that sending 30 seconds of compressed video data to the client should be faster than the 30 seconds it takes to display it to the user. This allows video streams to buffer and load over time; that is the whole file isn't getting transferred to you, but small chunks of it, which then allow something to be displayed while the rest of the content is loading behind the scenes. This isn't a new concept, but it’s an important one to ensure that you’re not waiting for the ‘whole freaking video’ to come down before being able to see the first frame of the video.

Live video streams work in much the same way; You have a point of origin that’s generating frames, compressing them, and uploading them to a server cache, which broadcasts them to clients through the inter-tubes. Clients around the world who are watching the ‘live stream’ will be getting content from the server cache, and displaying as it can receive it. As such, there’s generally a significant delay between the live event and what’s seen on the internet to viewers; Not only does it take time to capture, compress, and upload the data to the server, but then it has to come from a single-physical location to a single location in the cloud. Which generates a large latency bottleneck for most live-streamed events.
These delays are generally forgiven by the end user. They have no way to know that their data stream is delayed, other than to compare it to a live-viewing. Most importantly, there’s no gauge to know how slow things are compared to the live event. It’s really a black box.

Interactive Video breaks the rules.

Cloud gaming is best thought of as “Interactive Video” a term which removes some of the mystique and business hype from the equation. Interactive video changes the concept of streaming video, since input from the user directly changes what the video content will be over the next few seconds. The video stream is now dependent on the user input, which the user feels it can gauge. So latency is very noticeable to the user.
The first thing interactive video breaks is that clients can no longer buffer-present the video frames to the user, as it does not know what the future frames are going to be yet, given the current state of user input. This means that the speed in which the client grabs the input video data off the wire, directly gates how fast they can render them on the screen. The best the server can do is render frames that may not be dependent or updated by the user input, waiting for that to be received.
As such, interactive video is very concerned about latency and lag, since it’s actually noticeable by the user. Most models for cloud-gaming services build an estimation of ~100ms for latency between input controller and user seeing a visual on the screen.
A standard desktop game running @ 60fps expects about 16ms for a frame of the game. For an interactive streaming service though, this gets tricky. Let’s assume you've got a 4ms ping from server to client, this already gives you only 12ms left to compute your frame. Then the server box has to compress it, let’s give that 2 ms, and this leaves your frame with about 10ms of time to compute in order to stay @ 60fps.

Understanding cloud-compute in relation to video streaming

Since interactive video needs to compute something, the data can’t just be distributed from a CDN to the masses. No, we need the power of Cloud Computing to drive this beast. Think of cloud compute as a large automated way to run chunks of code across millions of cores, resulting in awesome performance. Services like Google Compute Engine offer the ability to upload applications which can be run across thousands of cores online.
Our cloud gaming service will spin up a box on the cloud and start the game. Once a connection to the client is established, a stream of video frames will be captured, compressed and sent to the user through a socket connection. Thankfully, we can continue to send frames to the client at regular intervals, even the server hasn't received input yet.
It should be clear that the infrastructure to do this is not easy, or cheap to put together. Google already has data centers across the globe, with machines sitting around already. A private company attempting to produce the same results would have to dump hundreds of millions into setting up the same physical structure to compete in the same regard. So it’s not wise, if you were trying to build a system, to create your own hardware racks; Trust me.

The costs of doing business

Using these types of cloud compute services come with a cost however. Just to toss a dart towards a number, let’s assume that your cloud-gaming service has 3.4 million daily active users, each one receiving 1GB of video in a day. At H.265 compression should be roughly 46 minutes of play time, or around 2.6 million hours of computation a day to compute the video stream.
In this scenario, we should note that the costs of using GCE are two fold:

  1. $1923 to transfer 1GB of data to 3.4 million users
  2. $377,000 to hold the compute machines for 2.6 million hours

With some estimated math, these numbers might be obtainable, if you assume that each user is paying $5 a month fee, which would net you around $17,000,000 /mo.
Engineers reading this should have an immediate gut reaction to that number. Holding a single cloud-instance machine for an entire 46 minutes for a single client is obviously not utilizing all the resources on the box. If we were able to multiplex the machines, putting X users on each machine, we can cut the daily costs by X users-per-box. So, if we allowed 10 players to share a single box, that would cut our compute costs per day down to around $37,000 / day.

Skew all the numbers

And these numbers only include CPU side computation, completely ignoring GPU overhead. GPUs generally pull more wattage, and introduce more instability into a server rack, resulting in higher costs for cloud compute. In addition, trying to host multiple client sessions on a single GPU isn't an easy task; most games have a hard enough time making the GPU work properly with one instance of the game, not to mention multiple ones.
Thankfully this is getting easier, recently NVidia announced their new GeForce GRID hardware, which comes with hardware video compressors, alongside lower power wattage consumption, and the ability to virtualize, or mutli-slice the machine. This means you can run multiple game instances on a single box, reducing the cost of compute time. For instance, the Nvidia brochure denotes the ability to run 4 streams per GPU, reducing the daily cost for 3.4 million down to $94,250 / day; assuming that there’s no modifications to cost for extra GPU support (which is naive to assume.)
These modified GPU racks also have a separate optimization, reduced wattage.  If you calculate the wattage of the average household GPU, * 3.4 million, you end up with about half the daily output of Hoover Dam.

Reality though is that $5 a month may not be tolerated by most gamers. Certainly the 3.4 million DAU are free players, which if you roughly estimate 2% are willing to pay $5/mo for a premium service, would result in around 68k players, paying $5 a month, resulting in ~$11k  in revenue a day. Which is not exactly a slam dunk in the business sense.
However Sony did buy Gaikai, and we’re seeing other competitors popping up, including your local Cable providers. So there’s got to be some numbers that I’m not factoring in.

What’s it mean for game devs?

As we see more of these services pop up, I estimate we’ll see more service fragmentation as everyone rushes to get a critical mass of users-to-games ratio. A post-nuclear view could be a world where video-streaming services are as prolific as flash-portals are today. As noted though, the cost of investment is so high, the number of platform holders will be quite small.
For a game developer, this is generally a good thing; you’ll be able to use these streaming services to make your game easier to access, even allow users to try your game for free w/o having to modify your application, segment assets, or pay to transfer data to that user.
Cloud gaming silos should be looked at in the proper light, they are still silos, with the issues and benefits of it, attached alongside a tool for webification. Until these items truly take off the ground, it’s difficult to predict when all the planets will align, but chances are, it’s still on the horizon.



~Main

You can find Colt McAnlis here:

  

3 comments:

  1. It is a interesting business proposition. I tried onlive a year ago or so, and although it was pretty decent, the latency on things was clearly noticeable. Also, sometimes the details of things just does not come through on the compressed video stream.

    I woud be happy to pay for a service that (for instance) let me play any game that I have bought on steam through a video stream. The thing that makes me hesitate isn't the price (I would probably be willing to go up to around 50$ a month), it is the latency. If I am playing video games, I want it to be a premium experience. No latency, full resolution, compression that is so good I can't reliably tell if from "local" rendering.

    I think the physics on this cloud gaming just don't work out; latency at great distance is just too appreciable a thing. Perhaps in the future every major city will have its own "cloud gaming" server, with a fat pipe directly to your ISP? On that day I think cloud gaming may be a viable platform. Here's hoping, but who knows.

    ReplyDelete
  2. I am very much pleased with the contents you have mentioned about cloud game server hosting.I wanted to thank you for this great article. I enjoyed every little bit part of it and I will be waiting for the new updates.cloud game server hosting

    ReplyDelete
  3. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    Melbourne Web Developer

    ReplyDelete