PDA

View Full Version : [ubuntu] [12.04] Very slow EXT4 write performance



htt-thalan
May 1st, 2012, 04:37 PM
Hi!

Strangest problem here, lemme try and explain:

Home-built 'server': AMD Dualcore, 8gb, 320gb OS disk and 500gb secondary disk, both formatted EXT4 and freshly installed with 11.10 a few weeks ago. The Server has a Canon IP4700 connected (shared via samba) and I mapped/mounted the secondary 500gb disk to a specific folder in my home directory, called 'netshare'. This folder is also shared via Samba, together with the printer, with my windows workstations in the network.

Usual updates, blabla, everything works fine :P. Can print to printer, can write to share, speed usually about 20 ~ 30Mb/sec.

A week ago I noticed that writing to the share via the network is supercalifragilisticexpialidocously slow! Write speeds are in the order of tens of KILOBYTES per second, up to an observed maximum of 550Kb/sec.

So far I've tried:

- rebooting
- installing new realtek gigabit drivers
- upgrading to 12.04
- reading info from share to windows laptop

and that's the kicker: reading is as fast as usual. It's only writing TO the share that's giving me headaches. So I started testing stuff:

- duplicating a 130Mb file within the affected drive (so a copy and write from sdb to sdb): write speed ~1,2Mb/sec
- reading a file from share to windows laptop: ~60Mb/sec
- copying files from sdb to sda: ~58Mb/sec

So I'm pretty sure the problem lies within the machine itself, the sdb disk in particular. Googling learnt me little but for a possibilty of a misalignment, which is being denied by the built-in disk utility: everything is a-ok, even the smart status checks out perfectly. Can't do a bare write test though, that would require removing its partition entirely and thus my data (~ 300Gb).

For clarity: these are my mount options in fstab:

UUID=<number> /home/<username>/netshare ext4 rw,user,sync,exec 0 2

Sooo... I've run out of places to check! What can I do! :(

Gyokuro
May 1st, 2012, 08:40 PM
Hi

Looking at your fstab I'm wondering how you have partioned your disk as you are mounting your drive with the sync switch. Therefore it's slower as async mounts but 500kb/s is really slow.

Can you please post an iostat dump during writes?

Standard installations mount it with defaults switch. To speed up in general disk performance you should consider to use

a.) LVM
b.) additional switches like noatime, relatime

Write performance is in general 1/3 slower as reads.

htt-thalan
May 2nd, 2012, 07:13 AM
Hi

Looking at your fstab I'm wondering how you have partioned your disk as you are mounting your drive with the sync switch. Therefore it's slower as async mounts but 500kb/s is really slow.

Can you please post an iostat dump during writes?

Standard installations mount it with defaults switch. To speed up in general disk performance you should consider to use

a.) LVM
b.) additional switches like noatime, relatime

Write performance is in general 1/3 slower as reads.

Hi, and thanks for your reply!

I added the 'sync' option because it's being used as a NAS over the network, I figured data security was more important than speed, but 500Kb/sec kind of defeats the purpose of having a NAS in the first place. Because it's essentially a desktop with only one PSU there is always a chance of it failing mid-write, thus causing data corruption. I was planning to use BTRFS instead of EXT4 but hesitated because it's not really GA material yet.

Relatime should be a default switch used by Ubuntu, unless overwritten, right?

What would using an LVM add or improve to the situation? It's just a plain disk formatted as one partition, I don't need anything more than that.

Will get back on that IOstat later.

Li Ling
May 11th, 2012, 03:38 PM
Try to mount the slow partition with nobarrier option, that works for me.