From: Martin Steigerwald <martin@lichtvoll.de>
To: Hugo Mills <hugo@carfax.org.uk>
Cc: MegaBrutal <megabrutal@gmail.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: BTRFS and databases
Date: Thu, 02 Aug 2018 11:16:18 +0200 [thread overview]
Message-ID: <2861903.YXSMuvecdq@merkaba> (raw)
In-Reply-To: <20180801085602.GC7524@carfax.org.uk>
Hugo Mills - 01.08.18, 10:56:
> On Wed, Aug 01, 2018 at 05:45:15AM +0200, MegaBrutal wrote:
> > I know it's a decade-old question, but I'd like to hear your
> > thoughts
> > of today. By now, I became a heavy BTRFS user. Almost everywhere I
> > use BTRFS, except in situations when it is obvious there is no
> > benefit (e.g. /var/log, /boot). At home, all my desktop, laptop and
> > server computers are mainly running on BTRFS with only a few file
> > systems on ext4. I even installed BTRFS in corporate productive
> > systems (in those cases, the systems were mainly on ext4; but there
> > were some specific file systems those exploited BTRFS features).
> >
> > But there is still one question that I can't get over: if you store
> > a
> > database (e.g. MySQL), would you prefer having a BTRFS volume
> > mounted
> > with nodatacow, or would you just simply use ext4?
>
> Personally, I'd start with btrfs with autodefrag. It has some
> degree of I/O overhead, but if the database isn't performance-critical
> and already near the limits of the hardware, it's unlikely to make
> much difference. Autodefrag should keep the fragmentation down to a
> minimum.
I read that autodefrag would only help with small databases.
I also read that even on SSDs there is a notable performance penalty.
4.2 GiB akonadi database for tons of mails appears to work okayish on
dual SSD BTRFS RAID 1 here with LZO compression here. However I have no
comparison, for example how it would run on XFS. And its fragmented
quite a bit, example for the largest file of 3 GiB – I know this in part
is also due to LZO compression.
[…].local/share/akonadi/db_data/akonadi> time /usr/sbin/filefrag
parttable.ibd
parttable.ibd: 45380 extents found
/usr/sbin/filefrag parttable.ibd 0,00s user 0,86s system 41% cpu 2,054
total
However it digs out those extents quite fast.
I would not feel comfortable with setting this file to nodatacow.
However I wonder: Is this it? Is there nothing that can be improved in
BTRFS to handle database and VM files in a better way, without altering
any default settings?
Is it also an issue on ZFS? ZFS does also copy on write. How does ZFS
handle this? Can anything be learned from it? I never head people
complain about poor database performance on ZFS, but… I don´t use it and
I am not subscribed to any ZFS mailing lists, so they may have similar
issues and I just do not know it.
Well there seems to be a performance penalty at least when compared to
XFS:
About ZFS Performance
Yves Trudeau, May 15, 2018
https://www.percona.com/blog/2018/05/15/about-zfs-performance/
The article described how you can use NVMe devices as cache to mitigate
the performance impact. That would hint that BTRFS with VFS Hot Data
Tracking and relocating data to SSD or NVMe devices could be a way to
set this up.
But as said I read about bad database performance even on SSDs with
BTRFS. I do not find the original reference at the moment, but I got
this for example, however it is from 2015 (on kernel 4.0 which is a bit
old):
Friends don't let friends use BTRFS for OLTP
2015/09/16 by Tomas Vondra
https://blog.pgaddict.com/posts/friends-dont-let-friends-use-btrfs-for-oltp
Interestingly it also compares with ZFS which is doing much better. So
maybe there is really something to be learned from ZFS.
I did not get clearly whether the benchmark was on an SSD, as Tomas
notes the "ssd" mount option, it might have been.
Thanks,
--
Martin
next prev parent reply other threads:[~2018-08-02 11:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 3:45 BTRFS and databases MegaBrutal
2018-08-01 8:48 ` Duncan
2018-08-01 8:56 ` Hugo Mills
2018-08-02 9:16 ` Martin Steigerwald [this message]
2018-08-02 10:15 ` ein
2018-08-02 10:35 ` Andrei Borzenkov
2018-08-02 10:42 ` Martin Steigerwald
2018-08-02 10:53 ` Qu Wenruo
2018-08-01 8:59 ` Mike Fleetwood
2018-08-01 11:21 ` Adam Borowski
2018-08-01 12:19 ` Austin S. Hemmelgarn
2018-08-01 14:33 ` Remi Gauvin
2018-08-02 7:07 ` Qu Wenruo
2018-08-02 12:32 ` Remi Gauvin
2018-08-02 7:02 ` Qu Wenruo
2018-08-02 10:45 ` Andrei Borzenkov
2018-08-02 10:56 ` Qu Wenruo
2018-08-02 12:27 ` Austin S. Hemmelgarn
2018-08-02 13:14 ` Martin Raiber
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=2861903.YXSMuvecdq@merkaba \
--to=martin@lichtvoll.de \
--cc=hugo@carfax.org.uk \
--cc=linux-btrfs@vger.kernel.org \
--cc=megabrutal@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;
as well as URLs for NNTP newsgroup(s).