httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Kasichainula <man...@raleigh.ibm.com>
Subject [PATCH] Intraprocess accept serialization
Date Thu, 15 Apr 1999 22:24:47 GMT
With the poll-select accept model just added to the apache-apr
repository, you get every thread of every process needing to serialize
with each other for the accept lock. 

The problem is that some of the accept serialization methods we use
(fcntl, flock, I think SysV), only do cross-process locking. So when
two threads in the same process want an fcntl lock, they can both get
it at the same time. This can result in a serious thundering herd
accept() problem.

One solution would be to just add pthread lock calls around the
accept_mutex_on and accept_mutex_off calls. But, this can hurt
performance when the extra locks aren't needed (e.g.
USE_PTHREAD_SERIALIZED_ACCEPT).

We also don't need the extra locks in Ryan's queue model, because the
server then only has a single thread accepting on a socket per
process.

So, the use of intraprocess locks has to be determined both by which
cross-process lock system is used, and by which accept model is used.

So, this patch:

- adds a define: NEED_INTRAPROCESS_SERIALIZED_ACCEPT. It's defined in
  http_accept.h, based on the accept model used. 

- adds a set of calls, intra_mutex_{init,on,off}, containing
  the common pthread mutex code. They do nothing when
  NEED_INTRAPROCESS_SERIALIZED_ACCEPT is off.

- adds these calls to the appropriate accept_mutex_{child_init,on,off}
  calls, based on whether that accept model needs the calls.

Comments? Is this the right way to do this?

-- 
Manoj Kasichainula - manojk@raleigh.ibm.com
IBM, Apache Development

Mime
View raw message