public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Matthew Kirk" <mkirk01@rcn.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: fsync occasionally very slow
Date: Mon, 29 Jan 2007 15:22:27 -0800	[thread overview]
Message-ID: <20070129152227.cb417f69.akpm@osdl.org> (raw)
In-Reply-To: <002701c743f1$2271c850$6600a8c0@charm>

On Mon, 29 Jan 2007 17:02:14 -0500
"Matthew Kirk" <mkirk01@rcn.com> wrote:

> Regarding the long fsyncs, here's a trace...
> 
> I upgraded to a more recent kernel - 2.6.18.6 - and ran it on a workstation.
> This particular box has In this case the elevator is CFQ.
> 
> This sample came from a stall that lasted about 2.5 minutes(!) - the longest
> one I've seen yet.  The box is a bit more memory constrained than the
> original system but exhibits similar behavior.  It doesn't page.  Also,
> there is no raid card - simply striped PATA drives.

Using your little test app, the longest fsync() stall I can demonstrate on
2.6.20-rc4-mm1 on plain-old-sata-disk is 1.2 seconds.

What's the max stall you're able to see with the test app?

Perhaps the file is just super-fragmented.  If your production app does
something like: 

	for (a lot) {
		fd = open(name);
		write(fd, a little bit);
		close(fd);
	}

in multiple threads, or against a lot of different files then you might be
fragmenting the files a lot.  This is because ext3 discards its in-core
anti-fragmentation data structures on close().  So

- Please check your app, see whether or not it is frequently opening and
  closing the output files.

- Using `bmap' from
  http://www.zip.com.au/~akpm/linux/patches/stuff/ext3-tools.tar.gz,
  determine whether the offending files are highly fragmented.

- Tell us how much dirty data is being written out by these fsyncs?

- Try mounting the filesystem with `-o data=writeback'.  Probably won't
  help much if it's also demonstrable on ext2.

- Can you reproduce the stalls on a plain-old-disk?  Get RAID out of the
  picture?

- You've seen the stalls with both CFQ and AS.  I guess you could try
  deadline and no-op, but it sounds like that won't help.



      reply	other threads:[~2007-01-29 23:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-26 10:37 fsync occasionally very slow Matthew Kirk
2007-01-26 11:16 ` Andrew Morton
2007-01-26 19:33   ` Matthew Kirk
2007-01-26 19:48     ` Andrew Morton
2007-01-31 13:18       ` Matthew Kirk
2007-01-29 22:02   ` Matthew Kirk
2007-01-29 23:22     ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070129152227.cb417f69.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkirk01@rcn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox