new to riak, unsure of data model for comment system

Dan Reverri dan at basho.com
Mon Oct 4 19:57:48 EDT 2010


Hi Zak,

I believe the practical limits you are referring to occur when you have
around 1000 links on an object. Also note, these limitations only apply to
the REST API.

Regarding the linked list idea, this would be difficult to implement since
there is no way to serialize your writes. If multiple comments are added to
an object the tail of the list may updated with several links concurrently.

Another method for storing a large number of links is to keep a list of
related keys in a separate object. The related keys would be stored as the
objects value rather than using headers. This method would require you to
write a custom map/reduce function to parse out the links and "walk" to the
related items. This method would only avoid the header issue seen in the
REST API. You would still have to collect all linked items and truncate to
20 in a reduce phase to emulate a "LIMIT" query.


Daniel Reverri
Developer Advocate
Basho Technologies, Inc.
dan at basho.com


On Sun, Oct 3, 2010 at 7:04 PM, Zak Fenton <zak.fenton at gmail.com> wrote:

> Hi. I've recently been using Riak to prototype a website. The data model
> for media objects and articles is a no-brainer, but I'm wondering about
> the best way to implement a comment system.
>
> This is my current plan:
> Media objects/articles are in the media or article buckets. Each such
> object can have any number of links to comments (the tag for these links
> is unimportant - does a link actually *need* a tag?). Comments go in the
> comments bucket, so to retrieve all comments for an object is a simple
> link walk of all links to that bucket.
>
> I read that there is no "artificial" limit on the number of links, but
> am I likely to run into practical limits if an object has hundreds of
> comments? Would I be better off having each object link only to the
> latest comment, and store comments in a linked list? The usual request
> for comments is something like "give me the last 20 comments for object
> Foo", so is there a more effective way of doing this than requesting all
> comments at a time (and probably cacheing the last 20 in the frontend or
> in a single Riak object)?
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20101004/ef31572c/attachment.html>


More information about the riak-users mailing list