Linux speedup hacks

Linux speedup hacks for improving old system performance:

1) “Renicing” stuff that runs in background:

You can gain some speed by “renicing” certain daemons that run in the background by editing the startup scripts in /etc/init.d and changing
the “–exec $DAEMON” phraise(s) in the “start)” sections to:

–exec /usr/bin/nice -n 15 $DAEMON

Here’s a “top” list of ones I changed (top, O, i):



PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
9138 user 34 19 3596 1676 1488 R 0.0 0.3 0:00.41 wmMoonClock
9114 user 30 15 7592 2744 2228 S 0.0 0.5 0:55.51 xplanet
9144 user 30 15 11600 9196 3096 S 0.0 1.8 0:01.01 tkweather.pl
9146 user 30 15 2888 1256 1000 S 0.0 0.2 0:00.04 wmitime
9150 user 30 15 2732 848 700 S 0.0 0.2 0:00.23 asmem
9151 root 30 15 2856 1328 1048 S 0.0 0.3 0:35.68 wmpower
2836 syslog 26 10 1768 672 552 S 0.0 0.1 0:00.39 syslogd
2858 root 25 10 1672 452 372 S 0.0 0.1 0:00.25 dd
2860 klog 25 10 1568 292 220 S 0.0 0.1 0:00.09 klogd
3051 lp 26 10 4320 1844 1324 S 0.0 0.4 0:00.32 cupsd
3320 root 26 10 2120 860 712 S 0.0 0.2 0:00.00 cron
5893 root 26 10 8704 2400 1720 S 0.0 0.5 0:00.12 smbd
5895 root 26 10 8704 928 300 S 0.0 0.2 0:00.00 smbd
9142 root 25 10 6836 2824 2288 S 0.0 0.5 0:00.33 wmxmms
4041 user 21 5 5792 2808 1944 S 0.0 0.5 0:05.42 xscreensaver

2) I also modified my swiftfox (firefox) startup script to always “renice” my browser to give it higher priority & make browsing and scrolling faster/smoother by modifying my browse.pl script adding the following:


exit (exec($_)) unless (/swiftfox/o);
system ($_);
sleep 3;
my @l = `ps ax |grep "swiftfox-bin"`;

while (@l)
{
$_ = shift(@l);
if (m#^\s*(\d+).+\d \/usr\/lib\/swiftfox\/swiftfox-bin #o) {
my $pid = $1;
`sudo renice -2 $pid`;
} elsif (m#^\s*(\d+).+\d \/bin\/sh \/usr\/lib\/swiftfox\/run\-mozilla#o) {
my $pid = $1;
`kill -TERM $pid`;
}
}

exit (0);

3) I also modified wmxmms startup in Wharf to give it priority to avoid “skipping” when doing something else that loads the cpu (.afterstep/wharf:

*Wharf wmxmms – Swallow “wmxmms” sudo /usr/bin/nice -n 10 /usr/bin/wmxmms -n -t -c “/usr/bin/nice -n -13 /usr/bin/xmms” &

This sets the wmxmms daemon to lower priority while setting the actual xmms program to higher priority when it is actually launched.

Again from “top”:


PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9142 root 25 10 6836 2824 2288 S 0.0 0.5 0:00.35 wmxmms
10294 root 12 -3 38908 12m 5532 S 0.0 2.5 0:00.24 xmms

4) I also modified /etc/sysctl.conf as follows to improve overall system performance:

#IMPROVE NETWORKING EFFECIENCY (SEE http://www.zdnetindia.com/index.php?action=article&prodid=8288):
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_syncookies = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

#IMPROVE SWAPPING EFFECIENCY (SEE http://rudd-o.com/archives/2007/10/02/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that/ or News/DesktopOptimization1.url)
#DEFAULT WAS 60
vm.swappiness = 10
#DEFAULT WAS 100
vm.vfs_cache_pressure=50

Make backups of your original files and enjoy a snappier system! (ymmv)

JP

Advertisements

One Trackback

Feel Free to Comment (Name/Email/Website optional):

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: