]> git.ipfire.org Git - thirdparty/squid.git/commit - src/DiskIO/IpcIo/IpcIoFile.cc
Optimized the number of "queue is no longer empty" IpcIo notifications.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 19 Apr 2011 04:31:53 +0000 (22:31 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 19 Apr 2011 04:31:53 +0000 (22:31 -0600)
commitfa61cefe6486fe4f7ff291af66f2d182fcebf88a
tree44895db311de35657fd4768f529bc116afb30b94
parent17cf0a47537718b45b4b0a576ff9956e57cbdaaa
Optimized the number of "queue is no longer empty" IpcIo notifications.

The original code relied on the writer (pusher) knowledge to decide when a
notification is needed. That code was simpler but it resulted in many
pointless notifications because the reader could have been busy processing the
last popped item and would have checked the queue after that processing
anyway. This would become especially wasteful when the reader pops multiple
requests before processing them (e.g. to do "elevator" seek optimization).

The intermediate implementation (not comitted) placed the reader state in
each queue. That was still fairly simple and worked OK, but it was not
addressing the needs of the disker readers. Diskers have many incoming
queues. If at least one incoming queue has requests, the disker is not
blocked and does not need a notification.

The last implementation allows all incoming queues of a single disker to share
the reader/disker state. The reader state is disassociated from the single
queue.  There is still some wasteful state updates when multiple queues are
iterated in FewToOneBiQueue::pop(), but their overheads should be very minor.
We need to figure out whether a single shared reader state can also be used
for workers though (each worker also has many incoming queues...).

Also added debugging and a few XXXs/TODOs to mark future work items.
src/DiskIO/IpcIo/IpcIoFile.cc
src/DiskIO/IpcIo/IpcIoFile.h
src/ipc/Queue.cc
src/ipc/Queue.h