cqlengine/cqlengine — pull request #235 by Lifto (2014-07-11 18:04:10+00:00)
Title: connection speedup flags in setup.

In response to some very large connection times (10-70seconds) it has been recommended to try these speedups. Two of them required configuring the Cluster prior to connecting but could not be done with keyword arguments to Cluster (which setup passes in.) Two new keyword arguments are added to setup to allow speedups 1 and 5 below.
skip_schema_loaded and one_core_connection.

The rest of the speedups can be achieved by passing keyword arguments to setup. These are passed on to Cluster when it is created.

Speedup recommendations are:

1: cluster.set_core_connections_per_host(HostDistance.LOCAL, 1)
Opens one conn per host instead of 2

2: use WhiteListRoundRobinPolicy to restrict the nodes to a subset

3: cluster = Cluster(..., executor_threads=N)
Where N > 2. Increases concurrency of opening connections.

4: cluster = Cluster(..., compression=False)
Saves one round trip when opening connections

5: cluster.control_connection._refresh_schema = lambda *args, **kwargs: None
Skips schema loading. This will break prepared statements, and if you make a schema change, you won't properly wait for schema agreement.