What are some good ways of increasing disk performance on Linux?
I'm not interested in
hdparm settings, since those are:
- set to good defaults in recent distros;
- not applicable to
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
There are hundreds of possibilities. You can create a RAID array with MD, for example. Maybe if you put more RAM into the computer it will perform better because the disk cache can contain more data. If your partition is closer to the beginning of the disk it will perform better.
And don't forget about different file systems! Ext4 and XFS for example might give you a boost because of their delayed allocation. Another common technique is to use the "relatime" mount option. Many people also think that fragmentation only occurs on Windows but it's far from the true. The problem is that defragmentation is only possible on XFS and ext4. But these things can be workload specific.
However, if you reduce the load then that gives a general performance boost. The easiest way to do this is to mount the /tmp as tmpfs. (Thanks for the tip, theotherreceive!) Of course you have to have enough RAM for this, but it might be faster even if it runs from swap because files are memory mapped.
Well, there is the much discussed atime setting on ext3, a very common filesystem, used by default in many distributions. If it is used, it might slow down simple read operations because there is a write operation for every read operation.
Generally, it is a good idea to choose the filesystem in use according to the expected usage pattern. It can yield a reasonable increase in performance wihout the need for low level meddling.
I use noatime on my '/' and '/home' partitions, and I have noticed quite a difference in performance. The most noticeable difference is when compiling large projects. Before adding noatime, it would be difficult to do much of anything when linking large object files, but after the change, the system runs a lot more smoothly throughout the whole process.
I'm running it on Fedora 7, and the only problem I've had with noatime so far is with tmpwatch. For my system, I had to add the '-c' option to the tmpwatch calls in /etc/cron.daily/tmpwatch.
I should also note that I'm using Maildir / dovecot for mail, as there is a potential issue with other mail setups. You may want to look around on google (just search noatime mail) if you do any local mail storage and think that this could be a issue.
Use MD to put your disks in an array type that has striping.
hdparm you are at fairly optimal performance for a single disk to begin with. Pick a file system that behaves right for your I/O load - you can also tune block sizes on some file systems. Check that your controller and drives support NCQ. This will improve speed on heavier loads.
Beyond that, software RAID on Linux is vastly better than it is on Windows.
With a bit of frigging I could max out the PCI bus (533 MB/sec) on an intellistation Z pro 6221 with fairly low CPU load. This used two QLA2342 HBAs and a Xyratex RS1600 with a split backplane and direct I/O. The I/O subsystem on Linux is quite fast.