Jump to content

Listen to Pattaya FM105

View New Content  

Speeding Up Linux / Ubuntu


  • Please log in to reply
7 replies to this topic

#1 oilinki

oilinki

    Senior Member

  • Advanced Members
  • PipPipPipPip
  • 662 posts

Posted 2011-09-25 10:45:05

I just bought some more memory for my Lenovo X61s running kubuntu. Memory is dirt cheap nowdays! :)
As the default kernel (32bit) does not support more than 3GB of memory, I installed PAE kernel and now the whole 4GB of memory is available.

I also moved /tmp to memory as accessing it is way faster than hard drive.
/etc/fstab:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0


root@moon:/var/tmp# df -h /var/tmp
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 2.0G  129M  1.9G   7% /tmp

Next step was to change Chromium browser's cache to the tmpfs. Done simply by removing the cache and making an symbolic link
from ~/.cache/chromium to /tmp
rm ~/.cache/chromium  ; ln -s /tmp/  ~/.cache/chromium

I also decided to move /var/tmp to tmpfs. Not really sure if this is smart thing to do, but at least after couple of days of working with the computer, I have not yet noticed anything broken because of moving /var/tmp to the memory. Opinions, good or bad?

What other things would be good to change in order to use speed up the computer?

#2 urandom

urandom

    Senior Member

  • Members
  • PipPipPipPip
  • 225 posts

Posted 2011-09-26 00:05:53

which filesystem(s) are you using and what are their mount flags? which daemons are running? also, torvalds on PAE: http://www.realworld...=78766&roomid=2

#3 oilinki

oilinki

    Senior Member

  • Advanced Members
  • PipPipPipPip
  • 662 posts

Posted 2011-09-26 11:14:58

I'm using ext3 on my root.
/dev/sda1 on / type ext3 (rw,errors=remount-ro,user_xattr,commit=600)

And have one nfs mount   /data type nfs (rw,soft,rsize=8192,wsize=8192,intr,addr=10.1.1.200)

Torvalds polite as usual :)

At least Fedora have made PAE default option. http://docs.fedorapr...fics_for_Fedora


3.1. x86 Specifics for Fedora
By default, the PAE kernel is used on 32-bit hardware, where supported by the hardware.

#4 justsumhelp

justsumhelp

    Senior Member

  • Members
  • PipPipPipPip
  • 389 posts

Posted 2011-09-26 19:02:33

You could look into building the Zen kernel, and tweaking as necessary, their website is down and so is the git so it might be hard to do. I have used Crunchbang which gives you the option to use the zen kernel while installing. It ran great on an old msi wind.

#5 urandom

urandom

    Senior Member

  • Members
  • PipPipPipPip
  • 225 posts

Posted 2011-09-26 22:47:30

speed will come at the cost of security but you can use some of these options. the machine being a laptop, it reduces the risk of power shutdown.

from Documentation/filesystems/ext3.txt

* writeback mode
In data=writeback mode, ext3 does not journal data at all.  This mode provides
a similar level of journaling as that of XFS, JFS, and ReiserFS in its default
mode - metadata journaling.  A crash+recovery can cause incorrect data to
appear in files which were written shortly before the crash.  This mode will
typically provide the best ext3 performance.


using this since ages on many machines without any issue at all (even after crashes).

on the root partition you may not be able to pass the flag in fstab, you'll need to modify your kernel command line in your boot loader to be something like:

     APPEND root=/dev/sda4 rootfstype=ext4 ro rootflags=data=writeback,barrier=0 i915.i915_enable_fbc=0

this should help too:

barrier=<0(*)|1>     This enables/disables the use of write barriers in
barrier             the jbd code.  barrier=0 disables, barrier=1 enables.
nobarrier   (*) This also requires an IO stack which can support
                     barriers, and if jbd gets an error on a barrier
                     write, it will disable again with a warning.
                     Write barriers enforce proper on-disk ordering
                     of journal commits, making volatile disk write caches
                     safe to use, at some performance penalty.  If
                     your disks are battery-backed in one way or another,
                     disabling barriers may safely improve performance.

                     The mount options "barrier" and "nobarrier" can
                     also be used to enable or disable barriers, for
                     consistency with other ext3 mount options.

never tried this one but maybe worth a try:

commit=nrsec (*) Ext3 can be told to sync all its data and metadata
                     every 'nrsec' seconds. The default value is 5 seconds.
                     This means that if you lose your power, you will lose
                     as much as the latest 5 seconds of work (your
                     filesystem will not be damaged though, thanks to the
                     journaling).  This default value (or any low value)
                     will hurt performance, but it's good for data-safety.
                     Setting it to 0 will have the same effect as leaving
                     it at the default (5 seconds).
                     Setting it to very large values will improve
                     performance.


also, the classics: noatime,nodiratime should help...

be careful, depending on the way it has been formatted, a root partition may not like those two options, keep a liveCD around just in case you'd need to revert them.

have a look on your running daemons, you may have a lot of crap running on some distros, disabling them will not hurt.

for specific usage, building some software from source may help, if there's anything you're using a lot that is CPU expensive, that may be interesting. you may get some additional speed by:

  * choosing the right CFLAGS/CXXFLAGS/LDFLAGS, stripping debug symbols
  * patching the source (e.g. the zen kernel mentioned by justsumhelp)
  * using alternate compilers (intel, ekopath, clang, etc...)

#6 oilinki

oilinki

    Senior Member

  • Advanced Members
  • PipPipPipPip
  • 662 posts

Posted 2011-09-27 19:35:08

Thanks for the pointer of zen kernel and ext3 tuning. I will look in to those. I might not start to optimize the kernel with zen as I wish to keep things simple and as default as possible. I was mostly looking for some simple steps to improve the performance and battery life. I'll look more in to the ext3 tuning.

At some point I was thinking to put root partition to PCMCIA CF card to let the normal hard drive to spin off, when it's not in use. It would effect the performance, but would it increase battery life?  Stupid idea or something to test further? :)






#7 urandom

urandom

    Senior Member

  • Members
  • PipPipPipPip
  • 225 posts

Posted 2011-09-27 20:23:08

View Postoilinki, on 2011-09-27 19:35:08, said:

I wish to keep things simple and as default as possible [...] At some point I was thinking to put root partition to PCMCIA CF card.

my brain exploded :P

hdparm can help you to manage your hd behavior, from its manpage:
-B Set Advanced Power Management feature, if the drive supports  it. A low value means aggressive power management and a high value means  better performance. A value of 255 will disable apm on the drive.
laptop-mode-tools has many drives options too, see this: http://linux.die.net...aptop-mode.conf

#8 urandom

urandom

    Senior Member

  • Members
  • PipPipPipPip
  • 225 posts

Posted 2011-09-29 13:34:33

one more thing you could do to get rid of that PAE kernel (which is known to be slower) and use memory in a "torvalds compliant" way: keep your 32bit install and just install a 64bit kernel on the top of it, I'm doing this for years and it works great. more a PITA with out-of-tree modules but given your machine's specs, I guess you don't use any (not sure about your wireless chipset, some thinkpads have a realtek crapset)



 


Sponsored by:
Quick Navigation   View New Content Site search: