Slow Riak issue
jeremiah.peschka at gmail.com
Sat Aug 27 09:08:40 EDT 2011
I've CC'd in OJ and the riak-users lists on this.
Jeremiah Peschka - Founder, Brent Ozar PLF, LLC
Microsoft SQL Server MVP
On Aug 26, 2011, at 11:35 PM, Neil Unadkat wrote:
> Hey Jeremiah,
> I tried using CorrugatedIron, but it used to connect only to the nodes i had started on my machine. As in, i had 2 nodes running on my mac os, and i have a vm running windows 7, through which using CorrugatedIron i could connect and write to those nodes.
I develop CorrugatedIron in a Windows 7 VM on OS X. I had to do a few things to get CorrugatedIron in Windows to talk to Riak in OS X:
1) Configure Riak to listen on 0.0.0.0 - this will listen for connections no matter which IP they are asking for.
THIS IS UNSAFE TO DEPLOY INTO PRODUCTION.
SET THIS UP PROPERLY WHEN YOU MOVE TO PRODUCTION.
2) Set up a loopback adapter that listens on a specific IP - this makes it easy to set up a DNS alias on your localhost and VMs.
3) Set up a DNS alias in /etc/hosts
4) Use the host name instead of the IP address. You can see this in all of the CorrugatedIron code, we use host names instead of IP addresses.
I have aliases in my .bash_profile to add and remove loopback adapters. It looks like this:
alias add_loopback='sudo ifconfig lo0 alias 10.0.0.22'
alias remove_loopback='sudo ifconfig lo0 -alias 10.0.0.22'
/etc/hosts on OS X has this line in it:
and the Windows hosts file (C:\Windows\System32\drivers\etc\hosts) has this line in it:
> Just 2 days back i could manage to talk to the other nodes i had setup on another machine through CorrugatedIron. But still everything is quite slow. I have enabled the PBC interface on the nodes.
> Even if we use the C# native classes for HTTP it should take too long right?
HTTP is going to be orders of magnitude slower than Protocol Buffers. There's an exceptional amount of overhead involved in HTTP, especially for small messages. CorrugatedIron will use Protocol Buffers for almost all operations. There are a few operations that are not supported by Riak's API so we have to drop down to HTTP requests for those.
Riak's performance is going to be bound by the speed of your hard drive. Every write that Riak performs goes to disk. There is no buffering like you would see with MongoDB (or even buffering of data like you'd see in an RDBMS). If you are using a laptop and you're using the HDD that came with it, you have a 5400RPM hard drive which is by all standards an incredibly slow drive. You can compound that with 3 Riak nodes running on the same drive AND one of those nodes running on a virtual environment AND it's a slow laptop HDD with poor caching. I suspect you can see how this would not be the fastest thing on earth.
For development purposes, it's advisable to use a single Riak node running on bare metal (a non-virtualized OS). Once you move into production you can either change the configuration in CorrugatedIron to use multiple nodes or you can use a proxy/load balancer to push your writes out to all of your Riak nodes. The benefit of using an abstractions we've built into Corrugated Iron is that you don't need to worry about the physical implementation - you can a configuration and you're good to go.
> On 26 August 2011 20:04, Jeremiah Peschka <jeremiah.peschka at gmail.com> wrote:
> Hi Neil,
> Which one of the .NET clients are you using? If it's CorrugatedIron, let me know and I can work with you off list to get things connected (OJ Reeves and I maintain it). I don't think the other two libraries are getting much maintenance and attention at the moment.
> If you can't connect, have you looked into the app.config to change the IPs that Riak will bind to? By default it's set to only bind to 127.0.0.1. You can change that for development purposes to 0.0.0.0 (I'd use the real IP address for production). Since you have two nodes on the same host, make sure that they're not both using the same port.
> You'll see slower performance with HTTP requests than you will with Protocol Buffers requests.
> Let me know how I can help more.
> Jeremiah Peschka - Founder, Brent Ozar PLF, LLC
> Microsoft SQL Server MVP
> On Aug 25, 2011, at 8:32 PM, Neil Unadkat wrote:
> > Hey,
> > We have been testing Riak to use as our backend database, but one of the issues that we are facing is that Riak is very slow when a call is made from the c# sharp code.
> > In the code, we have used the basic Web Client class, and make a simple GET call. It takes like 2 seconds to get one object.
> > We have setup a cluster which has 2 nodes on Mac mini, and one on an Ubuntu machine.
> > I have tried using the .net client library mentioned on the site, but with those i cannot even connect to the nodes.
> > Can anyone help? _______________________________________________
> > 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