apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: shared memory question
Date Tue, 13 Dec 2005 17:59:02 GMT
Alexey Toptygin wrote:
> I'd still like to know if I should be worried about taking a preformance 
> hit if I use apr_global_mutex_lock/unlock at least once (and often more 
> times) per request in the worker threads.

That entirely depends on how long the lock is potentially held.  If you are
flipping some bits and unlocking, it's very unlikely to lock at all, but if
you are going out to disk to write some status information, every cpu cycle
spent will potentially hold up another request for some time.  The mutex
itself doesn't affect things, obtaining an available mutex is nearly painless.

E.g. if the lock is held for about .01% of the request processing time, it's
of almost no significance with 100 workers, there's only a 1/100 chance of
even locking in the first place.  If the lock must be held for 5% of the
processing time, you really can run only 20 workers, and not at all that
efficiently or responsively.


View raw message