Sysctl Tweaks die wirklich helfen

Ich schwärme ja seit einiger Zeit über ein paar sysctl Tweaks für Linux die wir unter anderem in Neptune verwenden um so den Speed zu erhöhen. Zudem setze ich die gleiche Konfiguration auch auf meinen Linux basierenden Smartphones / Tablets ein und kann dadurch auch bei älteren Geräten mit etwas weniger Speicher mehr Geschwindigkeit herausholen. Immer wieder werde ich auch nach der Konfiguration gefragt und möchte diese aus diesem Grund hier einmal posten.

#sysctl.conf file
#
#############################
## Battery life tweaks #
#############################
vm.dirty_writeback_centisecs=3000
vm.dirty_expire_centisecs=500
#
#
#############################
## CPU tweaks #
#############################
#
## Queue size modifications
net.core.optmem_max=20480
net.unix.max_dgram_qlen=50
#
## Net Core Settings
## Location: /proc/sys/net/core
net.core.wmem_max=524288
net.core.rmem_max=524288
net.core.rmem_default=256960
net.core.wmem_default=256960
#
#############################
## VM & Filesystem tweaks #
#############################
fs.lease-break-time=10
#fs.file-max=65536
vm.overcommit_memory=1
vm.min_free_order_shift=4
vm.block_dump=0
vm.oom_dump_tasks=1
vm.page-cluster=0
#
#############################
## Net Speed tweaks #
#############################
#
## UnderUtilized Networking Tweaks below as recommended by avgjoemomma (from XDA)
net.ipv4.tcp_congestion_control=cubic
#
# # Hardening the TCP/IP stack to SYN attacks
net.ipv4.tcp_syncookies=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter=1
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_max_syn_backlog=1024
net.ipv4.tcp_max_tw_buckets=16384
net.ipv4.icmp_echo_ignore_all=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_fin_timeout=15
net.ipv4.tcp_keepalive_time=1800
net.ipv4.ip_forward=0
net.ipv4.tcp_moderate_rcvbuf=1
net.ipv4.route.flush=1
net.ipv4.udp_rmem_min=6144
net.ipv4.udp_wmem_min=6144
net.ipv4.tcp_rfc1337=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_ecn=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
#
# Don't accept source routing
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.all.accept_source_route=0
#
# Don't accept redirects
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0

####################################
## previous Neptune tweak settings #
####################################
# Set swappiness to very low - Try to use as much memory as you can before swapping
vm.swappiness = 26

# Controls the tendency of the kernel to reclaim the memory which is used for
# caching of directory and inode objects. - Prefer to clear dentry and inode caches
vm.vfs_cache_pressure = 10000

# Contains, as a percentage of total system memory, the number of pages at which a
# process which is generating disk writes will itself start writing out dirty data.
vm.dirty_ratio = 10

# Contains, as a percentage of total system memory, the number of pages at which
# the pdflush background writeback daemon will start writing out dirty data.
vm.dirty_background_ratio = 5


Wichtig hierbei ist der Wert vm.swappiness der in diesem Fall für 1-2 GB RAM auf 26 steht. Habt ihr mehr RAM könnt ihr dementsprechend das ganze herabsetzen. Es zuweit herabzusetzen würde ich allerdings nicht empfehlen.

Neptune 2.0 Beta auf 3.2 aktualisiert

Mein Neptune Build System läuft ja seit Jahren auf Basis eines Neptune 2.0 Beta, dass ich Schritt für Schritt auf die neuste 32-Bit Variante, also Neptune 2.55, aktualisiert habe. Nun nachdem wir aber schon bei Neptune 3.2 sind, welches nur noch 64-Bit unterstützt, habe ich mir gedacht nun sollte ich auch endlich das Upgrade wagen. Gesagt getan. Da ich üblicherweise meine Rechner immer mit zwei Partitionen austatte, einer System und einer Home Partition, war es nicht sehr schwer einfach die System Partition zu überschreiben.
Da ich noch eine zweite HDD neben meiner schnellen SSD im Laptop stecken habe entschloss ich mich die System Partition auf die HDD zu sichern. Glücklicherweise besaß die HDD auch Bereits 2 Partitionen, da die SSD auch erst vor knapp einem Jahr in Betrieb genommen wurde und daher die Systempartition damals von HDD auf SSD wanderte. Das Sichern auf die HDD brauchte natürlich etwas länger als die die Installation später auf die schnelle SSD, aber das kann man sich ja denken.

