Hi Matt.

Ignoring that you really shouldn't be running an app server on a
machine that's also a database server, I'm confused as to why you
would use any load balancing features of a client if that's the way
you're doing things.

Presumably you have something load balancing to your app servers, so
... just connect to the local riak node. If that machines crashes, it
seems unlikely your app server would continue running. If there's some
edge case where somehow the riak node stops responding but the app
server is still running, your load balancer should stop sending
requests to that app server.

All that said, the existing `ClusterClient` class in the 1.x Java
client is very basic/limited. All it does is round-robin requests
through the list of supplied nodes. As Sean Cribbs points out, the new
Riak 2.0 Java client will allow you to define your own node selection
code.

Thanks,
- Roach

On Sat, Feb 8, 2014 at 3:34 PM, Sean Cribbs <[email protected]> wrote:
> Hi Matt,
>
> I'm not positive of the implementation details, but I know for certain that
> the "new" (unreleased) Java client allows you to provide a load-balancing
> strategy yourself. This documentation should be a good start:
> http://basho.github.io/riak-java-client/2.0.0-SNAPSHOT/com/basho/riak/client/core/DefaultNodeManager.html
>
> I'm sure Brian Roach and Dave Rusek, who maintain the Java client, would
> also be happy to discuss it more with you.
>
>
> On Sat, Feb 8, 2014 at 11:23 PM, Matthew MacClary
> <[email protected]> wrote:
>>
>> I have the same use case as Massimiliano. We are using the java client and
>> our app runs on the same servers as the Riak cluster. We have found that
>> connecting to the Riak instance running on local host provides the best
>> performance. It would be nice if the cluster client could be told to prefer
>> one node, and fall back to other nodes if needed kind of like secondary DNS
>> servers.
>>
>> -Matt
>>
>>> Message: 5
>>> Date: Sat, 8 Feb 2014 15:07:36 +0100
>>> From: Massimiliano Ciancio <[email protected]>
>>> To: Sean Cribbs <[email protected]>
>>> Cc: riak-users <[email protected]>
>>> Subject: Re: Riak pool connection
>>> Message-ID:
>>>
>>> <CALJSbQxHU=UAu9ZvYT=+0psf2_azhpwnrvezkccj_vph6ad...@mail.gmail.com>
>>> Content-Type: text/plain; charset=ISO-8859-1
>>>
>>>
>>> Hi Sean,
>>> thanks for your answer!
>>>
>>> > I believe it may still be possible for the node to be selected if no
>>> > other
>>> > connections are available in the pool, because the logic used to
>>> > establish a
>>> > new connection might not use the filter.
>>>
>>> My problem is not to avoid that a node will be selected again after a
>>> fail (well, if this can be avoided by sure it's better...) but to set
>>> an order in the nodes: I want to connect first to the node on which my
>>> app is running and only in case of fail to the other nodes. The reason
>>> is to avoid network traffic: every instance of my app have to connect
>>> to the node on the same machine where it resides.
>>> How can I suggest a "preferred node" to RiakClient?
>>> My first idea was to use a connection with only the preferred node
>>> and, using a try/except, use an "emergency connection" with the list
>>> of all nodes to be used only in case of fail. But it's not so
>>> elegant....
>>> Massimiliano
>>
>>
>> _______________________________________________
>> riak-users mailing list
>> [email protected]
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>
>
>
>
> --
> Sean Cribbs <[email protected]>
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to