sidux.com
Menu

News

Give back
Last 3 Contributions
30-06-2009 50.00
20-06-2009 30.00
16-06-2009 100.00

Donate


Sponsor
hetzner.de

Languages
Preferred language:



Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
knithx
26 Post subject: HOW-TO: Tweaking sidux  PostPosted: May 09, 2007 - 08:30 PM



Joined: Dec 08, 2006
Posts: 170

Status: Offline
HOW-TO: sidux, THE PERFECT DESKTOP

sidux has a perfectly stable configuration out-of-the-box, but it is always possible to tweak things to speed up the performance in our system. I've been working on this guide for quite a long time, and I decided to post it although is not complete yet. Why should I do that? Because it'll never be complete: Everyone can put his 2 cents and contribute with this guide adding their own tips, tricks and tweaks for everything, no matter what it is if it helps to boost things up to hell. Let's get the most of our distribution, people.

This guide will head you to different tweaks that will increase the performance of your system, BUT:

Be aware that all modifications are made as root user, so you may need to omit some steps if you don't know what exactly are you doing.

System tweaking

Swappiness

Swappiness is the ammount of virtual memory (swap partition) your computer is ordered to use. It is set to 60% in newer kernels, but computers with a high ammount of RAM can run faster if less memory is swapped and more is directly used. For computers with 1GB RAM or more, a value between 0 and 5 works well. You can check the performance you get modifying the swappiness with the command:

      Code:

sysctl -w vm.swappiness=[value]


Where value is the ammount of memory that will be swapped. When you find a value which fits you (I use 0 or 5), you can make the changes permanent editing the file /etc/sysctl.conf by adding this line at the end:

      Code:

vm.swappiness=5


DMA

Direct memory access (DMA) is a feature of modern computers, that allows certain hardware subsystems within the computer to access system memory for reading and/or writing independently of the central processing unit. Enabling DMA may improve performance in your disk drives.

Let's imagine the unit where DMA wants to be enabled is /dev/hdb. You can check whether you have DMA enabled or not with the command:

      Code:

hdparm /dev/hdb


If you get the output:

      Code:

using_dma    =  1 (on)


DMA is already enabled. If not, you can enable it by typing:

      Code:

hdparm -d1 /dev/hdb


However, in order for the settings to be automatically applied at boot there you need to edit the /etc/hdparm.conf script, adding the following to the end of it:

      Code:

/dev/hdb {
dma = on
}


Removing unused tty's

By default, sidux and many other Linux distributions have six tty's (command prompts) which are accesible through the key bindings CTRL+ALT+F1 to CTRL+ALT+F6. They are a handy option in case X server crashes or you have any other problems with tty7 (the visual enviroment), but you may not need the six of them, and deactivating some of them will speed up your system. For doing that, edit the file /etc/inittab and comment the lines:

      Code:

2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6


if you want to deactivate tty2, 3, 4, 5 and 6.

Prelinking

Prelink is intended to speed up a system by reducing the time a program needs to begin. Actual results have been mixed, but it seems to aid systems with a large number of libraries by sharing them between programs, such as KDE. To install Prelink just type:

      Code:

apt-get install prelink


And configure it editing the file /etc/default/prelink by modifying the line:

      Code:

PRELINKING=unknown


to:

      Code:

PRELINKING=yes


You should execute prelink periodically in order to refresh its library database. It takes a while the first time, and it should be called with:

      Code:

/etc/cron.daily/prelink


Removing junk files

