Shrinath
Shrinath

Reputation: 8118

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 ?

Upvotes: 5

Views: 1160

Answers (2)

SteAp
SteAp

Reputation: 11999

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.

Upvotes: 3

Mr Coder
Mr Coder

Reputation: 8186

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.

Upvotes: 1

Related Questions