Would like to know how redis pconnect working behind.
Context: Horizontal scaling of php REST API. We were getting a lot of connections errors from redis?
Realization from performance: Less connection is always better
1.How it is sharing connections in between processes (apache mpm prefork)?
2.Once connection holding process dies then connection also will get close,right?
3.Is there any way to always keep 50 connections min and max?
4.Is this persistence is beneficial as like connection pool?
Thank you very much.Greatly appreciate your reply.
I have the same question...
@namjitharavind, thank you for your question. We use native PHP network implementation so it would be more useful if you will read about pconnect in PHP documentation. I'm not sure I can explain right now (I also need to reed docs :))
You are right about closing connection when process die.
Not sure about min/max connections opened. PHP will keep all your connections while you don't close them.
PHP engine creates global variable and stores it into persistent memory. This variable is available only in the current process and isn't shared between processes. When user call pconnect phpredis asks PHP engine to create the stream and store it into persistent storage by unique identifier (if it doesn't exist). As far as I know there's is no default mechanism in PHP to set min/max connection number but starting from 4.3.0 it is possible to enable connection pooling in phpredis and set max number of persistent connections to be opened (per-process ofcourse).
Closing this issue, since I think it's answered.
Most helpful comment
PHP engine creates global variable and stores it into persistent memory. This variable is available only in the current process and isn't shared between processes. When user call
pconnectphpredis asks PHP engine to create the stream and store it into persistent storage by unique identifier (if it doesn't exist). As far as I know there's is no default mechanism in PHP to set min/max connection number but starting from 4.3.0 it is possible to enable connection pooling in phpredis and set max number of persistent connections to be opened (per-process ofcourse).