Monday, December 14, 2009

Sqlite-EXT4 Performance Regression

People using Fedora 11 and beyond (or maybe any other linux distro for that matter) would notice a major loss in performance while working with SQlite if their partitions are formatted to EXT4. Applications like liferea take ages processing new feeds and at the same time, the HDD gets thrashed.

After banging my head at it and countless google searches, I came across a thread that explained the problem cleanly:

http://bbs.archlinux.org/viewtopic.php?pid=498350#p498350

It turns out EXT4 has a feature called "Barriers" and that is where all the extra overhead comes from. A thorough explanation is here and I would suggest a read: http://lwn.net/Articles/283161/

Anyway, for me, performance is more important so I disabled barriers on my root partition. The procedure is rather easy and just requires a file edit

$> su
#> vim /etc/fstab

There should be a line like:

"UUID=blahblahblah-blah-blah-blah-blahblahblahblah / ext4 defaults 1 1
"

Modify the line by changing the 'defaults' to 'defaults,barrier=0' so it becomes like:

"UUID=blahblahblah-blah-blah-blah-blahblahblahblah / ext4 defaults,barrier=0 1 1"

And reboot. This should disable barriers.

NOTE: This will only change the barrier setting on the root partition, if there are other partitions with EXT4 filesystem and you would like to apply the setting to them also, then the fstab file needs to changed for those partitions also.

No comments: