All of lore.kernel.org
 help / color / mirror / Atom feed
From: Austin S Hemmelgarn <ahferroin7@gmail.com>
To: "CHENG Yuk-Pong, Daniel " <j16sdiz@gmail.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: More memory more jitters?
Date: Mon, 16 Nov 2015 08:34:59 -0500	[thread overview]
Message-ID: <5649DB83.2080108@gmail.com> (raw)
In-Reply-To: <CAOcLnUfVNvRLYdeQG_kTZyXaceaLCez=XsQ8PXwEyaXPeYiMwg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

On 2015-11-14 09:11, CHENG Yuk-Pong, Daniel  wrote:
> Hi List,
>
>
> I have read the Gotcha[1] page:
>
>     Files with a lot of random writes can become heavily fragmented
> (10000+ extents) causing trashing on HDDs and excessive multi-second
> spikes of CPU load on systems with an SSD or **large amount a RAM**.
>
> Why could large amount of memory worsen the problem?
>
> If **too much** memory is a problem, is it possible to limit the
> memory btrfs use?
As Duncan already replied, your issue is probably with the kernel's 
ancient defaults for write-back buffering.  It defaults to waiting for 
10% of system RAM to be pages that need written to disk before forcing 
anything to be flushed.  This worked fine when you had systems where 
256M was a lot of RAM, but is absolutely inane when you get above about 
4G (the actual point at which it becomes a problem is highly dependent 
on your storage hardware however).  I find that on most single disk 
systems with a fast disk, you start to get slowdowns when trying to 
cache more than about 256M for writeback.
>
> Background info:
>
> I am running a heavy-write database server with 96GB ram. In the worse
> case it cause multi minutes of high cpu loads. Systemd keeping kill
> and restarting services, and old job don't die because they stuck in
> uninterruptable wait... etc.
>
> Tried with nodatacow, but it seems only affect new file. It is not an
> subvolume option either...
This is a known limitation, although NOCOW is still something that 
should be used for database files.  The trick to get it set on an 
existing file is to create a new, empty file, set the attribute on that, 
then copy the existing file into the new one, then rename the new one 
over the old one.



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3019 bytes --]

      parent reply	other threads:[~2015-11-16 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14 14:11 More memory more jitters? CHENG Yuk-Pong, Daniel 
2015-11-14 14:31 ` Hugo Mills
2015-11-14 16:37   ` Duncan
2015-11-15  7:40     ` Duncan
2015-11-15 16:58 ` Patrik Lundquist
2015-11-16 13:34 ` Austin S Hemmelgarn [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=5649DB83.2080108@gmail.com \
    --to=ahferroin7@gmail.com \
    --cc=j16sdiz@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.