Re: squid-1.2-SQUIDFS

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 16 May 1998 19:44:11 +0200

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

Can you please send a copy of your code to squid-dev@nlanr.net?

We have had several discussions around Squid-FS on squid-dev, and last
time we came to the conclusion that we should postpone it for a while
since it has a number of issues (mostly the ones mentioned in your notes
and the effects of them, plus that noone had time to implement it), but
now that you have done something we better take a look at it ;-)

One question that immediately pops up in my mind is how well does this
fit with scaling? Async-I/O has proven that it does a good job on this,
and we do need to use it for Squid-FS as well. It is probably doable,
but requires some thoughts. I doubt that your implementation uses
async-i/o as you said you only had 1 fd for the whole swapfile.

But the most important question? What is the overall I/O improvement as
compared with the current async-i/o code? And is this improvement worth
the added complexity (and possibly loss of recovery)?

---
Henrik Nordstr=F6m
Sparetime Squid Hacker
Eric Stern wrote:
>=20
> I thought some of you might be interested in what I've been working on =
the
> last week or so. Basically, I've changed the way squid stores files. I
> think it'll be a big win, but I haven't run any real tests yet. As far =
as
> I can figure, worst case is that it won't be any faster than "regular"
> squid, but will greatly reduce the number of file descriptors used.
>=20
> I just got it running smoothly this morning, and I'm letting it run
> here on my server for a few days. After that I'll probably be testing i=
t
> on a production system to give it a real stress test. If everything goe=
s
> well then I'll release the code.
>=20
> I'll just attach my little README file here.
>=20
> ----
>=20
> Notes for squid-1.2-SQUIDFS
>=20
> Instead of storing each object in a seperate file on the filesystem,
> all objects are packed together into one file. There are several reason=
s
> for doing this.
>=20
> 1) Greatly reduced usage of file descriptors. Using the old method, squ=
id
>    used 1 FD for every object that was in transit. This got to be a
>    problem on busy caches, since FD's are a limited system resource.
>    SQUIDFS uses only 2 FD's per cache_dir.
>=20
> 2) Improved speed. Old squid was opening and closing files frequently.
>    File operations like that are very expensive system calls. SQUIDFS
>    opens its files when it starts up, and closes them when it shuts dow=
n.
>    It merely needs to do a seek to the appropriate place for each read =
or
>    write operation.
>=20
> Old squid used to store the filenumber that its data was stored in.
> SQUIDFS records the file offset within the swap file. When it needs to
> read or write data, it just seeks to the appropriate offset to perform =
the
> operation.
>=20
> Some notes:
> - in squid.conf you specify the cache_dir(s) with this syntax:
>=20
>   cache_dir <swap file name> <log file name> <size>
>=20
>   ie
>   cache_dir /squid/cache/swap1.data /squid/cache/swap1.log 100
>   would configure a 100 megabyte swap file called /squid/cache/swap1.da=
ta
>=20
>   Note that you can put the swapfile and logfile in different locations=
!
>   Also note that you could use raw partitions to hold the data!
>   ie
>   cache_dir /dev/sdb1 /squid/cache/swap1.log 100
>   would create a 100 meg swapfile on the first partition of the 2nd scs=
i
>   disk (this is a Linux example...YMMV)
>   NOTE NOTE: If you do this, any data that already exists on that
>   partition will be destroyed! Only use partitions that you have
>   specifically created for the purpose of storing swap data.
>=20
> - there is no way to rebuild the cache if squid is not shut down proper=
ly!
>   If there is not a clean swap log present when squid starts up, it wil=
l
>   start fresh with an empty swap. I'm pondering ways for rebuilding fro=
m
>   a dirty swap file...it may show up in the future.
>   If you just send squid the kill signal (ie 'killall squid') and wait
>   for it to exit properly you will have no problems.
>=20
> - space in the swap file is allocated in 1000 byte increments. Thus, if
>   the object is 1453 bytes, squid will allocate 2000 bytes from the
>   swap file. Yes, its slightly wasteful, but reduces fragmentation of
>   the swap file a great deal.
>=20
> - more anti-fragmentation code will be added later.
>=20
> - this code has only been tested on Linux so far. It SHOULD work fine
>   with anything, but hasn't been tested yet.
>=20
> Feel free to contact me with questions or problems.
>=20
> /----------------------------------------------------------------------=
-/
> / Eric Stern - PacketStorm Technologies - (519) 837-0824               =
 /
> / http://www.packetstorm.on.ca                                         =
 /
> / WebSpeed - a transparent web caching server - available now!         =
 /
> /----------------------------------------------------------------------=
-/
--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:47 MST