Bill Stoddard wrote: > >>Right, the problem is that the listener needs to avoid doing the >>accept if the queue is full. >> >>That part is easy: add a "block_if_queue_full()" method on the >>fd_queue class, and have the listener call it before doing an >>accept. >> > >I am not an expert on the worker MPM but I don't think that is an accurate statement >of >the problem. The accept thread uses ap_queue_push() to enqueue a socket for the >worker >threads. ap_queue_push() will block if the queue is full. >
You're right. The logic really needs to be: don't do the accept unless there is an idle thread. --Brian >The problem is that the queue can be EMPTY even when all the worker threads are busy >handling connections. The way the code is today, the queue can hold >ap_threads_per_child >elements. Now consider 2 x ap_threads_per_child connections comming into the server at >once.. The first 1 x ap_threads_per_child connections will be accepted and handled by >the >worker threads. The next ap_threads_per_child connections will get queued and this is >precisely the problem... > >Bill >