Riak Java client DNS caching suggestion/tips/possible bug?

Trenton Taylor trenton.taylor at weather.com
Tue Apr 21 11:56:30 EDT 2015

Hi All,

I am currently using the Riak java client v1.4.4, but have also encountered
this issue in 2.0.x.

I am experiencing an issue where the underlying Riak load balancer IP
changes (AWS load balancer) but the DNS cache in the Java app does get
updated, even when the connection fails. I have set the network.cache.ttl to
0 in the java.security file for testing purposes but this does have any

I have created 2 separate Riak clusters with 2 different IP addresses and an
entry in /etc/hosts (e.g. “ riak”) that I swap back and forth
while the application is live (it’s a Tomcat webapp). In the app
configuration, I simply use the hostname as “riak” when connecting to the
cluster (I.e. This is the placeholder for the load balancer name). Upon the
application startup, I create the client with this hostname and call
execute(s) on this client throughout the lifecycle of the application.

Once the Riak client is created and a successful DNS lookup occurs, the Riak
client (and underlying connection) hold on to the DNS lookup values and thus
the underlying IP never appears to change (remember network.cache.ttl is set
to 0). Changes to the hosts file never get propagated. The only way that I
can make this work is if I create a new client on every call to the Riak
cluster. This is VERY high volume application and I’m concerned about stress
on the application if Im creating new clients on every single call.

So if my understanding is correct, combined with the java.policy no DNS
caching, shouldn’t the Riak Client correctly update the DNS cache? Or am I
missing something?

Any help would be greatly appreciated!


Trenton A. Taylor  |Java Developer
m: 404.583.1994  e: trenton.taylor at weather.com
o: 300 Interstate N Pkwy SE, Atlanta, GA 30339

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20150421/3ee6108d/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: E4599955-6065-4367-A664-C1C226E2D3FE[1].png
Type: image/png
Size: 35884 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20150421/3ee6108d/attachment.png>

More information about the riak-users mailing list