MCKapur
MCKapur

Reputation: 9157

How should I architect Amazon Web Services for my app?

I am planning a social-networking app I am about to develop. I already have experience in using many AWS services, which are: SES, SimpleDB, DynamoDB, CloudFront and S3. I am open to learning more any time.

Basically in the app, you have status updates. Each user has an account, can upload their own status updates, like, comment on a status update etc. The user can check out the most liked status update in the last 'x' hours, and can also search the whole database for status updates by searching for a username or searching for status update keywords -- like YouTube tags that users specify upon creation.

Here is my current schema:

So, when the user wants to see the most liked status updates for the last day, it range queries DynamoDB to find the most liked status update within a timestamp of 24 hours. If the user wants to search for tags of a status update, DynamoDB would have the tags attribute and query for it. But can DynamoDB query for strings? See if strings are matching? I do not think so... I would not like to scan DynamoDB and individually match keys based on their format. Naming convention could include attributes inside, for example a key name for a status update could be:

max:UploadedQuote:ijfi93nSNDiI:numberOfLikes="3499"

or something like that

This is because the scan limit is 10 MB, which I think with an average and active user base might not work out, I do not want to send multiple requests and bloat the app. If the user wants to view somebody's account, it finds the key on SimpleDB and loads it on S3.

Obviously status update's by a particular user would have to be organized into their account object, but I need a separate object to hold all the status updates (DynamoDB) -- otherwise how can I let the user search status updates throughout the whole database?

I think the hardest part is the sorting by likes and tags, I need to somehow have a database like DynamoDB, fast and scalable but be able to query like SimpleDB. I would like to only use AWS though. I know this is possible as I know an app called PanoPerfect that uses AWS, they have fairy similar functionalities to what I plan. I wonder how their architecture runs. Instagram does too!

Obviously hosting all the status updates on SimpleDB makes more sense because you can query them properly, Im not even sure the querying on DynamoDB works as I plan, but if I host every single status update it will overflow SimpleDB and bloat it. DynamoDB can be expensive though.

Is there a better schema to this? Should I use CloudSearch for searching instead of this DynamoDB process? Is CloudSearch available on iOS? What about EC2? How does that work? I'm quite unsure how I can architect my app with AWS at this stage of planning.

Thanks for the help!

Upvotes: 3

Views: 1249

Answers (1)

BraveNewCurrency
BraveNewCurrency

Reputation: 13065

It sounds like you are determined to use one of Amazon's NoSQL databases. If it doesn't work, don't use it.

My advice would be to build the simplest thing possible and focus on getting users first. Twitter, Facebook, Ebay and every other top 1000 site started with a regular database, and worried about scaling when they got popular.

If you are really worried about scaling, look into CouchDB, Cassandra or Riak. They have simple semantics for scaling. (Unlike MongoDB or MySQL, where you have to do complex manual sharding.)

can DynamoDB query for strings? See if strings are matching?

You can only query on primary index or secondary indexes. You could project your tags into a secondary index. But they you could only query on exact tag matches.

Is CloudSearch available on iOS? What about EC2?

Yes. Like all services, it's a web API.

How does that work?

That's not really a question for Stack Overflow

Upvotes: 1

Related Questions