Dispatch rules in riak

Alan McKean alanmckean at me.com
Wed Feb 3 11:10:38 EST 2010

Kevin --

Thanks for the quick response ... I still have a question about this strategy.

If I implement the application in webmachine and call to the riak cluster with riak_client, won't I have to replicate the code that is in raw_http_resource.erl in my webmachine app when I want to hit it with requests that put data into riak? That was what made me wonder if I shouldn't simply add routes to Riak that could handle other types of requests other than 'raw'; e.g., requests for static files or data generated algorithmically.


On Feb 2, 2010, at 8:27 PM, Kevin Smith wrote:

> Alan -
> My preference in the situation you describe would be to write the application using webmachine and deploy it separately from the Riak cluster. Separating the application from the Riak cluster permits both components to be upgraded separately and at different times.
> As for interacting with Riak from your application, the riak_client module is a better choice. It provides access to all of Riak's features with the low overhead since the client and server are both implemented in Erlang.
> Does this answer your questions?
> --Kevin
> On Feb 2, 2010, at 8:35 PM, Alan McKean wrote:
>> I have been trying to set up my own routing rules to allow for serving up static files alongside the dynamic data that I server up from Riak, and any help will be greatly appreciated.
>> While there was a demo in previous versions of Riak taht showed how the dispatch map was set up (stickynotes), the latest version seems to not have a similar example. There is an example ('demo') in the apps/webmachine directory, and it shows how to set up dispatch rules in the webmachine_demo_sup:init/1, but it seems to have no relationship to riak. Can someone inform me about how to set up my own routes in Riak?
>> A related question regards architecture: is it preferable to have separate webmachine instances that are calling and load-balancing across a tier of Riak servers (via http or riak_client calls) or to embed your application in the Riak instances themselves and hitting them directly from the browsers? The question that I posed above relates to putting app logic in the Riak instances and controlling the routing to that logic. The other approach (fronting the Riak instances with Webmachine instances would either using http REST or duplicating code that exists in Riak for converting the incoming request data (e.g., json) to the raw_resource format that riak_client calls use.
>> Thanks
>> Alan
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

More information about the riak-users mailing list