Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

More Latency Tweaks for Desktop Users

Diposkan oleh Unknown on Tuesday, February 1, 2011

For those of you who got hooked already by the magical kernel patch that went into 2.6.38 and seriously improved latency with high load, there is a special daemon now that takes it further: uLatencyD. And for the lazy Ubuntu people there is a ppa available, too:
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.
More aboutMore Latency Tweaks for Desktop Users

Saturating your Link with Lftp

Diposkan oleh Unknown on Sunday, December 19, 2010

I've been looking for a tool that downloads with several connections at the same time for a while, like GetRight for Windows used to be. Because without a tool like that, you can't really take advantage of fast connections with 20 and more Mbit. Now I've found a tool that does that and even surpasses my expectations: lftp. Lftp does not only support this, it supports the feature in http and ftp like many programs, but also in sftp, fish, ftps and https. And the usage is extremely simple: lftp pget url.
More aboutSaturating your Link with Lftp

Fun with Compcache/RamZSwap

Diposkan oleh Unknown on Wednesday, August 4, 2010

If you run a netbook, a system with few memory, or just for the fun of it. Using RamZSwap helps your performance and is included since 2.6.33 and really easy:

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.
More aboutFun with Compcache/RamZSwap

How to set up X and VAAPI Accelerated HD Video on the MSI Wind U110 (GMA500 - Poulsbo) and Ubuntu Karmic 9.10

Diposkan oleh Unknown on Saturday, December 26, 2009

The following guide is now slightly outdated as Ubuntu 10.04 is out and new drivers are necessary, also some of the repositories I originally used have disappeared. If you use Ubuntu 10.04, try following my much easier directions here instead. (The largest detriment to the Ubuntu 9.10 driver is a complete lack of suspend to ram for me. I will leave my guide for 9.10 online as reference, though. It seems to have been the first good description and I'm happy about the major online media coverage. :)

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.
CPU usage when playing a 10 minute fireworks recording in 1080p @ 50 fps without sound and then two FullHD movie trailers. The CPU is clocked at 800Mhz the entire time. The spike is caused by a bug in my test sequence: I didn't start a new mplayer process for new files but passed them all at once on the command line.

I can watch FullHD (1080p @ 50 fps + AC3) videos with about 30% or less CPU utilization (Atom@800 Mhz) on my netbook now. Looks really nice, too. Some videos produce artefacts, especially self-recorded AVCHD m2ts files. If you use the right demuxer, AVCHD videos play fine, but deinterlacing does not work. Sometimes the video seems not to run very smooth, etc. It's not perfect yet, don't expect too much! But most videos work perfectly, no matter what resolution.

The only real problem is with suspend to ram. You can't use suspend to ram or VAAPI at the same time: If you used VAAPI and try to suspend, the system doesn't suspend and/or crashes. If you suspend, then use VAAPI or even xv I think, the system crashes really hard. So suspend doesn't really work as expected yet. I think the sound also doesn't work properly after suspend. Suspend works fine for me even after resume if I do a double console switch (Ctrl-Alt-F1 wait until you see the console, then Ctrl-Alt-F7).

Here's what you need to do
1. Basically you add the GMA500 Repositories for Ubuntu 9.10 (karmic) and 10.04 (Lucid) to /etc/apt/sources.list.d/mobile.list. (If the entry below doesn't work, check this page.)
sudo add-apt-repository ppa:gma500/ppa && sudo apt-get update

2. Then you install the poulsbo-driver-3d including the firmware and everything.

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)
you need a manual hack to get the driver working, as I just reported.


3. Once that's done, for a more stable and speedy operation, you need to add an /etc/X11/xorg.conf:

Section "Device"
Identifier "GMA500"
Option "AccelMethod" "EXA"
# someone suggested UXA? but that's for the i965 drivers
Option "DRI" "on"
Option "MigrationHeuristic" "greedy"
Option "IgnoreACPI" "yes"
Driver "psb"
EndSection

Section "DRI"
Mode 0666
EndSection

4. Reboot and make sure that it works! If X doesn't work properly yet, VAAPI won't, either. After a short black screen, you should be greeted in the correct resolution. Full screen xv video should already work fine. Suspend to RAM also worked perfectly at this point for me.

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
Now comes the part where we install the hardware decoding acceleration. If you just want X you can stop now. ;) This is written for Ubuntu 9.10 with old repositories, so 5+6 might not be necessary anymore or work for Ubuntu 10.04!

5. Install the Libva library from http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva1_0.31.0-1+sds8_i386.deb. This replaces your current libva1 with a newer version.  also works for me. Don't forget to install the -dev version (http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb) as well if you want to compile mplayer later.


6. Create a link of your video driver to the vaapi driver directory:
sudo ln -s /usr/X11R6/lib/modules/dri/psb_drv_video.so /usr/lib/va/drivers/

A. Precompiled setup. (You can alternatively skip to part B: compiling the source code setup)

7. Download and unpack the precompiled mplayer:

8. Install a normal mplayer and libmad with apt-get.
sudo apt-get install mplayer libmad0

9. Unpack mplayer and create necessary links to the libraries it expects.
"ldd mplayer" tells you what library (names) mplayer expects.
Just to go /usr/lib and create links to them:
e.g
ln -s libx264.so.67 libx264.so.65
This should work as long as your libraries are newer than the expected ones. It may actually work out of the box in Ubuntu Jaunty.

10. Start mplayer from the package you downloaded:
e.g. ~/mplayer-vaapi-20090914.i686/mplayer -fs -vo vaapi -va vaapi HDtest.avi

B. Compiling the Source Code

I've also manged to get the source code to work. This is less bothersome, because you need not link the libaries. Hence less man hours, but more disk space and computer hours for compiling. Didn't take as long as I feared, though. And it's using a slightly newer version of mplayer-vaapi, which includes some rudimentary OSD in vaapi mode now.

7. Install the build environment:

sudo apt-get build-dep mplayer
sudo apt-get install libdrm-dev
maybe: sudo apt-get -f install


8. Download the source at http://www.splitted-desktop.com/~gbeauchesne/mplayer-vaapi/mplayer-vaapi-20091106-FULL.tar.bz2. Unpack it and execute the checkout-patch-build.sh.

9. Check if it works, e.g.
mplayer -fs -vo vaapi -va vaapi ~/HDtest.avi

10.
sudo make install.

X. Done! Enjoy e.g. a nice HD trailer for a start! Post your results! I can recommend using it in smplayer for more comfort(e.g. automatically continue where you left of last). If it crashed, check out by blog entry about smplayer crashing in vaapi mode.

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.
More aboutHow to set up X and VAAPI Accelerated HD Video on the MSI Wind U110 (GMA500 - Poulsbo) and Ubuntu Karmic 9.10

Linux Boots Faster!

Diposkan oleh Unknown on Tuesday, November 3, 2009

Check out this live video comparison at TuxRadar:

More aboutLinux Boots Faster!

Adjust Linux Network Receive Window for Fast Networks

Diposkan oleh Unknown on Wednesday, May 27, 2009

Simply execute the following command in your shell to increase the receive window buffers. That should improve the performance, especially from servers with a high latency.
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
More aboutAdjust Linux Network Receive Window for Fast Networks

Limiting CPU Usage of a Program

Diposkan oleh Unknown on Sunday, May 24, 2009

Interesting article.
More aboutLimiting CPU Usage of a Program

Linux Kernels 2.6.24 - 2.6.29 Benchmarked (Phoronix)

Diposkan oleh Unknown on Tuesday, March 24, 2009

I've read the newest Phoronix benchmark of all kernels 2.6.24 through 2.6.29 and if you don't follow the link now, I'll spoil it for you in the next paragraph...



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.
More aboutLinux Kernels 2.6.24 - 2.6.29 Benchmarked (Phoronix)

How to Speed Up your Website's Page Loading Times with Apache and .htaccess

Diposkan oleh Unknown on Friday, December 19, 2008

More aboutHow to Speed Up your Website's Page Loading Times with Apache and .htaccess

NVIDIA Brings Fast GPU Video Acceleration to Linux

Diposkan oleh Unknown on Sunday, November 16, 2008

It's been a while. I've sat here on my chair for a long time and thought to myself: Hey, if you want to do it, video acceleration would be really easy to integrate into Linux software: It's mostly open source and the changed would be pretty specific to that part.

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).
More aboutNVIDIA Brings Fast GPU Video Acceleration to Linux

Ubuntu Getting Slower

Diposkan oleh Unknown on Monday, October 27, 2008

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.

More aboutUbuntu Getting Slower

Broadcom Wireless Drivers - wl vs. b43 - Performance Comparison

Diposkan oleh Unknown on Friday, October 10, 2008

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/sec

UDP
------------------------------------------------------------
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 Driver

TCP
------------------------------------------------------------
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/sec

UDP

------------------------------------------------------------
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 !).

More aboutBroadcom Wireless Drivers - wl vs. b43 - Performance Comparison

Sysctl for Network Perfomance

Diposkan oleh Unknown on Wednesday, September 10, 2008

The short version:

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.
More aboutSysctl for Network Perfomance

Better Process Monitoring with htop

Diposkan oleh Unknown on Thursday, June 19, 2008

htop is a much nicer alternative to top, as you can configure it much easier and more interactive. It also has bars for cpu, mem and swap usage for a better overview.
More aboutBetter Process Monitoring with htop

Opera Speed running under Windows and Linux

Diposkan oleh Unknown on Wednesday, June 18, 2008

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?

More aboutOpera Speed running under Windows and Linux

Xorg growing bigger and bigger?

Diposkan oleh Unknown on Wednesday, June 11, 2008

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...

More aboutXorg growing bigger and bigger?

Tracing System Calls

Diposkan oleh Unknown on Sunday, June 8, 2008

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.

More aboutTracing System Calls

Check it your ISP throttles P2P traffic

Diposkan oleh Unknown on Thursday, June 5, 2008

More aboutCheck it your ISP throttles P2P traffic

Linux Ramdisk mit tmpfs für mehr Speed

Diposkan oleh Unknown on Saturday, February 9, 2008

Keine Ahnung wozu man den ganzen Ram benutzen soll, den man heute hat? Etwas runterladen und danach gleich wieder löschen? Selbst den Kernel kann man in einer großen Ramdisk festplattenschonend kompilieren. Und ganz im Gegensatz zu Windows steht der Arbeitsspeicher dem Betriebssystem und anderen Anwendungen frei, wenn er nicht von der Ramdisk benötigt wird.

Einfach ein Verzeichnis $HOME/ram erzeugen und in die /etc/fstab einfügen:


tmpfs /home/BENUTZER/ram tmpfs defaults,user,uid=BENUTZER,mode=0700 0 0

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ß!
More aboutLinux Ramdisk mit tmpfs für mehr Speed