public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Wang Yugui <wangyugui@e16-tech.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: Question on slow fallocate
Date: Thu, 22 Jun 2023 15:44:10 +0800	[thread overview]
Message-ID: <20230622154405.9696.409509F4@e16-tech.com> (raw)
In-Reply-To: <CAD21AoCWW20ga6GKR+7RwRtvPU0VyFt3_acut_y+Fg7E-4nzWw@mail.gmail.com>

Hi,

> Hi all,
> 
> When testing PostgreSQL, I found a performance degradation. After some
> investigation, it ultimately reached the attached simple C program and
> turned out that the performance degradation happens on only the xfs
> filesystem (doesn't happen on neither ext3 nor ext4). In short, the
> program alternately does two things to extend a file (1) call
> posix_fallocate() to extend by 8192 bytes and (2) call pwrite() to
> extend by 8192 bytes. If I do only either (1) or (2), the program is
> completed in 2 sec, but if I do (1) and (2) alternatively, it is
> completed in 90 sec.
> 
> $ gcc -o test test.c
> $ time ./test test.1 1
> total   200000
> fallocate       200000
> filewrite       0
> 
> real    0m1.305s
> user    0m0.050s
> sys     0m1.255s
> 
> $ time ./test test.2 2
> total   200000
> fallocate       100000
> filewrite       100000
> 
> real    1m29.222s
> user    0m0.139s
> sys     0m3.139s
> 
> Why does it take so long in the latter case? and are there any
> workaround or configuration changes to deal with it?
> 

I test it on xfs linux 6.1.35 and 6.4-rc7

the result is almost same.

$ time ./test test.1 1
real    0m1.382s

$ time ./test test.2 2
real    0m9.262s

linunx kernel version please.

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2023/06/22


  reply	other threads:[~2023-06-22  7:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  5:34 Question on slow fallocate Masahiko Sawada
2023-06-22  7:44 ` Wang Yugui [this message]
2023-06-22  8:18   ` Masahiko Sawada
2023-06-23  0:47 ` Dave Chinner
2023-06-23  8:29   ` Ritesh Harjani
2023-06-23 10:07     ` Dave Chinner
2023-06-23 11:49       ` Ritesh Harjani
2023-06-23 20:04         ` Eric Sandeen
2023-06-26  3:17   ` Masahiko Sawada
2023-06-26 15:32     ` Eric Sandeen
2023-06-27 15:50       ` Masahiko Sawada
2023-06-27 16:12         ` Eric Sandeen
2023-06-28  4:56           ` Christoph Hellwig
2023-07-11 22:49           ` Andres Freund
2023-07-19  7:25             ` Dave Chinner
2023-07-19 20:29               ` Andres Freund
2023-07-19 20:38                 ` Eric Sandeen
2023-07-19 20:49                   ` Eric Sandeen
2023-07-19 22:23                     ` Andres Freund
2023-07-11 22:28   ` Andres Freund

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=20230622154405.9696.409509F4@e16-tech.com \
    --to=wangyugui@e16-tech.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sawada.mshk@gmail.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