Re: squid-1.2-SQUIDFS

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 01 Jun 1998 03:31:02 +0200

--MimeMultipartBoundary
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Eric Stern wrote:

> Right. I had to rewrite disk.c to queue up read/write requests
> for each FD. So there will only be 1 read or write operation in
> progress per FD at any given time. However, there could be a read
> AND a write going at the same time. If I read your comments
> correctly, you say this could be a problem.

Yes. Both read() and write() share the same filepointer, and possibly
other per-fd kernel state variables.

The thread read/write functions looks like (unless you have changed
them)

  lseek()
  read() or write()

And read() and write() updates this file pointer as well, so if a read
and a write operation get sheduled at approximately the same time
(preemt each other) you may well end up reading or writing at a
different location (or even both).

> As you say, the OS will optimize queued requests, but I question
> the value of that in this application. Statistically speaking, I
> get the feeling you'd rarely get much optimization, since the
> requests are extremely random. However, we could try to emulate
> the seek optimizations within squid, rather than depending on the OS.

Well, lets just say that on my little test system I need to have several
threads working to keep the drives spinning.

Threads Req/s KB/s
4 49 289
8 82 460
16 91 513 (partiallty CPU bound)
32 94 545 (mostly CPU bound)

(test system is a P133 32MB, 2 IDE drives, Linux 2.0.X, 5279 objects
33605k)

We have had a new discussion on squid-dev about async-io,
filedescriptors and mmap, and some new ideas came up:

Stephen R. van den Berg <srb@cuci.nl> came up with the idea that we
could handle multiple outstanding read() operations by using mmap().

Basic thread function without changing other parts of the code:
  mmap() the region
  copy data from the mmap() region
  munmap() when done

Multiple write operations on one FD is a bit harder, as mmap() is not a
very efficient way to update blocks (it generates extra pageins of the
updated blocks).

But you could have a pool of let's say 16 filedescriptors on each
cache-structure file, and queue read/write operations on these.

---
Henrik Nordstr=F6m
--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:50 MDT

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