While looking into performance issues in one of our clusters I've noticed that the v4.17 Java driver does uses some sub-optimal queries on connecting to the cluster:
|
new Query("SELECT cluster_name FROM system.local"); |
|
CompletionStage<AdminResult> localQuery = query(channel, "SELECT * FROM system.local"); |
Both of these queries force full table scan as there's no key reference. I've tried appending
WHERE key = 'local' to these queries and as a result the Session creation got about 90 % faster in the troubled cluster case. (YMMV)
This seems to be fixed in the 3.x version of the driver.
|
private static final String SELECT_LOCAL = "SELECT * FROM system.local WHERE key='local'"; |
Looks related to this issue.
While looking into performance issues in one of our clusters I've noticed that the v4.17 Java driver does uses some sub-optimal queries on connecting to the cluster:
java-driver/core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java
Line 83 in d33dbc5
java-driver/core/src/main/java/com/datastax/oss/driver/internal/core/metadata/DefaultTopologyMonitor.java
Line 171 in d33dbc5
Both of these queries force full table scan as there's no key reference. I've tried appending
WHERE key = 'local'to these queries and as a result the Session creation got about 90 % faster in the troubled cluster case. (YMMV)This seems to be fixed in the 3.x version of the driver.
java-driver/driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java
Line 79 in 9fe1e03
Looks related to this issue.