Re: PostgreSQL benchmarked on XFS vs ZFS vs btrfs vs ext4 - Mailing list pgsql-general

From Tomas Vondra
Subject Re: PostgreSQL benchmarked on XFS vs ZFS vs btrfs vs ext4
Date
Msg-id 4E712328.4050407@fuzzy.cz
Whole thread Raw
In response to PostgreSQL benchmarked on XFS vs ZFS vs btrfs vs ext4  (Toby Corkindale <toby.corkindale@strategicdata.com.au>)
List pgsql-general
Dne 14.9.2011 03:15, Toby Corkindale napsal(a):
> Hi,
> Some months ago, I ran some (probably naive) benchmarks looking at how
> pgbench performed on an identical system with differing filesystems. (on
> Linux).
>
> Since then the kernel-level version of ZFS became usable, and there have
> been improvements to btrfs, and no doubt various updates in the Linux
> kernel and PostgreSQL that should help performance.
>
> I ran the tests on Ubuntu 11.04 with Pg 9.0 first, then upgraded the
> system to Ubuntu 11.10 (beta) with Pg 9.1 and ran them again.
>
> The latter combination showed a considerable performance improvement
> overall - although I didn't investigate to find out whether this was due
> to kernel improvements, postgres improvements, or virtio improvements.
>
> The results are measured in transactions-per-second, with higher numbers
> being better.
>
> Results:
>
> ext4 (data=writeback,relatime):
>     natty: 248
>   oneiric: 297
>
> ext4 (data=writeback,relatime,nobarrier):
>     natty: didn't test
>   oneiric: 1409
>
> XFS (relatime):
>     natty: didn't test
>   oneiric: 171
>
> btrfs (relatime):
>     natty: 61.5
>   oneiric: 91
>
> btrfs (relatime,nodatacow):
>     natty: didn't test
>   oneiric: 128
>
> ZFS (defaults):
>     natty: 171
>   oneiric: 996
>
>
> Conclusion:
> Last time I ran these tests, xfs and ext4 pulled very similar results,
> and both were miles ahead of btrfs. This time around, ext4 has managed
> to get a significantly faster result than xfs.
>
> However we have a new contender - ZFS performed *extremely* well on the
> latest Ubuntu setup - achieving triple the performance of regular ext4!
> I'm not sure how it achieved this, and whether we're losing some kind of
> data protection (eg. like the "barrier" options in XFS and ext4).
> If ext4 has barriers disabled, it surpasses even ZFSs high score.
>
> Oddly, ZFS performed wildly differently on ubuntu 11.04 vs 11.10b. I
> can't explain this. Any ideas?

Those results look very suspisicous I guess. Unless we know all the
details about the fs options, pgbench runs and system (drives, cache,
controller) it's very difficult to say anything.

For example the ZFS results seem really strange - I've done a quite
thorough benchmark of file systems last month (http://bit.ly/oEdkSH) and
I really don't think the differences can be that huge under the same
conditions - increase from 171 to 996 is ridiculous.

The only explanation I can come up with is that oneiric uses
significantly weaker ZFS options (e.g. disabled write barriers) and
there's a controller with write cache.

But that also means you should not compare ZFS to plain ext4 (297 tps)
but to ext4 with write barriers disabled (1409 tps). That changes the
results a bit, because instead of being 3x faster, ZFS is about 30% slower.

Tomas

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Identifying Reason for Column Name Returned by SELECT
Next
From: Greg Howard
Date:
Subject: Noob help for charting on web site, need assistance