Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Amazon EC2 & DynamoDB or Google Compute & Datastore

Discussion in 'General Discussion' started by eskovas, Jul 8, 2014.

  1. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Hello,

    I've been researching some server hosting services and DB hosting services, and got down to choosing between 2; either Amazon EC2 and DynamoDB or Google Compute and Datastore.

    Anyone here have developed any game using one of these solutions?
    How was your experience?
    How expensive can/did it get?
    Would you have chosen other solution if you already knew what you know now?

    DynamoDB has a .NET C# SDK. Does it work well if used in Unity for communicating with DynamoDB (server side only of-course)?

    I honestly don't know which one to choose, but i'm more inclined to choose Amazon's solutions.

    I already have a DB created inside Riak, used in UnityPark, but i'm switching networking solutions, and these new DB solutions function with NoSQL, which i believe Riak also uses ( slightly different ), so the switch won't be too problematic.

    Some help would be greatly appreciated :)
    Thanks,
    Tiago
     
  2. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    As a user of DynamoDB I absolutely love it. It's fast, usable, scalable, and just does what I need it to do. I know nearly nothing about Google datastore, so I can't really compare.

    The .NET C# SDK for DynamoDB was nice, but every single time I wanted to do something, it was becoming quite verbose and I was really worried about Unity waiting for replies to stuff. It does offer async methods, but in their async methods they documentation actually says you should pause the main thread to wait for it. Uh... that makes no sense to me, so [plug] I wrote something to assist the process (in signature.)

    Regardless of the plug, it's more about being reliable and usable and it certainly is. The whole pricing models is based on reserved throughput, and total data size, so there is no bandwidth costs I believe. Forgive me if I'm incorrect... but they have a pricing calculator @ http://aws.amazon.com/dynamodb/pricing/

    I like it a lot. I like being able to scale up/down as needed for bandwidth. Also there is a local DynamoDB you can install on your desktop for testing, should you desire not playing with live data.

    As for cost, even @ 100 reads/sec and 20 write/sec it's like $12 USD monthly. I surmise the price will just go down over time as it always does.
     
  3. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
  4. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    @Yukichu

    Thanks for the info :)
    From what i saw, the Google DataStore is quite similar to DynamoDB. It has different pricing and doesn't have a .Net SDK.
    Here's the official page : https://developers.google.com/datastore/

    I saw your asset, and also saw another one, but wasn't sure if the original AWS SDK worked well in Unity.

    I'm also not so sure about how amazon's free tier works.
    They say:
    Is that for each table we create, or is it like a global capacity we can use?

    Thanks again :)
     
  5. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    The free tier is the global capacity. For example, you have a table using 3 write, 4 read... okay, you have 2 write and 6 read leftover. It's just cumulative. The storage I believe is cumulative as well. Actually, I just went out to make another table to be sure, and it says those numbers you quoted above is per-account. So it is cumulative.

    The AWS SDK works fine in Unity. It's just verbose at times and trying to work with it can get a bit tedious... but it works and works well when you know what you're doing. Also, as I stated before, the async methods want you to pause the main thread, and *trying to remember, I did most the legwork months back as you can see I waited nearly 2 months for asset approval* you cannot put the async methods inside a monobehavior, as their callback is no longer on the main thread. As such, you may run into blocking, so you then have to worry about threading it all.

    Also, using the option where you can just save a whole class into DynamoDB is wonderful; however, it doesn't work with a monobehaviour as it tries to save a ton of things that are null, and you cannot save empty strings or nulls. You'd either have to explicitly check/update everything (somehow), or... I just make the data classes that save/load as needed.

    There's just a bit of reading involved, but the AWS SDK works just fine with Unity - make sure to change your project to full .NET 2.0 and not the subset or you'll wonder just wtf is going on for a while.

    All in all, I still love DynamoDB. You've inspired me to read about Google Datastore though, thank you!
     
  6. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Thanks again.
    Now i'm not so sure about DynamoDB, since it'll probably be too expensive for me...

    I think the most common problem with multiplayer indie games, is that indies simply don't have the money for multiplayer things. Well, for most indies.

    Yeah i also loved that in Riak
     
  7. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    May I ask what makes it too expensive? I actually thought it was kind of cheap. 100 reads/second and 20 writes/second for $12 a month doesn't seem that bad? Maybe I'm crazy. Also, when I think something could be writing a lot, I just make a cached local object holding all the data that is persistent beyond the player coming/going.

    Ah well. I understand the UnityPark thing completely.

    Wow, just watched a vid of you game. Nice.
     
  8. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    Well, now that i think of it, maybe it's not so bad.
    Maybe i'm too ambitious with my game. Making a multiplayer game with almost no money is quite a challenge :p
    That's why i decided to switch from UnityPark... close to 700€ for an indie license is too expensive for me right now and i would also still need servers to host Riak and servers, and would be more difficult to manage Riak servers by myself.

    My game will have ranking, weapon statistics, game type statistics, general statistics and more, so it will need to have many tables and that's what worries me.
    I don't intend to write all the time to the database, only when a game ends, or a player saves his loadout. I don't see other times i will update the database regularly, except when a new player is registered.
    Reads are a bit more tricky. When in a game server, the server could cache player's info, but when not in a game server, things could escalate with many people trying to update their loadout or checking their stats all the time. Maybe the lobby server could save logged-in player's stats or something.

    Now i'm probably asking questions that are already anwsered on their page, but do you know if i can monitor all the data,read,write, etc from the local DynamoDB on my PC?

    Thanks for the comment :)
     
  9. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    Honestly, I've never used the local DynamoDB, probably because it doesn't completely simulate the actual environment as there are near instantaneous read/writes, etc. and I want to see what the actual thing is going to take.

    Yeah, you made me go look up this for you :p

    Differences Between DynamoDB Local and DynamoDB
    DynamoDB Local attempts to emulate the actual DynamoDB service as closely as possible; however, there are several differences:

    • Regions and distinct AWS accounts are not supported at the client level.
    • DynamoDB Local ignores provisioned throughput settings, even though the API requires them. For CreateTable, you can specify any numbers you want for provisioned read and write throughput, even though these numbers will not be used. You can call UpdateTable as many times as you like per day; however, any changes to provisioned throughput values are ignored.
    • DynamoDB Local does not throttle read or write activity. CreateTable, UpdateTable and DeleteTable operations occur immediately, and table state is always ACTIVE. The speed of read and write operations on table data are limited only by the speed of your computer.
    • Read operations in DynamoDB Local are eventually consistent. However, due to the speed of DynamoDB Local, most reads will actually appear to be strongly consistent.
    • DynamoDB Local does not keep track of consumed capacity. In API responses, nulls are returned instead of capacity units.
    • DynamoDB Local does not keep track of item collection metrics; nor does it support item collection sizes. In API responses, nulls are returned instead of item collection metrics.
    • In the DynamoDB API, there is a 1 MB limit on data returned per result set. The DynamoDB service enforces this limit, and so does DynamoDB Local. However, when querying an index, DynamoDB only calculates the size of the projected key and attributes. By contrast, DynamoDB Local calculates the size of the entire item.
     
  10. eskovas

    eskovas

    Joined:
    Dec 2, 2009
    Posts:
    1,373
    haha, sorry about that :p you didn't have to do it.

    Thanks for the help :)

    I guess i'll try making something simple enough that won't hit the max free tier, and if everything works fine, then i'll expand on it. I'm mostly scared about the weapons statistics and unlocks tables. I guess i'll try to condense as many things as acceptable into one table.

    100 reads/second and 20 writes/second for $12 a month is actually very affordable and shouldn't be a problem for testing purposes
     
  11. rcober

    rcober

    Joined:
    Jan 26, 2013
    Posts:
    52
    Depends on what you want/need.

    IMHO EC2 is awesome.

    Complete control and flexibility.

    Fast reliable.

    Includes stuff like Load Balancing, San based Block Storage, elastic IPS.

    Scale great.... costs about $50/node per month and up...
     
  12. Chris-HG

    Chris-HG

    Joined:
    Aug 10, 2012
    Posts:
    63
    We host our own server... it's not like our game is a million dollar hit so traffic is negligible.
    For the back-end we use eXist-db.

    -c
     
  13. Sisso

    Sisso

    Joined:
    Sep 29, 2009
    Posts:
    196
  14. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    Huh, Parse looks pretty neat. Then I changed it to 40 requests/second and it was $100 a month. What does $100 a month get me with DynamoDB (or others...?)

    500 reads/second
    100 writes/second
    2 GB data in
    2 GB data out
    20 GB storage

    Parse sounds awesome so long as you never exceed the free tier. Still a bit shady on what a request per second is... does that include writes too? It must, I don't see anything else.

    Free tier sounds awesome though. Not sure on the business model with that, but it's their money.