apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: disk i/o problems
Date Tue, 27 Mar 2001 13:40:10 GMT
Ben Collins-Sussman <sussman@newton.ch.collab.net> writes:

> Jeff Trawick <trawickj@bellsouth.net> writes:
> 
> > Ben Collins-Sussman <sussman@newton.ch.collab.net> writes:
> > 
> > > Hi all -- I'm getting some weird disk slowdowns on FreeBSD 4.2.
> > 
> > Did you by chance look at an strace/truss of your APR app on Linux and
> > FreeBSD to see what APR is doing on your file?
> 
> I used 'truss' during a subversion checkout and I saw nothing
> suspicious.  But to be honest, I wouldn't know what "wrongness" would
> look like!  I'm just not familiar enough with system calls.

read() (or write() -- I don't know what operation you're doing) for
small amounts... you'd want to get APR to read() big chunks, like 4K
or 8K or similar... definitely not 10 bytes, then 123 bytes, then 80
bytes, etc.

> > Are you using buffered APR file support?
> > 
> 
> Huh?  What?  Please explain.

On apr_file_open(), specify APR_BUFFERED.  This causes the file I/O
support to act like the C Standard Library stdio routines, in that it
will minimize system calls.

On the first read it grabs a bunch of data in one syscall, continues
to service read operations from that bunch of data until exhausted, at
which point it does another syscall.

If the I/O isn't buffered, then your performance will be affected by

. cost of system call
. buffer cache (design and/or tuning and/or amount of real memory
  available)

I can easily imagine that performance of an I/O-intensive program
using non-buffered I/O could vary drastically between systems.

> If I can't figure out what's going on, maybe I can show people the
> problem next week at the Hackathon...

No problem... I'll be the one trying to find a place to plug in my
ethernet cable.

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message