mostlyserious / riak-js

Riak client for Javascript
http://riak-js.org
476 stars 102 forks source link

Can't get pooling to work #207

Closed julien51 closed 10 years ago

julien51 commented 10 years ago

We have 5 nodes in our pool. We're issuing a loop for commands to test the robustness of our setup by kiling a node while running.

The loop consists of a repetiition of the following commands: PUT /bucket1 xx; GET /bucket2 a; PUT /bucket2 a data. That's fairly simple and runs forever if we skip the poolee setup.

Now, with poolee, something strange happens. It picks a random server in the 5, performs 20 requests successfully, then, it picks the next server, performs 20 requests, and then a 3rd and a 4th and a 5th. After that, it just hangs. The 20th request on the 5th server never succeeds.

Debugging this quite a mess since Poolee does not have log statements it seems :/ My understanding is that Poolee considers a server down after 20 requests and hence picks another one, until there is none to pick.

Why does poolee think a server is dead? How can we confirm it's not? (it looks like poolee as a ping mechanism to determine the health of a node in the cluster. Is it used in riak-js?)

EDIT: the number 20 is the number of socket (maxSockets) in the poolee config. So that means all my requests are considered to be failing by Poolee. The question is: why?!

eveiga commented 10 years ago

Hi! I can confirm this behaviour but only with node version >= 0.10.x It works fine on 0.8.x.

If you change your maxSockets value to 100, it will run the corresponding number of requests and then starts failing again. I'll try to take a proper look at this, but it seams that poolee is breaking with the latest versions of node.

eveiga commented 10 years ago

One more note, this is only happening when I get 404's from riak. If the response is 200 it will work.

Quentin01 commented 10 years ago

I have the same problem. Nobody has a solution ? I will try to investigate and debug this one, but I don't know if I would succeed.

eveiga commented 10 years ago

@Quentin01 Theres a fix here: https://github.com/mostlyserious/riak-js/commit/3622f7d91e1854004aca2d8cf166ffecf553da81

eveiga commented 10 years ago

@Quentin01 The project seems to be dead!

Quentin01 commented 10 years ago

Thanks for this answer. Do you know a good fork of this project which is up to date ?

PS: This commit is in a PR ?

Quentin01 commented 10 years ago

It's fixed !