Zum Sichern der Systempartition habe ich kein dd oder sonstwas verwendet sondern einfach ein rsync -av <quelle> <ziel> . Danach war ein Neustart vom Live USB Stick von Neptune 3.2 nötig um dort die Installation anzustoßen. Hier wählte ich dann aus das die System Partition auf SSD formatiert werden sollte und dass ich gerne meine vorhandene Home Partition auf der SSD verwenden möchte.

Neptune Installer

Die Installation war dann in 5 Minuten fertig und ich konnte das neue System booten und war erstaunt, wie reibungslos das alles lief. Meine ganzen KDE Einstellungen von 4.9 wurden anstandslos in 4.10 übernommen. Lediglich kwalletd musste ich manuell anstoßen, damit der meine digitale Brieftasche öffnete um die Passwörter für die Mail Konten Akonadi mitzuteilen. (Hinweis: Ja ich benutze KMail anstand Icedove)

Insgesamt also ein gelungenes und sehr schnelles und einfaches Update. Ein paar Programme muss ich noch nachinstallieren, aber alles in allem bin ich doch erstaunt wie einfach es ist, wenn man eine seperate Home Partition hat, auch von einem 32-Bit System auf ein 64-Bit System zu aktualisieren. Natürlich ist auch die SSD eine enorme Zeitersparnis, bei einer herkömmlichen Festplatte hätte das deutlich länger gedauert.

Haiku Challenge Day 7

On this day I wanted to tweak my system a little bit and show you the tricks I learned in Haiku.
So first of all lets start off with some basic thing. A launcher or launchbar. Haiku has launchbar called launchbox which contains some applications preconfigured. It stores that shortcuts in a window called pad. You have the possibility to add new pads with different applications and you can just simply change the layout to horizontal or vertical. New items can be placed with a right click aswell and you can even set the icon size.

LaunchBox

A more mac like dock is BeDock. It allows you to create launchers and they also work as switchers so that you can switch to already open windows. But BeDock comes with a naked configuration so you need to configure apps and icons for apps yourself. You definitely need an icon for every application otherwise it won’t add it to the dock. But as BeDock is still beta and a new version seems on its way I guess that can be overlooked as all the other features like zooming in when hovering an item and configuration settings are pretty nice features.

BeDock

Of course there are other more classical and more native feeling applications like Dockbert and you always have the possibility to move the deskbar around the screen and create a more classical windows like look.

Deskbar placed on the bottom

Trying out Haiku for one week made me familiar we a bunch of cool hidden features (or at least not directly visible ones).
One example would be the terminal. It has a pretty nice feature which allows you to open up files and folders directly or copy their paths. Its a pretty nice feature if you searched for a file in the terminal and want to quickly take a look at its contents, or to open a folder very quickly. It also supports urls. All you need to do to activate this feature is holding the ALT key and hovering over the paths or urls. With a right click it reveals a menu.

Terminal holding ALT and right clicking on path

There are other handy features like quickly opening up a terminal in a folder by just pressing META (Super/Win) + ALT + T or quickly setting the background of a folder or the desktop (when the desktop is in focus) by pressing META + ALT + B.
If you want to search for a text inside a file you can use META + ALT + G. If you want to search for a file ALT+F.
A query can be edited by pressing ALT+G while the query window is open.

If you want to set shortcuts on your own there is the shortcut application available which allows you to set various shortcuts for applications and save them so that you can even share those shortcuts if you like.

Shortcuts

There are dozens of other cool shortcuts available which can make life a little bit easier.
What I didn’t mention in my earlier posts was how to kill frozen applications. This is because I never really had freezing applications on my tests. But there is always the possibility to use the ProcessController in the deskbar to locate and kill the application. A way cooler trick is using the vulcan-neck-shortcut CTRL + ALT + SHIFT and then clicking on the app entry in the deskbar.

Conclusion
After one week of using Haiku I really fell in love with it. You can find cool new applications or simple but powerfull little things in the system that make you think Yeah this is really something they thought of like the little icon in every top right corner of the file manager which can be used to drag the current folder anywhere you want to copy, link or move the folder wherever you like. The possibility to right click on the window border to resize it or left click to move the window. These are all things that show me that this system and all its features are really build with love.
All in all I think I will stick with Haiku on my Laptop regardless of the not really 100% ready webbrowser or the mail client which still needs some love. I will continue to explore new features and try out new applications on the journey towards Haiku Beta 1 and then R1.
You can come on board too if you want by just grabbing the latest nightly or alpha version if you like. Thats all for this little Haiku Challenge and I hope you enjoyed reading this little series of articles.

Haiku Challenge Day 6

This is kinda a feedback day as many people wrote to me regarding the Haiku Challenge and gave interesting tips and tricks. Thanks to the tip from Robert Stiehler I found another screenrecording software built into voptop which is a instant messaging client with voip support and video conferencing support.
It also offers to share the screen and to record a screencast which is pretty nice. And this screencasting software creates a little bit smoother videos than BeScreenCapture but on the native resolution it kinda looks like a slideshow. Nevertheless I know have 2 Screencasting softwares to play around with.

Voptop

As for the Screen tool and multiscreen support tidux told me that multiscreen support landed in haiku master earlier. So if I might grab a newer version I would have it. kallisti5 told me about a haiku port of the latest Handbrake that he did but it seems only available as source code so far.

When it comes to queries humdinger told me that before R1 becomes final there will be definitely a discussion on what attributes should be enabled by default in the index so that reindexing would not be necessary.
Also I like to mention scottmc’s comment with a nice link to lot of videos about Haiku and grabed my attention with one that explains and shows attributes and query usage under haiku.

Haiku Screencast explaining Queries

The next cool thing I found out while testing screencasting on Haiku is that you can set different resolutions for each workspace which is a pretty nice feature. Of course there is also a workspace switcher application that can be pinned on the desktop as replicant. Replicants is just another word for widget or plasmoid. To pin an application as replicant to the desktop you need to drag the little hand drawn in the bottom right of an application and drag it to the desktop.
This works not only for the workspace application but also for the different elements of the activity monitor. Furhtermore you can trigger if the little hand is shown by clicking on deskbar Show replicants. The workspace application itself also has an right click menu which allows you to integrate it into the deskbar if you will.

Workspaces replicant

After almost one week of Haiku usage I find myself using the attributes a lot lately to archive videos and audio files aswell as some contact data as people file. As the attributes are only saved on an bfs partition moving my files to another partition would simply not keep them. But as I want to backup some stuff onto a usb thumb drive I thought it would be nice to create a virtual bfs image. I found the Bfs Image Creator which can be used to create and mount bfs partitionfiles.

Bfs Image Creator

So I created a 2 GB bfs partitionfile called usb.image and mounted it. Bfs Image Creator has a mount option for its own but also doubleclicking the image file will automatically mount it on the desktop. Manually creating a backup now is really easy and works like expected. Apros pros backup especially with Haiku in the alpha stage and each and every day a new revision is uploaded with new and better stuff in it it might be useful to have an backup of all the desktop and most of the application settings, so that you can easily reinstall a new version and then use your settings backup to restore your settings. So I found LBackup (Lelldorins Backup) which exactly does what I want.

LBackup

For regulary Backups there is a nice backup software called Simple Backup which stores its contents in zip files and prevents the bfs attributes from being lost. It also has the option to exclude files which are older than a specific date or update an existing archive. You can even set the compression rate and some other options. Unfortunately I could not start it. Too bad

So this was basically my 6 day in Haiku world. On my last day tomorrow I will list up some nice tips and tricks that I found out and some nice hotkeys that help you to work fast on Haiku.

Haiku Challenge Day 5

Haiku Challenge Day 5

As I skipped sunday I am back at Haiku today on monday. The first thing I wanted to do today was watching the newest linux action show and I downloaded the video file and could watch it without any problem.

Linux Action Show on Haiku

I thought it would be neat to show the video on my Samsung TV/Monitor so I tried plugging in the VGA cable to see how Haiku would handle it. It somehow automatically tried to clone the display output but somehow failed with the refreshing rate as it was blinking all over the place. It might be due to the nvidia chip build into my laptop as I remember that on earlier alphas on my intel chip based eeepc 701 haiku could successfully clone the output. Anyhow there is no configuration tool for a second monitor. The screen utility only shows the current internel display. Nevertheless I tried changing the resolution which had an effect on both displays but the refreshrate on the TV was still not correct so it did not stop flickering.

VGA output not really working

Btw. I uploaded the above photo taken with my smartphone to my Haiku machine just by plugging it in and I immediately get asked if I want to mount the smartphone read only or read/write which is btw. a pretty nice feature if you want to make sure not to delete anything accidently from your camera/smartphone.

mounting smartphone

The next thing that I tested was DVD playback. Sometimes I still want to playback some old dvds and this works pretty fine with Haiku. I just installed the VLC and could playback the dvd without any big problems. Menus and extras played fine too. This just works as expected.

VLC DVD playback

What did not work was ripping the dvd I found Handbrake for Haiku (its basically the older version what was available for BeOS) it just crashes if I try to open up the dvd directly or indirectly by pointing to the dvd directory. Too bad for this. But I found an mplayer 1.1 package which includes mencoder that does dvdripping just fine. So I just executed

mplayer dvd://3 dvd-device /dev/disk/atapi/0/master/raw -v -dumpstream -dumpfile Dateiname.vob

to dump a simply vob stream that can be played back either by mplayer or vlc. It can also be converted simply with mencoder to an avi file like so

./mencoder ~/Desktop/Dateiname.vob -oac lavc -ovc lavc -o ~/Desktop/Dateiname.avi

Mencoder

All in all DVD ripping is a little bit complicated. At least a one click solution like handbrake working would be ideal.

The last thing I did today was trying to capture a screencast. The BeScreencapture utility is the only known screencasting application for Haiku. I tried this on my native resolution (1280x800) but the resulting screencast was too choppy. So I tried reducing the resolution to 800x600 and redid the screencast which is still a bit choppy but a lot better.

[Youtube: http://www.youtube.com/watch?v=uDBvuArfh_g]

So this was basically my 5th day in Haiku land.

Haiku Challenge Day 4

Haiku Challenge Day 4

On this 4th day of my Haiku Challenge I first have to start off with a little bummer. The webbrowser Webpositive somehow gave me a headache this morning as I wanted to watch some youtube videos and it started redirecting and redirecting and redirecting to the opps page of youtube. So finally I gave up and started QupZilla (the qtwebkit based browser) which then showed me youtube sucessfully. Youtube was nagging about ‘Do you want to use your real name for your account’ message. After I dismissed this question and tried WebPositive again. It worked again :P . But the next problem was on its way. I watched a review of KDE SC 4.11 and wanted to write a little comment on this review which was simply not possible as “comments are disabled”. At least this what WebPositive rendered. Ok I started QupZilla again and comments were there. So I really beg the developers to update the underlying webkit version of WebPositive as I also got a strange problem on google+ where it keeps logging me off after a few seconds. (Diaspora btw. worked like a charm and interestingly enough it does not work on QupZilla. Maybe a secret hint who knows)

WebPositive failing on G+

The next thing that I wanted to test out is bittorrent. So I searched for a client. installoptionalpackage has Transmission on board which provides a cli user interface. This can become handy when I wanted my haiku machine as remote box and start a torrent download with ssh which is possible btw. I only needed to set a password for my main user on my haiku machine.
There is also the transmission-daemon which creates a html user interface which can be used to access a graphical html interface for transmission in the browser by entering the adress

http://localhost:9091

Besides that I also found a Qt based bittorrent client which is called QBittorrent. This one works splendidly aswell and I will be using it in the future as my default I guess.

QBittorrent

When it comes to filesharing there also another simply solution build in Haiku - a webserver. Just execute the PoorMan application from the menu and it will create a public_html folder in your home folder and start a webserver. You can then either put your website in this public_html folder or some other files. Those other files get listed on an index page if you don’t have a index.html file in the public_html folder when you set the ‘send file listing if there is no index.html’ option in PoorMan.

PoorMan webserver one way filesharing

As a dropbox user I only used dropbox from the website so far in haiku. But today I found a pretty nice dropbox client for the shell that should also work for linux users aswell as it is only using curl as backend. So I downloaded the dropbox-uploader from git and start configuring. Basically the shell script takes you through the steps on howto create a new developer app key for the application to be used. 5 minutes later I was able to list, download and upload to my dropbox via the terminal which is pretty nice. The only thing missing now would be perhaps an graphical application for this nice script (I am looking at you potential devs of haiku) but I don’t need it necessarily as I am fine with using the terminal.

dropbox-uploader

There seems to be also an graphical client in the making for haiku with integration into tracker called orphilia-dropbox. But I did not test that out yet.

The next thing I wanted to try out was a podcatcher. I usually only use the one on my smartphone and sometimes only amarok to download some. My way on haikuware brought me to the obvious choice bepodder. That installed fine even though the download link to the free key for bepodder (it was once proprietary and you need to buy the key for full functionality) did not work. It simply could not connect and load any feed I added. So I looked for alternatives and found a nice little script called podget which runs fine from the terminal and can also be used remotely if you wanted to from ssh. I downloaded a few podcasts and added the rss feeds to the serverlist file in /boot/home/.podget

podget podcatcher

The last thing I tried out is the BeShare application an application that I still know from the good old BeOS days and it is still available. Its basically something that you could compare to Napster or LimeWire/Frostwire, Gnutella and others with the big advantage that it uses the bfs attributes to filter and search for files and has a nice irc like chatting function.

BeShare

After all that filesharing applications I needed a break and wanted to playback some old midi files. After installing TimGMs soundfont via installoptionalpackage I could just doubleclick them and they were played back in the midi player. It simply worked that easy. The midiplayer also has an option for live input so I took my small usb midi keyboard and plugged it in. This resulted in a kernel crash in the uhci_finish_thread and I landed in the kernel debugging land. Here I could suspend the thread by typing in

suspend thead_id

and then exit out of it. This was an interesting experience as this was the first kernel crash I experienced since the start of this challenge.
But I did not give up so early. So I searched haikuware and found an application called midisynth which offers a virtual midi keyboard and some other sequencing options. By default however this application did not let me play anything as it simply was searching in an old beos filestructure for the soundfont file. So I had to create a link for it to be found by midisynth.

ln -s /boot/system/data/ /boot/beos/etc

After that it found the soundfont and I was able to playback some nice sounds and even learned that keypresses on the keyboard where mapped to the piano keys which is actually a pretty nice feature.

MidiSynth

All in all this day I found solutions for a podcatcher and sharing files online and via dropbox which are pretty nice. The webbrowser definitely needs an update to support the newest additions of webpages but runs a lot more stable than Qt alternatives like QupZilla. So thats it today for my 4th day in Haiku world.

Haiku Challenge Day 3

Today I tried testing the database like filesystems with queries and attributes. Of course on my first try I somehow took the complicated way but I somehow got it working. What I tried was tagging and searching my Wallpapers. First of all I opened up the find application that can be found via the haiku main menu in the deskbar. This has a basic set of filetypes and attributes associated to this filetypes. As all my wallpapers don’t have any attributes besides the automatically generated mimetype attribute which is used by the applications (which btw. can be also be used to mask files like I had an video file saved as doc.txt but as the mimetype attribute did not change it opened up the mediaplayer and recognized it as video file).

Find utility

The find utility lets me choose from a dropdown box the various different attributes. But it also offers a forumula option which I used after I choose the attributes to get the complete attribute name how it is saved and can be used in the filesystem.
So the option I was searching for is called Media:Comment . To add now a comment attribute to my files I can start a terminal and execute the command

addattr -t string Media:Comment “My Tag” ~/Wallpaper/*.png

This will add the tag My Tag to the all the *.png files in my Wallpaper directory. If I want to I could also choose files one by one to add different comments to them.

Now to the tricky part. The Media:Comment attribute is not listed in the filesystem index (comparable to a database index) so a search would fail. To tell the filesystem to add it to the index you need to reindex the files by executing:

reindex -v Media:Comment ~/Wallpaper/*.png

This makes those files finally searchable by the find tool. Of course later on I found a graphical attributes editor called jellikit which allows you to easily create new attributes and add them to files.

For the whole reindexing stuff there is a much much more easier way if you already somehow have the files tagged. So for example mostly all of my mp3 files are tagged already. So it is very easy to convert those tags to bfs file attributes. There is even a tool available via installoptionalpackage called armyknife. And this is just an awesome tool. One click on all mp3 tags are written as bfs file attributes.

Armyknife

After that I simply opened up find and created a search for an artists and simply saved this search as a query on my desktop. The cool thing about this query is that it automatically updates the list of files found when I add new music files with the same artist. This even works for plugged in usb thumb drives that contain a bfs partition with reindexed music files.

This is a really really cool feature. But it has the one downside that you need to execute the reindex command after adding a new attribute. At least the standard tools like the ShowImage image viewer should do the reindex on its own when adding new attributes like Rating for example. But overall the find tool is very very powerful and in contrast to KDEs nepomuk which offers a similar feature it has absolutely no performance impact. At least I indexed about 2000 files here already and did not see any performance impact which is pretty cool. Also as contact data (people files) and mails are stored with attributes attached to them I can also create a query with mails from last week or contacts living in a particular region.

So enough querying and indexing for today. The next thing I wanted to do was playing some games. Haiku itself ships with a limit amount of demo applications among them also some games like pairs which is a memory game. But I wanted more so I searched haikuware and was pretty much suprised because there are tons of games available for Haiku. Infact it is the biggest category in haikuware including 469 entries.
Besides some classic games like, BeMines, BeNibblix (A snake like game) and Bing (a pong like game) I also found FreeSpace2 which is a space shooter and simulator. This port needs either the original game files from the full game or the demo but works great if you have them.

Some Games

I also found one of my favorite game Hedgewars. Most of those games are based on SDL gcc4 which can be obtained from haikuware aswell. Also handy sometimes the maxpacklibsgcc4 to get some games running. Sadly I did not get hedgewars working as it needs a gcc4/gcc4hybrid build of haiku which I currently don’t have.(I am running a gcc2hybrid)

Monkey Island in ScummVM

As I love some of the old Indiana Jones and Monkey Island games I downloaded ScummVM available for Haiku and this runs without a problem. All in all there are lots of casual games and some game classics available just like Quake 3 for example. As I am not a hardcore gamer this is more than enough for me to explore and try out.

So all in all the 3rd day I learned to love attributes in haiku and had fun with some games.