Btrfs is a filesystem which is very new and is still under development and benchmarking phase. As far as performance is concerned usually it doesn’t require much to do with because it works good with the default options.

 

1. Btrfs’s performance improves with use of ssd.

 

Btrfs is SSD-aware and exploits TRIM/Discard to allow the file system to report unused blocks to the storage device for reuse. On SSDs, Btrfs avoids unnecessary seek optimization and aggressively sends writes in clusters, even if they are from unrelated files.

 

Note: You mount with -o ssd to enable the tuning.

 

2. Enable online defragmentaion.

Btrfs provides a mount option (-o autodefrag) that enables an auto-defragmentation helper. When a block is copied and written to disk, the auto-defragmentation helper marks that portion of the file for defragmentation and hands it off to another thread, enabling fragmentation to be reduced automatically in the background. This capability can provide significant benefit to small database workloads, browser caches, and similar workloads. The great thing is that defragmentation can take place while the file system is mounted and actively performing operations.

 

3. Use noatime option instead of relatime.

 

noatime mount option might speed up your file system, especially in case you have lots of snapshots. Each read access to a file is supposed to update its unix access time. COW will happen and will make even more writes. Default is now relatime which updates access times less often.

 

4. Other mount options

 

Below are few other mount option which you can consider with your need and requirements.

 

space_cache – Btrfs stores the free space data ondisk to make the caching of a block group much quicker (Kernel 2.6.37+). It’s a persistent change and is safe to boot into old kernels.

nodatacow – Do not copy-on-write data. datacow is used to ensure the user either has access to the old version of a file, or to the newer version of the file. datacow makes sure we never have partially updated files written to disk. nodatacow gives slight performance boost by directly overwriting data (like ext[234]), at the expense of potentially getting partially updated files on system failures. Performance gain is usually < 5% unless the workload is random writes to large database files, where the difference can become very large

compress=zlib – Better compression ratio. It’s the default and safe for olders kernels.

compress=lzo – Fastest compression. btrfs-progs 0.19 or olders will fail with this option. The default in the kernel 2.6.39 and newer.

autodefrag – will detect random writes into existing files and kick off background defragging. It is well suited to bdb or sqlite databases, but not virtualization images or big databases (yet). Once the developers make sure it doesn’t defrag files over and over again, they’ll move this toward the default. (Kernel 3.0+)

inode_cache – enable the new free inode cache. This option maybe slowdown your system at first run. (Kernel 3.0+)

 

Was this answer helpful? 2 Users Found This Useful (4 Votes)