Hey All, It looks like the Client.set_keyspace method does a server round trip to validate that the keyspace exists.
Exhibit A: > InvalidRequestException(why:Keyspace does not exist) > > at >> org.apache.cassandra.thrift.Cassandra$set_keyspace_result.read(Cassandra.java:4816) > > at >> org.apache.cassandra.thrift.Cassandra$Client.recv_set_keyspace(Cassandra.java:451) > > at >> org.apache.cassandra.thrift.Cassandra$Client.set_keyspace(Cassandra.java:426) > > I was looking into making a connection pool that is independent of a keyspace. My thinking is that a connection pool is relatively expensive and if a user has more than one keyspace, it would be ideal to maintain a single pool for the cluster rather than one per keyspace. My plan was going to defer the Client.set_keyspace(String) call from the point that the connection is initialised, to the point that the connection is borrowed from the pool. However, if that call requires a server round trip it might do more harm that good... Two questions; 1. Does the call to Client.set_keyspace(String) really do a server round trip every time it's invoked? 2. If yes, is it really necessary? Cheers, Dan