|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Operating Systems > Linux, Unix | |
Linux Performance Tuning
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
4.0ghz
![]() |
You're running Linux, now it's time to make it run faster! I've been using Linux since 1993 (
) and I learned a few things along the way.Most of these changes will improve your performance, a few I threw in because they'll make your system more stable. Enjoy! Sysctl The system control facility lets you tune dozens of little bits of the Linux kernel. For performance gains only a few of them are really relevant. You change these by editing the /etc/sysctl.conf file and then running sysctl -p (or rebooting). vm.oom_kill_allocating_task = 1 By default when Linux runs out of memory it goes through the process list and starts killing off processes that it thinks are using too much memory. This sysctl makes Linux kill the runaway process that made the system run out of memory instead, which is usually what you want. vm.page-cluster = 5 When Linux reads from the swap file it reads 2^page-cluster pages at once. It won't help to raise it past 5 because the swap is laid out in 32-page clusters. Disk I/O relatime This option is a more intelligent way of tracking disk accesses that dramatically reduces disk writes and increases disk performance. Check your /etc/fstab file and for your filesystems that are listed as ext2/ext3 in the third column, in the fourth column take out "defaults" or "noatime" if they're present and replace them with "relatime". If neither of those two are present in the fourth column, then add ",noatime" to whatever is there. You need to reboot for this to take effect. Defragmentation This comes up often enough I may as well say a word. You don't have to. Seriously, you don't have to. The Linux ext2/ext3 filesystem is much more efficient and requires no defragmentation. Its performance does start degrading once it's around 95% full, though, so if you're at that point, go delete some ISO images or buy a new hard drive. Use the df -h command to check your filesystem capacity. Memory Your hard drive might have a 16MB or 32MB onboard cache and be linked to your CPU via a 100MHz PCI Express bus. Wouldn't it be nicer if you had, say, 2GB of disk cache linked 1:1 with your FSB? Well, with Linux, you do! Linux uses any free memory as a dynamically expanding and shrinking disk cache, and several of the tips below take advantage of this. To be fair, Windows does this too, just not as well, as anyone who's played with Vista's SuperFetch knows. So the performance tip here is: Buy more RAM. Applications preload This package does for Linux what SuperFetch does for Windows Vista: it monitors your application usage and then whenever you boot up your system it will load your most frequently used applications into RAM while you're staring at the login prompt. The Linux version is different, though: It actually works. And Linux had it first. Preload isn't installed by default so you'll have to install it from your package manager. (It's a boot service; be sure to enable it.) readahead This package is related to preload but it's tuned specifically for the boot process. It starts early in the boot process and starts preloading a list of files into memory which will be used in the startup scripts that run later. This will help shave a few seconds off the boot process because these files can load while the system is busy doing other things like getting a network address. Readahead is installed by default on some distributions but not others, so you'll want to check and see if you have it, and if not, install it from your package manager and enable its boot services. (On Fedora the services are readahead_early and readahead_later; on Ubuntu it's just readahead.) I had better mention how to enable boot services: On Fedora you run su -c /sbin/chkconfig <servicename> on On Ubuntu you run sudo update-rc.d <servicename> defaults That's all for now! I might think of a few things later; if I do, I'll update this post and bump it. Enjoy your performance tuned Linux box!
__________________
The Ice Stone has melted! I did error10's Windows Challenge and I now am an MCSE: Minesweeper Consultant and Solitaire Expert! ![]()
Last edited by error10 : 09-21-08 at 08:11 PM |
|||||||||||||
|
|
|
|
#2 (permalink) | |||||||||||
|
Linux Lobbyist
![]() |
I have a few more:
Mount ext2/3 partitions with writeback It generally speeds up the system, but not a whole lot. You need to add data=writeback to /etc/fstab to the parameters column and add rootflags=data=writeback to your /boot/grub/menu.lst Low swap priority Just google vm.swappiness. Disable unneeded daemons It really does speed your boot up. I usually disable things like anacron, system log and virtualbox daemons. Helps quite a bit. Use both cores on boot By default, your system probably only uses 1 core, having more will help, but usually I'm bottlenecked by slow disk reading speeds. If you use a debian based distro, in the file /etc/ini.d/rc change concurrency=none to concurrency=shell. Compile a custom kernel Take out those unused modules and components. Most distros come with a generic kernel that supports a multitude of hardware. But since you probably don't have all of it, it makes sense to remove unused components. You can google for a guide for compiling for your distro. Thats all from the top of my head.
|
|||||||||||
|
|
|
|
|
#3 (permalink) | |||||||||||||
|
4.0ghz
![]() |
Hm, some of these options I like, some I don't.
data=writeback will definitely improve your performance a bit, but it runs the risk of data corruption in the event your system suddenly goes south (e.g. because you overclocked too far). vm.swappiness I considered adding in, but it's a tricky parameter and there is no one good setting for it. It's something you have to play with. And if you've got 4GB or more of RAM you aren't likely to run into many situations where changing it will help you. Disabling unnecessary services is a good one. Though what one person considers unnecessary another considers vital. I'd never disable the system log or the VirtualBox service; I use both of those! concurrency=shell is something specific to Ubuntu (or maybe all Debian based systems) though most distributions have some means of parallel startup. And I wasn't even about to attempt to explain how to build a custom kernel. Though it's true you'll save some hard drive space, the performance benefits are negligible. And what happens when you upgrade? All those modules mean you can plug almost anything into your box and the system will bring it up without even bothering you about it. So those are all good ideas but they have their downsides which people should be aware of before they go and do them.
__________________
The Ice Stone has melted! I did error10's Windows Challenge and I now am an MCSE: Minesweeper Consultant and Solitaire Expert! ![]()
|
|||||||||||||
|
|
|
|
#4 (permalink) | ||||||||||||
|
Linux Lobbyist
![]() |
I can see disabling anacron if you never use it, but I think disabling the system logger is a big mistake.
__________________
|
||||||||||||
|
|
|
|
|
#5 (permalink) | |||||||||||||
|
Linux Lobbyist
![]() |
Quote:
While taking out unused modules may not really impact anything other than a couple of megs of HD space, there are several other performance advantages you can gain by customizing (like setting your processor architecture). When I use binary distros, I don't usually fool with the kernel because none of the non-kernel apps are compiled locally anyway. With Gentoo I compile everything on my system myself (except for the stage3 tarball libs).
|
|||||||||||||
|
|
|
|
|
#6 (permalink) | ||||||||||||||
|
4.0ghz
![]() |
Quote:
__________________
The Ice Stone has melted! I did error10's Windows Challenge and I now am an MCSE: Minesweeper Consultant and Solitaire Expert! ![]()
Last edited by error10 : 09-22-08 at 07:15 AM |
||||||||||||||
|
|
|
|
#7 (permalink) | |||||||||||||
|
PC Gamer
![]() |
Interesting...
Repped.
__________________
¿uʍop ǝpısdn ʇı pɐǝɹ noʎ uɐɔ September 1, 2009 - Never forget.
|
|||||||||||||
|
|
|
|
|
#8 (permalink) | |||||||||||||||
|
om nom nom
![]()
Join Date: Apr 2008
Location: On earth, thankfully.
Posts: 7,354
Rep: 533
![]() ![]() ![]() ![]() ![]() ![]() Unique Rep: 397
Trader Rating: 3
|
i agree this IS interesting...
compiling your own distro? not something i would dare do, being still very young at all this
__________________
![]() must... help... moar...![]() ![]() Quote:
Quote:
|
|||||||||||||||
|
|
|
|
#9 (permalink) | |||||||||||
|
Linux Lobbyist
![]() |
I'd be interested to learn about that also, but just barely getting into Linux.
__________________The one thing i have going for me is that regarding computers and systems, i learn fast and am not affraid of breaking things that are fixable. (thanks to my dad letting me rip the guts outta the family pc when i was 9. or wait, maybe he didn't let me....)
|
|||||||||||
|
|
|
|
|
#10 (permalink) | ||||||||||||||
|
4.0ghz
![]() |
Quote:
![]() I recommend doing it in a virtual machine.
__________________
The Ice Stone has melted! I did error10's Windows Challenge and I now am an MCSE: Minesweeper Consultant and Solitaire Expert! ![]()
|
||||||||||||||
|
|
![]() |
| Tags |
| hard drive, linux, memory, performance |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|