Options to Disable Schema, Token Metadata Processing
Too many keyspaces causes python to take forever connecting to Cassandra.
Connecting from cqlsh windows to aws Cassandra 2.1.5 on linux times out. Increasing connection time out works, but connection may take 30 seconds. This happens with both cqlsh and regular python script connecting to Cassandra.
Suspect Python driver is downloading too much metadata about the keyspaces. We have 200+ keyspaces on our cluster.
windows 7 client connects to aws cassandra 2.1.5 on linux with 16 gb ram, 4 cpu on ssd
I did some testing locally (latest driver - 3.2) and didn't find anything this dramatic. Going up over 5K tables, the query and meta parsing starts taking around one second. I introduced new config flags to selectively disable token and schema processing on connect (previously could just disable updates from events). Also verified that query execution works fine with this stuff off (we just lose implicit Token Aware Routing (this is documented)).
We added an option to disable table metadata in some of the other drivers, so I think we should consider it. Not necessarily as a solution for this ticket.
We had 300 keyspaces with about 20 tables in each keyspace running on two nodes of Cassandra 2.1.2 (4 CPU, 15 GB RAM, 80 GB SSD drives in AWS per node).
It really took a long time to connect via CQLSH (15 seconds), which uses Python, and even longer in my custom Python script (40 seconds).
After we trimmed it down to only 60 keyspaces, CQLSH connection time dropped to 4 seconds. It was pretty clear the Python driver is responsible for this overhead. Connecting via the other drivers (C#, Node JS) was much faster than Python. Also, once logged in, dropping keyspace seemed to take a long time with Python. Wonder if Python is refreshing the metadata after a keyspace drop. Thanks.
I can see the metadata query phase taking a bit longer for 200 keyspaces, but 30 seconds is surprising. Will try to reproduce here.
Can you also share your cluster node count?