[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: ext3 performance issue with a Berkeley db application



On Mon, 03 Feb 2003, Andrew Morton wrote:

> Matthias Andree <matthias andree gmx de> wrote:
> >
> > If it's acceptable for you to build the current bogofilter package
> > http://bogofilter.sourceforge.net/
> 
> How does a complete autoconf/automake ignoramus build this, after having done
> a CVS checkout?

autoreconf -fisv # <- that's the new part :-)
./configure -C
make

However, I am attaching a small C program that mimics Greg's access
pattern he straced good enough for me to reproduce, I posted it to
bogofilter-dev to ask Greg if the program reproduces his problem and
intended to hold it back until he confirmed it, but because it works for
me and might save you some time, here you are.

Compile with

gcc -O -o simbf simbf.c -W -Wall

Then run like this:

time ./simbf >/your/file

Make sure /your/file doesn't exist, the first 20 MB will contain trash.

If you can, try this on IDE, my preliminary results are:

IDE + ext3     -> I pressed ^C after 8 minutes 7200/min drive IBM DTLA hdc
IDE + reiserfs -> completes in c. 23 s 5400/min drive IBM DJNA hdb
SCSI + ext3    -> completes in c. 24 s 7200/min drive Fujitsu MAH

The IDE interface is idle, hda is an idle Maxtor 4K060H3, all IDE drives
talk UDMA4 (66 MByte/s), the SCSI drive talks UWSCSI (16-bit 20 MXfer/s,
40 MByte/s). None of the test partitions is close to full or in
LVM/EVMS.

I'm using SuSE's k_athlon-2.4.19-167 for SuSE Linux 8.1 which is
compiled for 4 GB support.

What simbf does: assume the file is partitioned into "pages" of 4,096
bytes each, perform 500,000 pwrite() to a random location, where the
upper bound of the random generator starts with 0 and is increased by
.01 per write, so we end writing into a random page between #0 and
#5,000 -- each page is 4096 bytes, as in BerkeleyDB. This resembles the
real access pattern good enough IMHO.

HTH,

-- 
Matthias Andree
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>

#define PN "simbf"

void die(void)
{
    perror(PN);
    exit(EXIT_FAILURE);
}

int main(void)
{
    int fd = 1;

    /* seed PRNG */
    {
	struct timeval tv;
	if (gettimeofday(&tv, NULL)) die();
	srand(tv.tv_usec);
    }

    /* print pattern */
    {
	int i;
#define PAGES  ((double)5000)
#define WRITES ((double)500000)
#define PAGESIZE 4096
	char *p = calloc(PAGESIZE, 1);
	for (i = 0; i < WRITES ; i++) {
	    int j = PAGES/WRITES*i*rand()/(RAND_MAX+1.0);
	    *(long *)p = j; /* poison page */
	    if (pwrite(fd, p, PAGESIZE, j * PAGESIZE) != PAGESIZE) die();
	}
    }
    if (fsync(fd)) die();
    exit(EXIT_SUCCESS);
}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]