开发者

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

开发者 https://www.devze.com 2023-02-10 15:08 出处:网络
I am using http keep-alive on a apache server, Lets say I ask it to keep the connections open upto 2 minutes...

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 re开发者_如何学编程sources 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消