1.2b20-1: Async I/O [updated patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 08 May 1998 22:25:04 +0000

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here is a in large parts reworked patch for async I/O. This replaces all
of my previous async-io patch (which was messy and broken).

* The read offset was not preserved, corrupting deferred hits on
pipelined connections.

* Main <-> I/O thread communication is done using a single request
pointer, optionally protected by a mutex.

* CPU spin situation solved in two possible ways: Either by properly
protecting the condition variable using a mutex, or by increasing the
timeout-time on each timeout instead of relying on squid_curtime.

* Use a 50 msec select timeout for ASYNC_IO to keep things flowing
nicely.

* Check for completed threads when the request queue grows. Completed
requests are put on a FIFO queue until processed from the main loop.
This is done to more quickly reuse of finished threads.

* Fixed a silly bug in my last version of this patch. No idea how the
last patch could pass my tests...

* Avoid pointer aliasing. Some compilers/optimisations have trouble with
this (the old code was probably safe, but..).

* Some minor code cleanups.

* This patch is not messed up ;-)

* Removed compiler warnings

- No more SIGCONT signal hack or cross-level hints. This was a bad move
both on performance and code design.

- Mutex signalling is optional (-DAIO_PROPER_MUTEX). Using a volatile
pointer should be safe on most/all platforms.

This patch is quite heavily tested, and seems to perform well.

I still haven't found the cause to another async-io problem. When
async-io is enabled Squid only caches about 1/2 of the requests in my
tests. Without async-io everything gets cached as expected. I have
verified that this problem in present in a unpatched b20-1 and is not
caused by this patch or any of the other 1.2b20-1 changes I have made.

Comments are welcome, as always.

/Henrik

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:49 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:46 MST