* write() hangs during flush
@ 2017-07-20 6:07 Brian Malehorn
2017-07-20 6:22 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Brian Malehorn @ 2017-07-20 6:07 UTC (permalink / raw)
To: linux-ext4
Hi,
I'm debugging an issue where write() can sometimes take several
seconds to complete. I'm looking for general guidance on why this
might happen, and what I can do about it.
While I originally encountered the problem on an embedded device
writing to an MMC, I can also reproduce it on my laptop (Ubuntu
16.04):
pv -L 100m /dev/zero |
strace -s 8 -T -e trace=write dd bs=32k of=./zero 2>&1 |
awk 'substr($NF, 2, length($NF)-2) + 0 > 0.1'
write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <0.145895>
write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <0.673575>
write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <0.126722>
write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <1.284791>
In the above example, I write 100 MiB / second, and print out any
write() that took over 100 ms. In the output, the slowest write was
1.28 seconds. I can provide more details about the setup if needed.
I believe this is happening:
1. accumulate lots of data in cache
2. filesystem decides to flush
3. nobody can write during flush
4. flush flushes "a lot" of data - maybe everything
Do my guesses align with reality, or is there another explanation?
Does anybody have ideas on how to make this more "smooth"? Ideally,
I'd like each write() to be slowed down a little bit, rather than
99.99% of writes completing instantly and 0.01% taking over a second.
Thanks,
Brian
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: write() hangs during flush
2017-07-20 6:07 write() hangs during flush Brian Malehorn
@ 2017-07-20 6:22 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2017-07-20 6:22 UTC (permalink / raw)
To: Brian Malehorn; +Cc: linux-ext4
On Wed, Jul 19, 2017 at 11:07:08PM -0700, Brian Malehorn wrote:
> Hi,
>
> I'm debugging an issue where write() can sometimes take several
> seconds to complete. I'm looking for general guidance on why this
> might happen, and what I can do about it.
>
> While I originally encountered the problem on an embedded device
> writing to an MMC, I can also reproduce it on my laptop (Ubuntu
> 16.04):
>
> pv -L 100m /dev/zero |
> strace -s 8 -T -e trace=write dd bs=32k of=./zero 2>&1 |
> awk 'substr($NF, 2, length($NF)-2) + 0 > 0.1'
>
> write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <0.145895>
> write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <0.673575>
> write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <0.126722>
> write(1, "\0\0\0\0\0\0\0\0"..., 32768) = 32768 <1.284791>
>
> In the above example, I write 100 MiB / second, and print out any
> write() that took over 100 ms. In the output, the slowest write was
> 1.28 seconds. I can provide more details about the setup if needed.
>
> I believe this is happening:
>
> 1. accumulate lots of data in cache
> 2. filesystem decides to flush
> 3. nobody can write during flush
> 4. flush flushes "a lot" of data - maybe everything
>
> Do my guesses align with reality, or is there another explanation?
>
> Does anybody have ideas on how to make this more "smooth"? Ideally,
> I'd like each write() to be slowed down a little bit, rather than
> 99.99% of writes completing instantly and 0.01% taking over a second.
/proc/sys/vm/dirty* knobs?
--D
>
> Thanks,
> Brian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-20 6:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20 6:07 write() hangs during flush Brian Malehorn
2017-07-20 6:22 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).