[Date Prev][Date Next]
Re: Thread pool efficiency
Hallvard B Furuseth wrote:
Howard Chu writes:
I think we need to have separate queues per worker thread. The
frontend can operate in single-producer mode where only the single
listener thread is allowed to submit jobs into the pool. The workers
can just access their own individual work queues, thus significantly
reducing mutex contention.
Won't otherwise-fast requests then be stuck waiting behind the
occational slow request? In our server I'm more concerned with worst-
case times than the average time.
I guess so. We can try to minimize that by assigning jobs to the shortest
queues. On a lightly loaded server, there will probably be at least one empty
queue, so jobs will always be dispatched quickly. On a heavily loaded server,
all jobs are going to experience longer delays anyway, so I don't think the
worst case can deviate very far from the average case.
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/