PLANNED MAINTENANCE

Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


question

ted_176239 avatar image
ted_176239 asked ·

Why do connections with PHP driver rise from 5K to 12K, drop then spike again?

Hi all,

Wondering if anyone can shed some light on the methodology for establishing connections with the PHP driver.

We have a few servers and for some reason they all seem open new connections at the same time. It will drop to around 5k connections, rise to 10k-12k and then slowly drop, until it is time to spike again.

Problem is these connections and associated queries are causing major latency for actual requests. And also when it is connecting, there is a query for some metadata that is large, which is requested for each connection?

Any ideas?

Thanks,

Ted

drivercpp
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Fero avatar image
Fero answered ·

Ted,

There are a couple ways to mitigate this issue until we are able to implement a more long-term solution. To do so you can disable the some of the expensive startup procedures and use the whitelist policy to target a smaller set of nodes in the cluster.

$cluster = Cassandra::cluster()
  ->withSchemaMetadata(false)
  ->withTokenAwareRouting(false) # This may dramatically reduce your startup time.
  ->withWhiteListHosts(...) # Use a single or small number of hosts
  ->build();
$session = $cluster->connect();

Note: $session->schema() will always return an empty object.


One long-term solution that could be implemented would be a shared memory bridge to the persistent sessions. By having a single process managed by the php-driver extension where persistent sessions would be cahced and utilize IPC to communicate with that manage process. This would solve the following problems:

  1. Decouples the number of Cassandra connections created from the number of child processes.
  2. Persistent sessions (which are enabled by default) are connected once regardless of the number of child processes.


~Fero

Michael Fero

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Fero,

Thank you for the detailed answer, I will give that a try.


The issue seemed to get worse when we upgraded from Scylla 2.3 to 3.0. We are using the latest PHP driver available (1.3.2) from 2017, which I believe uses CPP-Driver 2.7.


I see an open Pull Request from 7 days ago that looks to switch to CPP 2.13, so hopefully that goes somewhere.


Thanks again,

Ted


0 Likes 0 · ·