|
網誌存檔
熱門網志
|
|
|
Are you running an Intel Linux system with at least one (E)IDE hard drive? Wouldn`t it be neat if there were a magical command to instantly double the I/O performance of your disks? Or, in some cases, show 6 to 10 times your existing throughput? Did you ever just wonder how to tell what kind of performance you`re getting on your "tricked-out" Linux box? Don`t overlook What`s the big deal?So, you`ve got your brand-new UltraATA/66 EIDE drive with a screaming brand-new controller chipset that supports multiple PIO modes and DMA and the leather seat option and extra chrome... But is your system actually taking advantage of these snazzy features? The Now before you get too excited, it is worth pointing out that under some circumstances, these commands CAN CAUSE UNEXPECTED DATA CORRUPTION! Use them at your own risk! At the very least, back up your box and bring it down to single-user mode before proceeding. With the usual disclaimer out of the way, I`d like to point out that if you are using current hardware (i.e. your drive AND controller AND motherboard were manufactured in the last two or three years), you are at considerably lower risk. I`ve used these commands on several boxes with various hardware configurations, and the worst I`ve seen happen is the occasional hang, with no data problems on reboot. And no matter how much you might whine at me and the world in general for your personal misfortune, we all know who is ultimately responsible for the well-being of YOUR box: YOU ARE. Caveat Fair Reader. Now, then. If I haven`t scared you away yet, try this (as root, preferably in single-user mode): You`ll see something like: /dev/hda: What does this tell us? The But even with varying numbers, 3.58 MB/sec is PATHETIC for the above hardware. I thought the ad for the HD said something about 66MB per second!!?!? What gives? Well, let`s find out more about how Linux is addressing your drive:
These are the defaults. Nice, safe, but not necessarily optimal. What`s all this about 16-bit mode? I thought that went out with the 386! And why are most of the other options turned off? Well, it`s generally considered a good idea for any self-respecting distribution to install itself in the kewlest, slickest, but SAFEST way it possibly can. The above settings are virtually guaranteed to work on any hardware you might throw at it. But since we know we`re throwing something more than a dusty, 8-year-old, 16-bit multi-IO card at it, let`s talk about the interesting options:
TurbochargedSo, since we have our system in single-user mode like a good little admin, let`s try out some turbo settings:
Great! 32-bit sounds nice. And some multi-reads might work. Let`s re-run the benchmark:
WOW! Almost double the disk throughput without really trying! Incredible. But wait, there`s more: We`re still not unmasking interrupts, using DMA, or even a using decent PIO mode! Of course, enabling these gets riskier. (Why is it always a trade-off between freedom and security?) The man page mentions trying Multiword DMA mode2, so: ...Unfortunately this seems to be unsupported on this particular box (it hung like an NT box running a Java app.) So, after rebooting it (again in single-user mode), I went with this:
And then checked:
20.13 MB/sec. A far cry from the miniscule 3.58 we started with... By the way, notice how we specified the Now, after running the benchmark a few more times, reboot in multi-user mode and fire up X. Load Netscape. And try not to fall out of your chair. In conclusionThis is one of those interesting little tidbits that escapes many "seasoned" Linux veterans, especially since one never sees any indication that the system isn`t using the most optimal settings. (Gee, all my kernel messages have looked fine....) And using hdparm isn`t completely without risk, but is well worth investigating. And it doesn`t stop at performance: hdparm lets you adjust various power saving modes as well. See the hdparm(8) for the final word. Many thanks to Mark Lord for putting together this nifty utility. If your particular distribution doesn`t include hdparm (usually in /sbin or /usr/sbin), get it from the source at http://metalab.unc.edu/pub/Linux/system/hardware/ Happy hacking! |
-------------------------------------------------
| 上一篇:獲取LINUX系統資訊(how to get system info in linux) | 下一篇:Jetty vs. Tomcat vs. Resin: A Performance Comparison |

