how to cancel long connect to cassandra by php?

28 views
Skip to first unread message

wqw...@gmail.com

unread,
Dec 8, 2017, 2:10:25 AM12/8/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
I use datastax php driver to connect cassandra server in my php script which run by php-fpm called by nginx.but i found every fork of php-fpm will create max 3 long connect to my cassandra cluster with 3 server. 500 php-fpm will create 1500 long connect to cassandra,who can tell me how to cancel long connect to cassandra or decrease the long connect to cassandra? I hope one fork just keep 1 long connect.

Michael Fero

unread,
Dec 13, 2017, 9:44:22 AM12/13/17
to DataStax PHP Driver for Apache Cassandra User Mailing List
To short circuit (or fail long connections) you can use 'withConnectTimeout(number_in_seconds)' (http://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/Cluster/class.Builder/#method-withConnectTimeout). This will fail all long connect times and effectively cancel the connect.

To help reduce the long connect times you can 'withSchemaMetadata(false)' (http://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/Cluster/class.Builder/#method-withSchemaMetadata). This has its cons though as "If disabled this allows the driver to skip over retrieving and updating schema metadata, but it also disables the usage of token-aware routing and $session->schema() will always return an empty object."

~Fero

Reply all
Reply to author
Forward
0 new messages