cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Stevens <migh...@gmail.com>
Subject Re: Question for datastax java Driver
Date Thu, 05 Nov 2015 15:19:38 GMT
In short: Yes, but it's not a good idea.

To do it, you want to look into WhiteListPolicy for your loadbalancer
policy, if your WhiteListPolicy contains only the same host(s) that you
added as contact points, then the client will only connect to those hosts.

However it's probably not a good idea for several reasons.

First, it's directly at odds with Cassandra's availability guarantees.  If
you connect only to one node, and that node goes down, your client has lost
the ability to communicate with the cluster *at all*.  Even though you
(presumably) have replication set up, and the cluster is fully capable of
answering questions and taking writes with that node offline.  If you
permit the default behavior, your client remains connected and functional
through node losses (one or more depending on your replication factor).

Second, this produces coordination overhead, which increases latency for
your requests as well as GC pressure in your cluster.  When you do an
operation on a host that does not own that data, that host will in turn
communicate with the host(s) that *do* own that data.  This is work that
doesn't have to happen, because the java driver can do that work itself,
and communicate directly with primary replicas.  This saves a network hop
(reducing latency) and saves GC pressure in the cluster (the hosts don't
have to coordinate operations, and the requests complete more quickly).

Aside from very narrow scenarios (perhaps diagnostic ones where you're
testing a specific host that you suspect to be misbehaving), I can't think
of a reason you'd want to do this.

On Wed, Nov 4, 2015 at 10:32 PM Dikang Gu <dikang85@gmail.com> wrote:

> Hi there,
>
> Right now, it seems if I add a contact point like this:
>
> cluster = Cluster.builder().addContactPoint(<IP1>).build();
>
> When client is connected to the cluster, client will fetch the addresses
> for all the nodes in the cluster, and try to connect to them.
>
> I'm wondering can I disable the behavior? I mean I just want each client
> to connect to one or several contact point, not connect to all of the
> nodes, am I able to do this?
>
> Thanks.
> --
> Dikang
>
>

Mime
View raw message