Re: Some optimisations

From: Adrian Chadd <adrian@dont-contact.us>
Date: Sat, 16 Sep 2000 12:46:10 +0800

On Fri, Sep 15, 2000, Andres Kroonmaa wrote:
>
> I was lately tracing squid and looking at what io pattern it has.
> To my surprise I discovered that it uses quite amount of different
> buffers for different types of io.
> Here is a sample of solaris truss with lwp's:

[snip]

> From these observations I decided to limit serverside buffer size to
> 16KB, increase disk buffers from 8KB to 16KB, and also increase client
> buffers from 4KB to 16KB and watch how it matters.
> I think the result is more optimal disk utilisation for large object,
> less disk ops for moderate sized object, and less read/write syscalls
> needed. All this seems to translate into lower CPU usage and better
> smoother throughput.

[snip]

> Further strangeness in squid is that when it swapouts an object, it first
> writes out metadata (storeentry+url) with whatever size is needed, and from
> then on writes in diskblocks. This means that _all_ swapouts occur in badly
> aligned manner:
>
> /13: 24.0067 0.1316 write(94, "03 v\0\0\00310\0\0\0 ,8E".., 118) = 118
> /13: 24.0087 0.0020 write(94, " H T T P / 1 . 1 2 0 0".., 8192) = 8192
> /29: 24.3986 0.0000 write(94, "D1 S c83 $E1 s93A3C3 415".., 8192) = 8192
> /29: 24.6566 0.1370 write(94, "\0\bBE\0F1 J d T 1131114".., 8192) = 8192
> /29: 24.7100 0.0534 write(94, "01 DF10FD7B1189F\tA8011C".., 8192) = 8192
> /13: 24.9666 0.5914 write(94, " O0E u\bED8C b0F h\fB0 U".., 3334) = 3334
>
> When writing large files, this is busting disk subsystem, especially with RAID.
> To further optimise disk write access we could think about buffering writes
> inside squid so that we at least align writes into suitable sizes, and ideally,
> (with 16KB) buffers are able to buffer full swapout event into one shot
> (open + write + close) for 90% of cases.

Part of my upcoming modifications to squid will include the swapping of
objects in and out of disk in a semi-sane manner, ie you pass storeRead()
and storeWrite() a memObject *instead*, and let the storeRead() and
storeWrite() calls fill and empty the memObject as they see fit. I am
still working on some network IO optimisations.

I agree that shifting the buffer sizes to a uniform, fixed size is a good
thing. If noone disagrees I'll commit this (and your previous patch to
fix up some un-initialised things) real soon. Really this time. :-)

Adrian

-- 
Adrian Chadd			"If a butterfly flaps its wings in China,
<adrian@creative.net.au>	    will a women get naked in Amsterdam?"
				      -- Ashley Penney on Chaos Theory
Received on Fri Sep 15 2000 - 22:46:19 MDT

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