Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent Sessions aren't cleaned up or reused properly #110

Open
K-Leon opened this issue Dec 29, 2024 · 0 comments
Open

Persistent Sessions aren't cleaned up or reused properly #110

K-Leon opened this issue Dec 29, 2024 · 0 comments

Comments

@K-Leon
Copy link

K-Leon commented Dec 29, 2024

I've noticed an issue when enabling persistent sessions using withPersistentSessions(true) in conjunction with PHP-FPM. Specifically, there seems to be a constant growth in the number of connections to the database server.

We are talking about thousands of connections.
(The usable outgoing Ports on the application Server are getting saturaded). We're talking about quiet a bit of load and strong Application Servers. Practically this means that a server is out of ports in about 1-5 Minutes.

It appears that connections are not being cleaned up or closed properly, leading to this buildup over time. If check it in phpinfo persistent connection count is always 1.

I couldn't pinpoint it yet, but disabling persistent sessions didn't resulted in higher latency which leads me to think that it doesn't reuse the connection properly.

(The wrapper is a bit more complex, but this is the gist of it)

$client = new Cassandra()::cluster()
            ->withContactPoints(implode(',', config('scylla.hosts')))
            ->withRandomizedContactPoints(true)
            ->withPersistentSessions(false) // Setting to false helps obviously. => true we see this issue
            ->build();
$session = $client->connect(config('scylla.keyspace'));
///---- Some Stuff getting executed ---- //
$session?->close(); (Added in conjunction with disabling persistent sessions)

I want to thank also everyone for their hard work on this project—it's incredible helpful!

@K-Leon K-Leon changed the title Persistant Sessions aren't cleaned up or reused properly Persistent Sessions aren't cleaned up or reused properly Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant