More Latency Tweaks for Desktop Users
sudo apt-add-repository ppa:poelzi/ulatencyd-stable
sudo apt-get update
sudo apt-get install ulatencyd
It works immediately and in my experience so far: veeery nice.
Enjoy.
Saturating your Link with Lftp
Fun with Compcache/RamZSwap
1. Get and compile a current version of rzscontrol in the compcache package sub-projects folder.
2. sudo swapoff -a
3. sudo modprobe ramzswap
4. sudo rzscontrol /dev/ramzswap0 --verbose --init
5. sudo swapon /dev/ramzswap0
Enjoy! Check out lwn's tech info about it.
Update: Actually it does work for me in 2.6.33, but in 2.6.35 it does not work at all and the --backing_swap /dev/your-current-swap-partition support was removed.
Update2: You can make it work with a bit of source code modification. The author writes, though, that he will soon release a new version of both his kernel module and command line tool that can be installed and run in 2.6.35.
How to set up X and VAAPI Accelerated HD Video on the MSI Wind U110 (GMA500 - Poulsbo) and Ubuntu Karmic 9.10
I've finally managed to get it running. Here is what I did. First you need to get Ubuntu 9.10 running with poulsbo. The first steps 1.-4. describe how to set up the driver for X. The second part (5.-10.) describes how to set up VAAPI and mplayer to get video acceleration. (There is already an early stage GMA500 driver for Ubuntu 10.04.)
The image shows the phoronix test suite benchmarking when I play Grey.ts in a loop (-loop 0) with mplayer and vaapi but without sound (-nosound) on my netbook. During the entire time, the CPU frequency is also downscaled to 800 Mhz. Compare to phoronix vdpau benchmark on a core 2 duo system (which obviously shows even less cpu usage, because the CPU is much more powerful) or the Atom and Nvidia ION benchmark on Phoronix.
sudo add-apt-repository ppa:gma500/ppa && sudo apt-get update
2.a. Check if you can load the psb module: sudo modprobe psb. If you see this in dmesg instead of a switch to the correct resolution,
"kernel BUG: unable to handle kernel NULL pointer dereference at (null)" (2.6.31)
Section "Device"Identifier "GMA500"Option "AccelMethod" "EXA"# someone suggested UXA? but that's for the i965 driversOption "DRI" "on"Option "MigrationHeuristic" "greedy"Option "IgnoreACPI" "yes"Driver "psb"EndSection
Section "DRI"Mode 0666EndSection
If the system goes to DPMS standby and from there switches to other modes (DPMS suspend, etc.), then my screen actually turns on again (showing all black with backlight active). So make sure you chose only one setting for DPMS. A constantly running screen is not good at all.
VAAPI Video Acceleration setup
wget http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva1_0.31.0-1+sds8_i386.deb
http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb&& sudo dpkg -i libva1_0.31.0*i386.deb
sudo ln -s /usr/X11R6/lib/modules/dri/psb_drv_video.so /usr/lib/va/drivers/
sudo apt-get install mplayer libmad0
ln -s libx264.so.67 libx264.so.65
sudo apt-get build-dep mplayersudo apt-get install libdrm-devwget http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb && sudo dpkg -i libva-dev_0.31.0-1+sds8_i386.debmaybe: sudo apt-get -f install
mplayer -fs -vo vaapi -va vaapi ~/HDtest.avi
sudo make install.
Update: It turns out deinterlacing not working is not due to VAAPI, but a limit in the psb driver. It works with the current iegd driver and other drivers from AMD and NVIDIA (press the D putton in mplayer I think). If I could just get one of those iegd drivers... Thanks Gwenole from splitted-desktop.com for answering my email and of course for writing the mplayer-vaapi patches in the first place! He seems to be the absolute VAAPI expert.
Also some experiments show that I can attach an external screen and watch videos with VAAPI on it. That means I should be able to actually use the netbook for decoding HD video and displaying it on an external screen. (But it does not work for me with except in mirror or single display mode.) Only thing missing now is a digital display port to connect a FullHD display... ;)
You might also be interested in Surround Sound and Battery Life
And I did get a USB surround sound card working wonderfully now. Also here's some advice I wrote on decreasing your power consumption.
Adjust Linux Network Receive Window for Fast Networks
sudo sysctl -w \
net.core.wmem_max=1075200 \
net.core.rmem_max=1075200 \
net.ipv4.tcp_rmem="4096 87380 8388608" \
net.ipv4.tcp_wmem="4096 87380 8388608" \
net.core.rmem_default=1075200 \
net.core.wmem_default=1075200
Linux Kernels 2.6.24 - 2.6.29 Benchmarked (Phoronix)
Okay, so besides some normal fluctuations there is a significant speed gain for OpenSSL (+99%) and the OpenCL-backed Graphicsmagick (up to +73% and +80%) and a regression in 7-zip compression (-27%).
Wow - fascinating stuff. I wonder how much potential kernel code optimization has. I still remember the extreme difference between 2.4.x and 2.6.x. I had just bought a new computer because my old one was... getting old. And I felt completely cheated. The new kernel had brought me much more increase in responsiveness and "felt performance" than the new computer (AMD Duron 700 Mhz -> Athlon XP 2500+). If I could I probably would've brought it right back to the store. Well, they don't take returns on self-build computers here.
I really wonder how much difference the intel compiler compiled kernel makes in comparison to gcc. Maybe Phoronix could compare that one, too? Oh yeah "... boost up to 40% for certain kernel parts and an average boost of 8-9% possible" quotes LJ.
NVIDIA Brings Fast GPU Video Acceleration to Linux
Then came XvMC and it was not really convincing, because the impact was not too fast and it only worked during playback Mpeg2 AFAIK, not during transconding.
Now came NVIDIA (admittedly a couple weeks after AMD, but therefore publicly and including patches for mplayer) and finally brought out really nice and efficient video acceleration for linux.
My favorite Linux Performance News Site Phoronix checked it out and you can see quite an improvement (CPU usage with first OpenGL, then XVideo and then Nvidia's "VDPAU"(Video Decode and Presentation API).
I hope AMD and Intel will finally come out with some progress in this area, too. Next I would like to see support for encoding, e.g. in Xvid and then maybe even tasks such as gzip, bzip2 (the latter ones didn't even show multi-core support in my tests).
Ubuntu Getting Slower
After upgrading to Ubuntu 8.10 (release candidate), I've recently noticed stuttering in video playback. That might very well also be related to my using the intel 2.5.0 xorg driver. But Phoronix now made a correct examination and found out Ubuntu is getting slower and slower since 7.04.
Complexity or just bad programming? Is it related to the kernels gettings worse and if so, is that related to the Ubuntu patches or the vanilla kernel? I'm curious for hopefully following explanations.
Broadcom Wireless Drivers - wl vs. b43 - Performance Comparison
I've compared the performance of both drivers with a simple iperf test over a few meters:
Broadcom Proprietary Driver:
TCP
------------------------------------------------------------
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 46362
[ 4] 0.0-10.2 sec 24.6 MBytes 20.2 Mbits/sec
[ 5] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 46363
[ 5] 0.0-10.2 sec 24.6 MBytes 20.2 Mbits/sec
[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 46365
[ 4] 0.0-10.2 sec 24.0 MBytes 19.8 Mbits/secUDP
------------------------------------------------------------
Receiving 1470 byte datagrams
UDP buffer size: 375 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 35141[ 3] 0.0-10.0 sec 24.2 MBytes 20.2 Mbits/sec 1.364 ms 0/17239 (0%)[ 3] 0.0-10.0 sec 1 datagrams received out-of-order[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 38437[ 4] 0.0-10.0 sec 27.2 MBytes 22.8 Mbits/sec 1.837 ms 0/19418 (0%)[ 4] 0.0-10.0 sec 1 datagrams received out-of-order[ 3] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 45356[ 3] 0.0-10.0 sec 28.8 MBytes 24.1 Mbits/sec 1.319 ms 0/20555 (0%)[ 3] 0.0-10.0 sec 1 datagrams received out-of-order
B43 Open Source DriverTCP
------------------------------------------------------------
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 42345
[ 4] 0.0-10.1 sec 19.6 MBytes 16.4 Mbits/sec
[ 5] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 42346
[ 5] 0.0-10.2 sec 23.1 MBytes 19.0 Mbits/sec
[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 42347
[ 4] 0.0-10.2 sec 21.7 MBytes 17.8 Mbits/secUDP
------------------------------------------------------------
Receiving 1470 byte datagrams
UDP buffer size: 375 KByte (default)
------------------------------------------------------------[ 3] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 57459
[ 3] 0.0-10.1 sec 14.0 MBytes 11.7 Mbits/sec 0.438 ms 152/10171 (1.5%)
[ 3] 0.0-10.1 sec 1 datagrams received out-of-order
[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 55062
[ 4] 0.0-10.0 sec 15.7 MBytes 13.1 Mbits/sec 1.372 ms 205/11373 (1.8%)
[ 4] 0.0-10.0 sec 1 datagrams received out-of-order
[ 3] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 49861
[ 3] 0.0-10.1 sec 23.4 MBytes 19.5 Mbits/sec 3.724 ms 292/17017 (1.7%)
[ 3] 0.0-10.1 sec 1 datagrams received out-of-order
[ 4] local 192.168.178.24 port 5001 connected with 192.168.178.34 port 42069
[ 4] 0.0-10.0 sec 21.5 MBytes 18.0 Mbits/sec 1.370 ms 239/15544 (1.5%)
[ 4] 0.0-10.0 sec 1 datagrams received out-of-order
As you can see, the proprietary driver is slightly faster in TCP mode. And somehow they're both really slow in UDP mode. That's something I'd like to find out more about.
Update: That was my fault. For some reason iperf restricts UDP tests to 1 Mbit/s. Now the results are more appropriate. The result is that the proprietary driver has a more stable connection speed.
But I think that's really not worth installing a proprietary driver. Broadcom really would better integrate the changes into the open source driver. Their driver is still relying on the deprecated wireless system anyway.
Update2: Further tests showed that, at least after a while of usage, the proprietary driver creates high network latencies. Ping times to the router went up from 2 ms to an average of 160ms (peaks of 500ms !).
Sysctl for Network Perfomance
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.log_martians = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 87380 8388608
net.core.wmem_max = 262143
net.core.rmem_max = 262143
net.core.rmem_default = 262143
net.core.wmem_default = 262143
Or less with more comments:
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 15
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800
# Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0
# Turn off the tcp_sack
net.ipv4.tcp_sack = 0
# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
# Increases the size of the socket queue (effectively, q0).
net.ipv4.tcp_max_syn_backlog = 1024
# Increase the tcp-time-wait buckets pool size
net.ipv4.tcp_max_tw_buckets = 1440000
An excerpt from Webhostingtalk.
Better Process Monitoring with htop
Opera Speed running under Windows and Linux
I've installed Opera 9.5. It's really nice and I'm actually writing this entry with it right now. But then because of unfortunate resume problems after a BIOS upgrade with my Acer notebook, I've installed and tried the new version in Windows as well.
And frankly, I was amazed. The websites loaded so quickly it seemed they were just there immediately. Awesome work, Opera. But then I started wondering:
Why is Opera so much faster under Windows?
Xorg growing bigger and bigger?
If you find out that Xorg grows bigger and bigger with time, chances are high that this is not actually Xorg, but a program that uses its pixmap cache.
xrestop will tell you just that. It lists the applications by how much pixmap cache they use. Mine starts with "" using about 226 MB(!), looking up the process id shows that "" stands for plasma! (Nice try at hiding, budddy!)
Crazy...
Tracing System Calls
If you want to know what exactly a program is doing, e.g. to find out why it's using 50% cpu right now, you can use the strace command:
strace -r -fF -T -p `pidof someprogram`
As always, you can find out more about the usage with man strace. It often does not respond to Ctrl-C in my experience, which is why I often kill it. killall -QUIT strace
And it also often forgets to restart the program it traced, so try a killall -CONT someprogram.
Check it your ISP throttles P2P traffic
Researchers at the German Max Planck Institute for Software Systems put together a website that
- tells you which ISPs are throttling
- has a test for ISP bittorrent throttling
- and gives other people's bittorrent throttling test results with ISPs.
Linux Ramdisk mit tmpfs für mehr Speed
Einfach ein Verzeichnis $HOME/ram erzeugen und in die /etc/fstab einfügen:
und schon habt ihr eure ganz persönliche Ramdisk, die ihr selbst (un)mounten könnt.
Und wenn das nicht schön schnell aussieht:
$ dd bs=512k count=1000 if=/dev/zero of=ram/test
1000+0 Datensätze ein
1000+0 Datensätze aus
524288000 Bytes (524 MB) kopiert, 0,927082 Sekunden, 566 MB/s
Die maximale Größe ist der halbe physikalische Ram, änderbar mit z.B. size=1024m.
Das soll auch mehr Geschwindigkeit und etwas Sicherheit bringen:
tmpfs /tmp tmpfs defaults,nosuid,size=128m 0 0
Und wie immer: Viel Spaß!

