As an indie developer i guess you are pretty familiar with the issue of a limited budget, and as we all know servers for hosting an application can be very expensive and you need quite some knowledge if you want to manage and configure or even cluster a server yourself.
So here I’m going to cover my experiences on the hunt for a good solution for ZeroPilot and what I found is one of the best solutions for this issue in terms of a good cost/benefit ratio.
So, before explaining why, I’m just going to tell you the solution I’m working with right now:
And here is how it works:
Heroku is used for the hosting of the app itself. All the persistent data is stored on Amazon DynamoDB, and Redis is being used for the data of all users, that are currently online playing the game.
Why I chose a setup like this:
As there is no single solution, that “has it all”, or at least non that I know of, that offers reasonable pricing, I tried to utilize all the good aspects of each service, starting with DynamoDB:
1. Amazon DynamoDB
Amazon DynamoDB is a scaleable database solution by Amazon Web Services, that is based on SSD-drives and is VERY easy to integrate. The free plan includes 10 reads/sec, 5 writes/sec and 100MB of storage capacity – now if you just look at the numbers it may not sound like a very good deal – however if you use it the right way, this becomes actually pretty usefull.
Looking at the capacity: 100MB, for ZeroPilot this about enough space to store the data of a little more than 200.000 users, doesn’t sound too much, but as soon as you start paying for the service, even if it is just 5$ a month, they remove the storage limit.
Read/Write thoughput: 10 reads and 5 writes / second doesn’t look to good either, however I only use this database for offline and persistent data. So whenever a user logs on, the data is read once and saved to Redis, when the user logs off, the data is written from Redis to DynamoDB. Whenever you would reach the limit of your throughput the SDK automatically waits a certain amount of time and does a retry for the query.
The pricing for DynamoDB is for each:
(details at: http://aws.amazon.com/dynamodb/#pricing )
50 read/sec: 1cent/h
10 write/sec: 1cent/h
So with the free plan, about 36.000 users could logon to the app per hour
and for about 14$/month about 180.000 users could logon each hour.
An alternative to this would have been MongoLab(MongoDB), as it has 240MB of db-storage in it’s free plan – it is also pretty easy to integrate and as far as i know there is no limited in throughput. However I decided to go with AWS as they really make it easy for you providing and SDK for pretty much any language and having a very good documentation. Even though I already found one thing, that was bugging me: All Number-Values of DynamoDB are stored as
2. Redis (Redis To Go)
Redis is a Key-Value-Storage, that sits in the RAM. It has an extremly low latency and can story all primary datastructures: Strings, Lists, Sets, Hashes
I use this in ZeroPilot for the data of users, that are currently online, as there is basically no limit in throughput in all the plans of Redis To Go this is the perfect solution, since online players are making requests all the time, when starting a game, when finishing a game ect. However, since Redis sits on the RAM, storage is expensive, and that’s why the free Plan only includes 5MB. For 5$ / month you can get 20MB of storage, which is enough for about 4200 players being online at the same time, unfortunately i’m FAR away from that
Heroku is awesome! Why?
- there is a pretty extensive FREE plan
- you can run pretty much any language
- it has integration with A LOT of addons
- you scale up the capacity of your plan at any time
- automatically adds a template for your new app if you want
4. Facebook Score API
The facebook score api is the smallest part, it’s not really needed but takes a few queries of my back. So when a user gets a new highscore, it is sent to facebook, and stored there. And when a player logs on, instead of querying the current scores from DynamoDB the scores are queried from facebook.
I hope this helps you finding YOUR “perfect” solution. Here are all the links again:
- Heroku: http://www.heroku.com/
- AWS DynamoDB: http://aws.amazon.com/dynamodb/
- Redis: http://redis.io/
- Redis To Go: https://addons.heroku.com/redistogo
- MongoDB http://www.mongodb.org/
- MongoLab: https://mongolab.com/home
- Facebook Score API: https://developers.facebook.com/docs/score/