this post was submitted on 13 Jun 2023
13 points (93.3% liked)

PHP

538 readers
1 users here now

Welcome to /c/php! This is a community for PHP developers and enthusiasts to share and discuss anything related to PHP. From the latest updates and tutorials, to your burning questions and amazing personal projects, we welcome all contributions.

Let's foster an environment of respect, learning, and mutual growth. Whether you're an experienced PHP developer, a beginner, or just interested in learning more about PHP, we're glad to have you here!

Let's code, learn, and grow together!

founded 1 year ago
MODERATORS
 

Hey! ๐Ÿ‘‹

Whether you're an experienced PHP developer, a beginner just starting your journey, or an enthusiast interested in understanding more about the world of PHP, this is the place for you. We are a community dedicated to sharing knowledge, discussing new trends, and solving problems related to PHP.

As members of this community, we expect everyone to respect each other and foster a positive environment. Please make sure your posts are relevant to PHP, and remember to be kind and considerate in your discussions. Let's learn from each other and help each other grow.

Whether you're here to ask questions or to share your knowledge, we're excited to have you here. Let's make the most of this community together!

Welcome to /c/php! ๐Ÿ˜

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 1 year ago (19 children)

Can anyone here help me understand persistent PDO connections?

So I set up Patroni cluster, everything works as expected. But during the failover/switchover PHP remembers connections to the failed node. And I can't figure out why. Reloading FPM is kind of PitA.

I will use PgBouncer. But I still would like to know how PHP works with the persistent connections.

[โ€“] [email protected] 1 points 1 year ago (1 children)

Honestly I don't know much about this but I think this can occur because PHP (or more specifically, the PDO extension) isn't necessarily aware of the health of the PostgreSQL node it's connected to. From PHP's perspective, it opened a connection, and unless explicitly told otherwise, it will assume the connection remains open. The Patroni switchover/failover is happening independently of PHP. PgBouncer is probably a good solution for this.

[โ€“] [email protected] 1 points 1 year ago

If I knew how to invalidate failed connection in the persistent pool, that would be enough.

load more comments (17 replies)