Greg Ames wrote:
please see rev. 558039.  requests_this_child does not need to be 100% accurate. 
 the cure below is worse than the disease.

Greg

-        requests_this_child--; /* FIXME: should be synchronized - aaron */
+        apr_atomic_dec32(&requests_this_child); /* much slower than important 
*/


Maybe someone could reconfirm to the list what exactly the disease is ?


If this counter is not accurate (meaning it may loose increments/decrements) does the end the world cave in ? Maybe someone could explain how and where this particular variable "requests_this_child" is used.

For example if its just to provide guideline information to allow termination after 10000 requests then thats less of a problem than if someone configured it to terminate after 2 requests. Being 0.0001% out is less of a problem than 100% out.

For example if the counter is used in some way to allow apache to restart/logrotate and if it does not come back to zero reliabily then apache will remain hung trying to shutdown (as it often the case in my real world experience) then the disease would be a hung webserver during shutdown and taking. This is much more fatal.

I'm not suggesting this particular counter "requests_this_child" has a direct cause with hung apache instances but I'm asking those that understand the disease(s) if they could explain exactly what they are.




I'm not familiar with the apr_atomic_dec32() API, is this correctly optimized to a single asm instruction "lock decl 0xaddr32" on Intel IA32 ? How many clock cycles do you think that operations takes, what technical understanding makes you think such a "cure" should be utilized with caution ?

My understanding of the cure is that its very very light weight so light weight I'd challenge you to prove the mythical performance issue in the situation its being used in apache.


To give this some weight, I'm was recently involved in an multi-threaded ethernet packet processing application dealing with 100's of mbit and each packet that came updated multiple counters using the IA32 "LOCK" prefix but there was zero noticeable contention. Indeed this is the purpose of the assembly primitive to implement something in hardware that is most efficiently done there.


Darryl

Reply via email to