简体   繁体   中英

does http:keep-alive keep the php resources open or does it free all the resources?

I am using http keep-alive on a apache server,
Lets say I ask it to keep the connections open upto 2 minutes...
Now, if the connection is created and idle for a minute, will the resources held by php,
like mysql connections, file handles, etc., will be freed or will they survive too ?

Confirmed. Keep-Alive is a mechanism to prevent costly TCP connection negotiation. Your PHP process/thread starts as normal and needs to allocate all resources as usual.

Regarding a high load situation, it might be wise to even keep the keep-alive period not too high: All connection requests compete for free connection slots of your server. If all slots are in-use by keep-alive connections, other users might not connect.

But, as usual, the optimal amount of slots and good keep-alive period depends on your specific load situation.

no , http keep-alive save resources of tcp connection . php and mysql will not even aware of that connection is open , when you will make next request it would be fast because time spend resolving ip address , and opening new tcp connection will be saved all this things remain with apache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM