How to improve too slow to connect to Cassandra cluster with datastax drivers?

270 views Asked by At

I have set up a Cassandra (3.11.10) cluster with 3 nodes on 3 AWS EC2 instances with identical hardware configuration in the same internal network recently. Each of them sees each other. By logging into each of them, you can get access to the tables in the Cassandra database. It works well with cqlsh, everything seems perfect.

Instance Type: t3.medium.

Amazon Machine Image (AMI): CentOS 8 (x86_64) - with Updates HVM.

By the way, I used instructions from this article in each EC2 instance to set up Cassandra.

My configurion file (/etc/cassandra/default.conf/cassandra.yaml) looks like this:

seeds: "node1_public_ip_address, node2_public_ip_address, node3_public_ip_address"
listen_address: "node_private_ip_address"
broadcast_address: "node_public_ip_address"
start_rpc: true
rpc_address: 0.0.0.0  # default value: localhost.
broadcast_rpc_address: "node_private_ip_address"  # default value: 1.2.3.4
endpoint_snitch: SimpleSnitch  # I also tried Ec2Snitch, but it raise problems.

After these settings, I noticed that the connection process to the database takes a very long time (it takes more than 5 seconds). I tried to connect to the Cassandra database via SQL client called DBeaver which use Cassandra Java Driver 3.5.5. I also tried to connect to the Cassandra database from AWS Lambda functions which was written in Python. So in the last case, I used the official Datastax Python Driver.

QUESTION: What is the reason for this strange behavior and how can it be improved?

0

There are 0 answers