From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: "Libor Klepáč" <libor.klepac@bcom.cz>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: BTRFS and cyrus mail server
Date: Wed, 8 Feb 2017 14:21:13 -0500 [thread overview]
Message-ID: <e6da1740-cdb0-96ce-4f44-3b8fa32fd052@gmail.com> (raw)
In-Reply-To: <24389268.gAX5gEpECb@libor-nb>
On 2017-02-08 13:38, Libor Klepáč wrote:
> Hello,
> inspired by recent discussion on BTRFS vs. databases i wanted to ask on
> suitability of BTRFS for hosting a Cyrus imap server spool. I haven't found
> any recent article on this topic.
>
> I'm preparing migration of our mailserver to Debian Stretch, ie. kernel 4.9
> for now. We are using XFS for storage now. I will migrate using imapsync to
> new server. Both are virtual machines running on vmware on Dell hardware.
> Disks are on battery backed hw raid controllers over vmfs.
>
> I'm considering using BTRFS, but I'm little concerned because of reading this
> mailing list ;)
FWIW, as long as you're using a recent kernel and take the time to do
proper maintenance on the filesystem, BTRFS is generally very stable.
WRT mail servers specifically, before we went to a cloud service for
e-mail where I work, we used Postfix + Dovecot on our internal server,
and actually saw a measurable performance improvement when switching
from XFS to BTRFS. That was about 3.12-3.18 vintage on the kernel
though, so YMMV.
>
> I'm interested in using:
> - compression (emails should compress well - right?)
Yes, very well assuming you're storing the actual text form of them (I
don't recall if Cyrus does so, but I know Postfix, Sendmail, and most
other FOSS mail server software do). The in-line compression will also
help reduce fragmentation, and unless you have a really fast storage
device, should probably improve performance in general.
> - maybe deduplication (cyrus does it by hardlinking of same content messages
> now) later
Deduplication beyond what Cyrus does is probably not worth it. In most
cases about 10% of an e-mail in text form is going to be duplicated if
it's not a copy of an existing message, and that 10% is generally spread
throughout the file (stuff like MIME headers and such), so you would
probably see near zero space savings for doing anything beyond what
Cyrus does while using an insanely larger amount of resources.
> - snapshots for history
Make sure you use a sane exponential thinning system. Once you get past
about 300 snapshots, you'll start seeing some serious performance
issues, and even double digits might hurt performance at the scale
you're talking about.
> - send/receive for offisite backup
This is up to you, but I would probably not use send-receive for
off-site backups. Unless you're using reflinking, you can copy all the
same attributes that send-receive does using almost any other backup
tool, and other tools often have much better security built-in. Send
streams also don't compress very well in my experience, so using
send-receive has a tendency to require more network resources.
> - what about data inlining, should it be turned off?
Generally no, and especially if you handle lots of small e-mails.
Metadata blocks need to be looked up to open and read files anyway,
in-lining the data means that you don't need to read in any more blocks
for files small enough to fit in the spare space in the metadata block
or when you only need to read the first few kilobytes of the file (and
if Cyrus' IMAP/POP server works anything like most others I've seen, it
will be parsing those first few KB because that's where the headers it
indexes are).
>
> Our Cyrus pool consist of ~520GB of data in ~2,5million files, ~2000
> mailboxes.
> We have message size limit of ~25MB, so emails are not bigger than that.
> There are however bigger files, these are per mailbox caches/index files of
> cyrus (some of them are around 300MB) - and these are also files which are
> most modified.
I would mark these files NOCOW for performance reasons (and because if
they're just caches and indexes, they should be pretty simple to
regenerate).
> Rest of files (messages) are usualy just writen once.
>
> -----------
> I started using btrfs on backup server as a storage for 4 backuppc run in
> containers (backups are then send away with btrbk), year ago.
> After switching off data inlining i'm satisfied, everything works (send/
> receive is sometime slow, but i guess it's because of sata disks on receive
> side).
next prev parent reply other threads:[~2017-02-08 19:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 18:38 BTRFS and cyrus mail server Libor Klepáč
2017-02-08 19:21 ` Austin S. Hemmelgarn [this message]
2017-02-09 11:49 ` Adam Borowski
2017-02-09 12:53 ` Austin S. Hemmelgarn
2017-02-08 19:59 ` Kai Krakow
2017-02-08 23:19 ` Graham Cobb
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=e6da1740-cdb0-96ce-4f44-3b8fa32fd052@gmail.com \
--to=ahferroin7@gmail.com \
--cc=libor.klepac@bcom.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox