Skip to content

Use multiple connections #10

Open
Open
@wnkz

Description

@wnkz

Hey,
At the moment, this gem only uses the first server from the array we pass, I think it would be very useful to use all of them because sometime under heavy load or when running a lot of request in a short duration, queries ended up failing.
I think it's not because the cluster cannot process the request but simply because of HTTP requests saturation.

I'm willing to work on a patch for this but I'd like your approval first ; mostly to know if it's recommended to run queries directly on secondary nodes while queries are running on the primary. I'm pretty sure it works, but I'm not sure it's recommended.

What I have in mind right now (didn't start coding anything):

  • Retry on a different server if request fails
  • Simple load balancing (round roaming)
  • (Maybe) Advanced load balancing depending on the individual load of each node of the cluster (if possible)

Let me know what you think,
Cheers,

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Activity

chaudum

chaudum commented on May 12, 2015

@chaudum
Contributor

hi @wnkz

indeed, the client should use multiple hosts for failover scenarios. the best way to implement that is round robin "load balancing". you can perform any query on any node of the cluster. using multiple hosts for queries helps to reduce load on each of the handler nodes.

if you start implementing it, you can take a look at the python client first, where this is implemented in a clean way: https://github.com/crate/crate-python/blob/master/src/crate/client/http.py#L279
I think the code is more or less self explanatory, but if you have any questions, please ask again :)

wnkz

wnkz commented on Jun 24, 2015

@wnkz
Author

What do you think about using https://github.com/mperham/connection_pool ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @joemoe@chaudum@wnkz

        Issue actions

          Use multiple connections · Issue #10 · crate/crate_ruby