Relay::close(...) vs Relay::pclose(...) - PhpRedis Compatibility
#178
Replies: 2 comments 6 replies
-
|
Good catch. I don't know why I thought we exposed Changing Relayto match |
Beta Was this translation helpful? Give feedback.
-
So turns out PhpRedis acts just like Relay and vice versa with persistent and non-persistent connections. Except Relay additionally offers |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
From the API documentation I see that the
Relayclass offers these two variant methods for closing a connection. The documentation explicitly says that theclosewill not close a persistent connection when called, but this seems to break the drop-in compatibility with PhpRedis, who offers a singleclose(...)that works with both cases and has nopclose(...)equivalent.Consider the following:
This kind of functionality is useful when using Redis behind a load balancer like HAProxy, instead of using Sentinel/Clustering/Array management on the client itself.
When using PhpRedis, we will recognize the
READONLYfailure, kill the connection, and then start a new connection after 100ms - after the load balancer has had time to reroute incoming TCP connections. Failure is graceful.When using Relay, we will recognize the
READONLYfailure, then not kill the connection1, and enter an infinite loop retrying until request timeout.Footnotes
Well, actually, this will have a fatal exception on the retry. A separate issue incoming for that. ↩
Beta Was this translation helpful? Give feedback.
All reactions