开发者

SimpleDB as commenting databasae

I'm a newbie building a app that allows commenting on certain "articles." I could have many articles with an individual comment tied specifically to that article.

I'm thinking of using SimpleDB (already setup and running other components of my app). I'd us开发者_运维问答e one domain to store all comments across all articles and query this domain to pull in the appropriate comments when needed. Obviously as this scales I'll need to spread across multiple domains. I'm comfortable with limiting the comments to 255 characters or less.

Does this solution make sense? Are there any major downsides I'm missing?

Thanks!


Steven, given the limitations you are OK with (sharding across domains later when the app scales and 255 char limit) SimpleDB is a really natural fit for something like this. Actually, if you are OK with 1 more limitations of limiting comments on an article to 255 total, you could do this really cleanly by storing the following structure in SimpleDB:

itemName | comment1 | comment2 | ... | commentN
-----------------------------------------------
articleID| This is..| I like...| ... | Blahbl..

The articleID would just need to be whatever way you identify the articles in your system such that you could look it up quickly; then you could pull an item, with all it's attributes and you'd have all the comments, in-order, for that article.

If you wanted to change ordering (ASC/DESC) you'd have to do that at the app layer as SimpleDB won't apply a sort to your attrs, just to a list of items themselves.

This will also help keep your domain tighter so queries will run faster, longer.

If you need more than 255 comments per article, you can break them out into 1 item per comment, something like:

itemName | commentID | commentTest
----------------------------------
articleID| 1         | Ham is gr..

Then you can query easily for all the comments on an article and apply a sort ordering to the "commentID" field if you want them ASC or DESC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