Several commands are using for cleaning up rubbish in your system (in case you don't have them, you can install them with apt-get install [commandname], like:

      Code:

apt-get clean


      Code:

apt-get autoclean


      Code:

deborphan


or

      Code:

debfoster


      Code:

localepurge


An automated way for cleaning up is:

      Code:

sudo apt-get update; apt-get dist-upgrade; apt-get remove; apt-get autoremove; apt-get clean; apt-get autoclean; rm -r /tmp/*


X.Org

You all know the excellent h2's script. In order to get 3D acceleration (and much more stuff) use it. Once you are done, we can tweak the file /etc/X11/xorg.conf when using OpenSource Drivers by modifying the Device section, as it shows below:

      Code:

Option "EnablePageFlip" # improves performance on 3d acceleration
Option "AGPMode"  "1/2/4/8" # agp speed (choose one)
Option "AGPSize"  "32/64/128" # manually set agp aperture, kinda like shared memory (choose one)
Option "AccelMethod"  "xaa"  # exa is still rigged, use xaa until they solve the 2d acceleration issues.
Option "XAANoOffscreenPixmaps" # generic optimization for 2d acceleration, disables XAA offscreen pixmaps which for some reason actually slow down 2d rendering
Option "DynamicClocks" "on"
Option "ColorTiling" "on"
Option "FBTexPercent" "95"


If you don't mind, you also can improve the general performance of the visual enviroment reducing DefaultDeph color from "24" to "16".

Turn off (mute) system beep

To permanently disable the PC speaker even after reboots, add this to /etc/rc.local before the last line (exit 0):

      Code:

modprobe -r pcspkr


Redistributing RAM usage

The following command will redistribute the way your RAM memory does output graphic information. This would considerably speed up the way buttons, scrollbars, and other items show up when a window is maximized or restored, for example.

      Code:

echo "base=0x98000000 size=0x8000000 type=write-combining" >| /proc/mtrr


Optimizing KDE

Executing kcontrol, we can modify a lot of parameter about the visual enviroment, and some of them can be set in order to improve performance. Those are:


Look & Feel - Style - Effects - Deactivate all effects.
Look & Feel - Background - No background (if you don't need it).
Look & Feel - Launch Notification - Busy passive cursor, set all values to 0 seconds.

Desktop - Window Behaviour - Animate minimizing and restoring - Deactivate it.
Desktop - Desktops - Set it to 1 (if you don't need more).

Sounds and Multimedia - Notifications - Deactivate all sounds.
Sounds and Multimedia - Sound system - Deactivate it (use ALSA instead).


I also recommend to install Dolphin instead Konqueror. It is much faster and lightweight.

Speeding up boot time

Removing unnecessary services

We can speed up our boot time by reducing the number of services started with the system. For doing that, we are going to use the tool sysv-rc-conf, which can let us manage easily the services we want to enable or not when sidux starts. We can install it through the official repositories:

      Code:
apt-get install sysv-rc-conf


When executed on a terminal, we will see the list of services we have activated and in which init mode they are. It is important to say that there are some services you shouldn't change in order to keep things functioning internally. Those are:

acpid, binfmt-support, bootlogd, dbus, klogd, halt, ifplugd, ifupdown, kdm, klogd, libdevmap, module-init-tools, networking, rc.local, reboot, sendsigs, single, stop-bootlogd, sysklogd, udev, udev-mtab, umontfs, umountroot, urandom, x11-common...

Plus any others you should need due to specific hardware, as alsa-utils, atievetsd, bluetooth, fuse...

More information is avaiable on here in case of doubt: Please make sure you know what you are doing; otherwise, you may harm your system.

Starting services in concurrency mode

Another way for improving our boot time is to make all services start paralelly. To do so, you only need to open the file:

      Code:
/etc/init.d/rc


and change:

      Code:
CONCURRENCY=none


to:

      Code:
CONCURRENCY=shell


Done. Now your boot time should be much quicker than before.

Internet Tweaking

IPV6

To deactivate IPV6, you need to edit the file:

      Code:

/etc/modprobe.d/aliases


by adding the lines:

      Code:

alias net-pf-10 ipv6 off
alias net-pf-10 off
alias ipv6 off


and commenting / removing the line:

      Code:

alias net-pf-10 ipv6


This will speed up noticeably Internet applications, including Firefox and Google Earth.

Firefox

You can access quite a lot of network parameters in Firefox by typing in the address bar about:config. Once there, the following variables may be modified / added:

      Code:

network.dns.disableIPv6 of the type boolean, set to true
nglayout.initialpaint.delay of the type integer, set it to 10
content.interrupt.parsing of the type boolean, set to true
content.max.tokenizing.time of the type integer, set it to 8
content.notify.backoffcount of the type integer, set it to -1
content.notify.interval of the type integer, set it to 2
content.notify.ontimer of the type boolean, set to true


For general tweaking in Firefox / IceWeasel / Swiftfox, get FasterFox, a very powerful extension that will greatly increase your browsing speed in these clients.

As for the system networking tweaking, this command will speed things up a bit:

      Code:

perl -pi -e s/ipv6/off/ /etc/modprobe.d/aliases && echo "net.ipv4.tcp_moderate_rcvbuf=0" >> /etc/sysctl.conf && echo "net.ipv4.tcp_default_win_scale=0" >> /etc/sysctl.conf


MTU

The term Maximum Transmission Unit (MTU) refers to the size (in bytes) of the largest packet that a given layer of a communications protocol can pass onwards. MTU parameters usually appear in association with a communications interface (NIC, serial port, etc.). Adjusting MTU can improve your network experience, and in some cases even speed it up. You can adjust the MTU with the following command:

      Code:
ifconfig [interface] mtu [value]


Where [interface] refers to your network interface (in my case, ath0) and [value] to the value you want to assign MTU. I've experienced that 1450 works fairly good in my sidux box, so I adjusted:

      Code:

ifconfig ra0 mtu 1450


Checking /etc/resolv.conf

Make sure that you /etc/resolv.conf file only has your DNS servers, in order to let the system access faster to them. In my case, I use OpenDNS, which I higly recommend, so my entire content of this file is:

      Code:

nameserver 208.67.222.222
nameserver 208.67.220.220


A corrupted /etc/resolv.conf file may cause several problems in DNS look up, so double-cheking this file is more important than it seems to be, as far as some distributions add rubbish lines to this file.

/etc/hosts

The file /etc/hosts may content by default:

      Code:

127.0.0.1 localhost
127.0.1.1 [youhostname]


Replacing the previously lines with:

      Code:

127.0.0.1 localhost [yourhostname]
127.0.1.1 [yourhostname]


is believed to speed up applications launch which use network functions.

Checking /etc/syctl.conf

This are some values to optimize broadband settings, although they are not tested

      Code:

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1


You have to reset your sysctl for these to take effect.

      Code:

sudo sysctl -p


Concluding...

You have just made a lot of changes to your system. Re profiling your boot will reorganize it and make it faster on boots afterwards. For doing so, Reboot your PC. When you come to your grub list, hit escape to see your grub menu and edit the topmost line and add the word below to the end of it:

      Code:

profile


One last reboot and you are done!

Personal recommendations

From here, everything said is my opinion about any other tweaks, you may like them or not, you choose!

Comming soon...

By knithx - www.knithx.net
 
 View user's profile Send private message  
Reply with quote Back to top
shame
Post subject:   PostPosted: May 09, 2007 - 09:41 PM



Joined: Dec 04, 2006
Posts: 1628
Location: England
Status: Offline
Nice one. Though I would like to hear more opinions on the swap/ram stuff which is way beyond me so I'm a little tentative to try them and also the networking speed boosts in /etc/sysctl.conf though, as in what they actually do.
Changing the mtu has improved things for me in the past but where do I change it permanently? I have done it in the past but I can't remember how, or will changing it in my router settings override it anyway?

I have used prelinking in the past, on ubuntu and kanotix and didn't notice any improvements at all but other people may have had different results.

Can I expect any problems starting services in concurrent mode? If it is indeed quicker, is there any reason why it isn't enabled by default?

_________________
sidux 32 & 64 | Parsix | Mandriva Cooker

repository of shame - compiz fusion repo for sidux/debian | 32-bit | 64-bit
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
knithx
Post subject:   PostPosted: May 09, 2007 - 10:00 PM



Joined: Dec 08, 2006
Posts: 170

Status: Offline
About the MTU question, I am sure it is configurable through sysctl, I'll look at it.

About the RAM, sysctl, Prelink, Concurrency, there's no risk about modifying them, you can always reverse your actions.
 
 View user's profile Send private message  
Reply with quote Back to top
DeepDayze
Post subject:   PostPosted: May 10, 2007 - 02:41 AM



Joined: Dec 02, 2006
Posts: 2294

Status: Offline
knithx,

Nice writeup have one question:

where do you put the "profile" keyword? after where it says root hd(0,0) lilke this:

root hd(0,0) profile

please post a sample how it is to look on the grub command list?
 
 View user's profile Send private message  
Reply with quote Back to top
damentz
Post subject:   PostPosted: May 10, 2007 - 02:50 AM



Joined: Dec 01, 2006
Posts: 898

Status: Offline
APPLAUSE!! Very nice!
Here's some of my tweaks though, it clashes w/ yours i suppose

hdparm.conf // dma/udma should already be set automatically to the highest
      Code:
command_line {
       hdparm -u1 -S60 -a1024 /dev/hda
}


I usually keep swappiness to 60, its important to let your system use the swap file when it needs to. If you have enough ram, it doesn't matter anyway, your system won't touch the swap file if your ram never fills.

I'll check out everything else then, the concurrency thing and prelinking along with that graphical thinger for lack of better terms looks really cool.


Last edited by damentz on May 10, 2007 - 11:14 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
DeepDayze
Post subject:   PostPosted: May 10, 2007 - 04:16 AM



Joined: Dec 02, 2006
Posts: 2294

Status: Offline
damentz, what is a good way to tune SATA drives? hdparm usually does not work well with these drives.
 
 View user's profile Send private message  
Reply with quote Back to top
UncleDeadley
Post subject:   PostPosted: May 10, 2007 - 04:26 AM



Joined: Dec 02, 2006
Posts: 324
Location: Muppet Theater
Status: Offline
Thanks for putting this together. Good information to have around!

I'll try the concurrency thing. My MTU defaults to 1500 and I'm not sure messing with swapiness matters from the base sidux default. I only have 512MB RAM on my home machine and I almost never go to swap, but then, I do all my REAL work on another machine.

_________________
Watch it!! I'm the beautiful assistant!
 
 View user's profile Send private message  
Reply with quote Back to top
damentz
Post subject:   PostPosted: May 10, 2007 - 05:02 AM



Joined: Dec 01, 2006
Posts: 898

Status: Offline
DeepDayze, i've never had a sata drive, so I really can't help. A new version of hdparm came into sid though, you could try that.

_________________
"Cool was never cool until the cool guys at Cool industries developed a cool new product: Cool."
 
 View user's profile Send private message  
Reply with quote Back to top
Ironwalker
Post subject:   PostPosted: May 10, 2007 - 05:27 AM



Joined: Dec 01, 2006
Posts: 481
Location: NYC/NJ Shore area
Status: Offline
rmem_default ...............Defines the default receive window size; for a large BDP, the size should be larger.

rmem_max .................Defines the maximum receive window size; for a large BDP, the size should be larger.
wmem_default ...............Defines the default send window size; for a large BDP, the size should be larger.

wmem_max .................Defines the maximum send window size; for a large BDP, the size should be larger.

tcp_window_scaling .............Enables window scaling as defined by RFC 1323; must be enabled to support windows larger than 64KB.

tcp_sack .............. Enables selective acknowledgment, which improves performance by selectively acknowledging packets received out of order (causing the sender to retransmit only the missing segments); should be enabled (for wide area network communication), but it can increase CPU utilization.

tcp_fack ...........Enables Forward Acknowledgment, which operates with Selective Acknowledgment (SACK) to reduce congestion; should be enabled.

tcp_timestamps ...........Enables calculation of RTT in a more accurate way (see RFC 1323) than the retransmission timeout; should be enabled for performance.

tcp_mem ............... Determines how the TCP stack should behave for memory usage; each count is in memory pages (typically 4KB). The first value is the low threshold for memory usage. The second value is the threshold for a memory pressure mode to begin to apply pressure to buffer usage. The third value is the maximum threshold. At this level, packets can be dropped to reduce memory usage. Increase the count for large BDP (but remember, it's memory pages, not bytes).

tcp_wmem .................Defines per-socket memory usage for auto-tuning. The first value is the minimum number of bytes allocated for the socket's send buffer. The second value is the default (overridden by wmem_default) to which the buffer can grow under non-heavy system loads. The third value is the maximum send buffer space (overridden by wmem_max).

tcp_rmem .............Same as tcp_wmem except that it refers to receive buffers for auto-tuning.

tcp_low_latency .............. Allows the TCP/IP stack to give deference to low latency over higher throughput; should be disabled.

tcp_westwood ...............Enables a sender-side congestion control algorithm that maintains estimates of throughput and tries to optimize the overall utilization of bandwidth; should be enabled for WAN communication. This option is also useful for wireless interfaces, as packet loss may not be caused by congestion.

tcp_bic ............ Enables Binary Increase Congestion for fast long-distance networks; permits better utilization of links operating at gigabit speeds; should be enabled for WAN communication.



I got these definitions from;
http://www-128.ibm.com/developerworks/l ... isock.html
The tweaks the op mentioned above for networking is a roundabout area for Broadband users(cable modems and similar),trying those with dial up is asking for trouble.
A good site to see if you need tweaking is here;
http://www.dslreports.com/tweaks
Good readme's too,lil' on linux systems as well.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Roughnecks
Post subject:   PostPosted: May 10, 2007 - 12:50 PM



Joined: Dec 03, 2006
Posts: 258

Status: Offline
thanks very much!
disabling ipv6 totally speeded up my web surfing to lightspeed
and prelinking i think is a wonderful idea. i didn't measure, but i really have the feeling apps are starting much faster now.

thanks again! great post!
 
 View user's profile Send private message  
Reply with quote Back to top
knithx
Post subject:   PostPosted: May 10, 2007 - 04:24 PM



Joined: Dec 08, 2006
Posts: 170

Status: Offline
Ironwalker: How do you apply that?

DeepDayze: Do not edit /etc/boot/grub/menu.lst, you have to edit the line which appears when you switch on you computer, add the word at the end by pressing "e" in the boot screen before getting into the system.

Damentz: I'll check that out.
 
 View user's profile Send private message  
Reply with quote Back to top
Ironwalker
Post subject:   PostPosted: May 10, 2007 - 04:40 PM



Joined: Dec 01, 2006
Posts: 481
Location: NYC/NJ Shore area
Status: Offline
knithx,
I have the code...similar to yours above in your how to;

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1


in my sysctl.conf file.

I have some file system tweak in there for reiserfs,there are a ton more for ext3.I have to look them up in my bookmarks.

The TTY tweaks,imo,is for an ol p2 or less with 128mb ram or less.A TTY takes what............300-400k in memory,I think I can spare 8 of them if needed. Wink
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
knithx
Post subject:   PostPosted: May 10, 2007 - 06:47 PM



Joined: Dec 08, 2006
Posts: 170

Status: Offline
      Ironwalker wrote:
knithx,
I have the code...similar to yours above in your how to;

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1


in my sysctl.conf file.

I have some file system tweak in there for reiserfs,there are a ton more for ext3.I have to look them up in my bookmarks.

The TTY tweaks,imo,is for an ol p2 or less with 128mb ram or less.A TTY takes what............300-400k in memory,I think I can spare 8 of them if needed. Wink


The values are the same, and yes, I know there is a lot of tweaking about ext3, but it is a bit risky, not like everything I wrote, that is absolutely harmfulness. We can contrast the tweaks for ext3 and add them to the guide.

Thanks everybody for the comments!!! Very Happy
 
 View user's profile Send private message  
Reply with quote Back to top
DeepDayze
Post subject:   PostPosted: May 10, 2007 - 09:01 PM



Joined: Dec 02, 2006
Posts: 2294

Status: Offline
To tweak ext3...best to have backups Wink
 
 View user's profile Send private message  
Reply with quote Back to top
Lanzi
Post subject:   PostPosted: May 10, 2007 - 09:53 PM



Joined: Dec 02, 2006
Posts: 487

Status: Offline
thanks, dude
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
 
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2006-2009 by sidux e.V., 10407 Berlin, Kniprodestr. 104. sidux e.V. is a Berlin, Germany based non-profit foundation. Consult Impressum and Legal Terms for details. sidux™ is Free Software released under the GNU/GPL license and other compatible licenses.
powered by Zikula & Zafenio