Linux Tuning Tricks?
Milo_Mindbender writes: "Over the weekend I was attempting to improve my CD ripping performance and discovered RedHat 7.2 was running my Ultra/ATA 100 hard drive in a very slow non-DMA mode. After a fair amount of searching for how to fix this, a trivial change (look here) improved drive performance from 3MBs to 38MBs! FSCK on my 40gb partition went from over 5 minutes to under 1! This issue wasn't documented in RedHat's manuals but it effected a number of boxes in our office so I'm betting many other people in the world have the same problem. This made me wonder how many other common Linux tuning snafus there might be that a lot of people are probably missing. Do you know of any?"
On RedHat, you can use ksysv, the init editor, to turn off boot-time system services that are not needed. Candidates are daemons for GPM, USB, SCSI, LPD, APM, which are all enabled by default, and which may not be needed.
s/effected/affected/
Not trying to be a prick, just trying to let you know for future use! I see this mistake a lot, so...
"Effect" is a noun, whereas "affect" is a verb.
When you change something, you affect it. When something you did caused a change, you say the thing you did "had an effect".
(Effect can also be a verb meaning "to cause", but it's rarely used that way. i.e. "I effected a change.")
Sorry for the grammar nazi post!
I had to read this story's subject three times before I realized it did not say "Linux Turning Tricks."
My only gripe with LJ articles is that, even if you put them in print mode, they still run off the end of my paper when I print them.
The truth is, that even on "leading desktop OS" called with a name that reminds sheet of glass between frame, has not UDMA/66 and higher mode turned on by default.
Problem is, that it breaks compatibility with older hardware... eg. you will put an old harddisk on your comp. and it will "blow up" becouse your fancy OS will think it can take faster transfer speeds... etc.
* Origin: XBase BBS (2:490/4100) Well the good old days may not return and rocks might melt and sea may burn.
Considered linking to that Penny Arcade strip of the User Friendly characters turning tricks but don't feel like investing the time to find it...
What I'm listening to now on Pandora...
And yes the title's deliberate. What isn't deliberate is me posting as me instead of anon coward. Damn. Something always goes wrong.
We recently built a machine around an Abit VP6 with 5 hard disks on it (three on the main IDE controller, 2 on the HighPoint 370 secondary controller). After a few days I noticed we were getting bad blocks on the drives on the HighPoint controller. Running badblocks on the disks gave random errors all over the place.
I then noticed that the Ethernet card was being given the same IRQ as the IDE controller and got suspicious. I swapped the ether card into different PCI slots until it got its own IRQ, then ran the badblocks check again. Everything ran clean.
It's also entertaining to use lmbench to test your hardware: it can plot pretty graphs showing how the IO speed changes across the disk surface so you can decide where to put your partitions, if that's important to you.
Main point though: if at all possible tune your hardware and then test using badblocks, lmbench and such before you put the machine into production (or when you've got a solid backup). As the article says, problems with your disk subsystem can loose lots of information quickly.
I was reading the comments here and when I got to the end I read the little cookie/quote which is always at the bottom of the page. This one said:
Dr. Livingston? Dr. Livingston I. Presume?
I had to read it several times before I realised that it was an italic "I." and not "/."
(I can't get the font to set properly in here, so it doesn't look as much like a slash now)
This way when I upgrade I don't end up with issues like this guy.
I guess I am supprised as I would have though that this would be something you'd see on Linux.com not slash.
It is a good idea to make sure that before you go mucking with hdparm that you do so knowing that if you make mistakes you can really screw up your harddrive.
Only 'flamers' flame!
If you are going to be playing with hdparm, take my advice and make a backup first! Some interfaces aren't fully supported by the kernel yet, and trying to run drives off of them in certain modes could break in a bad way. In my experience, this then means massive filesystem corruption and a complete reinstall.
Of course I'm not saying *don't* play with hdparm; just be sensible and only try it on a system you have backed up and can afford to lose for a little while as you're rebuilding it.
It's only software!
This is a really cool article! Just wanted to say thanks for posting it.
Matt
Life is a journey. . . enjoy it!
Life is made more difficult because there is buggy and/or broken hardware out there. I don't blame Redhat for accomodating this hardware, but by doing so they are making their distribution more complicated and less useful for those "in the know".
Redhat also, of course, distributes the non-kernel binaries optimized for Intel 80386 CPU's when the vast vast majority of installs are going on Pentium-class or better machines. And it doesn't help any that Redhat is using and distributing a very nonstandard version of GCC; see what the GCC developers say about such branches and what application developers say about this branch.
To actually learn a lot about Linux and all the associated tools that make it work, I highly recommend the Linux From Scratch method: build everything from source! You can optimize the build to your machine and end up with not only better performance, but a vastly superior knowledge of everything that used to be "under the hood".
The same exact thing happens on Windows boxes, but we're not supposed to feel sorry for them, right?
Errrrrm,
Correcting someones spelling/grammer is a bit like shouting 'Hitler' in an argument.
You have just automaticaly lost. :-)
Anyone quoted by a reporter knows how little they understand
Don't believe what you read is the truth.
Spelling grammar correctly would help your case. :)
The Red Hat / gcc thing is old news. Just look at the date of that article on gnu.org.
And the men who hold high places must be the ones who start
To mold a new reality... closer to the heart
Another thing I recently noticed which jumped out at me from my kernel messages during boot: the kernel was assuming a 33Mhz system bus speed for PIO. This was fixed by passing "idebus=66" as a kernel boot parameter. See ide.txt in the kernel documentation sources for more info.
GCC 2.96-RH fails with C code in one and only one condition: when it's not ANSI-conformant C. GCC 2.96-RH is much more restrictive than GCC 2.95.
GCC 2.96-RH is worlds better than 2.95 when it comes to generating C++ code. With GCC 2.96-RH and STLport-4.5.3, I was happy as a clam. GCC 2.95's C++ support was anemic, nonstandards-compliant, and just generally sucked for any sort of very serious usage.
When I was recompiling tons of applications to work with GCC 2.96-RH, every "compiler error" that I found-- every single one --was the result of a programmer doing something that wasn't ANSI/ISO and made an assumption that "well, since GCC 2.95 didn't complain about this, it's okay." I don't blame GCC 2.96-RH for being more standards-conformant; I blame developers for playing fast and loose with the language spec.
Oh to have mod points.
You would expect the hit rate to be at least 50%, but it seems like people almost always use the wrong one.
Why is Grand Theft Auto a much more serious crime than Reckless Driving?
<rolling dice>
I had an argument...with the person here at the university that teaches OS design. I wonder when I'll learn --Linus
You may try to use Powertweak to alter settings to improve performance.
Then there is tweaking settings via /proc. I used to have a link to some excellent documentation on it but, alas, I can't seem to find it. You could try reading the various bits of info in the Documentation tree of the Linux source but it is pretty spartan.
I agree that wide tables are annoying, but HTML viewers (and printers) nicely re-wrap plain text to fit.
Sooooo much easier than tables is just to use preformatted text.
Just a side comment from someone who has always written his web page in vi.
Bob-
The Ludwig von Mises Institute. The reasoning individuals economics
Really, who cares?, you knew what the poster meant, he knew, almost everyone knew what he meant. Why don't you try and answer the question rather than wasting time trying to make your self look "big" because you can pick people up on their spelling! Do something worthwhile... like someone sensible said: "if you can't say something nice, don't say anything" And yes I appreciate the irony telling you to only say nice things while at the same time flaming you so.... As for hdparm, redhat linux 7.2+ does quite a good job of automatically detecting the need to dma or not so long as you are using 2.4 kernel and modern hardware.. while hdparm is useful it is redundant for new kernels / hardware. You do however have to have the right ide drivers in the kernel.
IIRC hdparm is usually not needed for 2.4 serial kernels as dma detection etc. is built into the ide drivers.
I know that the last view redhat 7.2 installs I have done on relatively modern hardware, and an old PII as well, have picked up the correct dma and 32bit IO modes automagically
If you ever drop your keys into a river of molten lava, let'em go, because, man, they're gone.
Funny, the Ultra/100 drive in my Redhat 7.2 box is using DMA by default:
/sbin/hdparm -tT /dev/hde
/dev/hde:
/sbin/hdparm -d /dev/hde
/dev/hde:
#
Timing buffer-cache reads: 128 MB in 0.72 seconds =177.78 MB/sec
Timing buffered disk reads: 64 MB in 1.82 seconds = 35.16 MB/sec
#
using_dma = 1 (on)
I know that I didn't have to do anything special to get it working - I just did a regular install and let it go.
Of course there are hundreds, possibly thousands, of little tuning tweaks to make Linux perform better. But practically speaking, this is the main one. The other is shutting down services you don't need.
In an effort to get a working system on every possible computer, Redhat defaults to no hard drive DMA and everything but the kitchen sink running in the background. Fix these two little things, and you're 99% there.
Lots of nice little Linux tidbits can be found on The Linux Pimp. Can't think of a site more ontopic for this post. The intro is pretty funny too.
At the risk of getting flamed by KDE enthusiasts here, if you are using X windows, I would have to say that you should look into using window managers other than KDE (or even Gnome for that matter). Although KDE and Gnome very pretty, I still prefer to use just plain Enlightenment. If you want to run KDE or Gnome apps (which I still can and do), just install the libraries. I've removed all my window managers from my install and am just running a clean E desktop. My screen is not cluttered with window bars and icons; my apps are accessible through a pop-up menu with a click of the mouse; and best of all, it's still very fast to login to my account/desktop (faster than windows 95)--and this is all on a dinky Cyrix II 333MHz system that has uptimes on the average of 30-40 days before I reboot for a kernel upgrade or some other system setting change.
Linux at home
The same mode change fixes "jerky" movement when playing DVDs (for obvious reason). Observed on ogle and BDV-212B, (non-region-locked, firmware) drive.
Contrary to the popular belief, there indeed is no God.
hasn't someone written a book on performance tuning linux? just a suggestion for those of you who might be interested in such a thing...
Large print giveth, and the small print taketh away