<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1610041778732887994</id><updated>2012-01-31T16:07:23.221-08:00</updated><category term='linux'/><category term='Freebsd'/><category term='Sun'/><category term='djb tools'/><category term='erlang'/><category term='network programming'/><category term='Filesystems'/><category term='VI'/><category term='Mysql'/><category term='Nginx'/><category term='Solaris'/><category term='DragonFly BSD'/><category term='Bash'/><category term='qmail'/><category term='Patches'/><category term='http'/><category term='C programming'/><category term='profiling'/><title type='text'>Levent Serinol's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>62</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6035109528010392247</id><published>2010-06-25T08:34:00.001-07:00</published><updated>2010-06-25T08:35:29.896-07:00</updated><title type='text'>Boosting Radware Defense Pro's performance ;)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/TCTMs5SpyMI/AAAAAAAAAOg/RCdrFsji0_I/s1600/rad.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 192px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/TCTMs5SpyMI/AAAAAAAAAOg/RCdrFsji0_I/s320/rad.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5486735317709473986" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6035109528010392247?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6035109528010392247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6035109528010392247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6035109528010392247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6035109528010392247'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2010/06/boosting-radware-defense-pros.html' title='Boosting Radware Defense Pro&apos;s performance ;)'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bOa3aOPXCQo/TCTMs5SpyMI/AAAAAAAAAOg/RCdrFsji0_I/s72-c/rad.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6028222678965378300</id><published>2010-02-08T05:36:00.001-08:00</published><updated>2010-02-08T05:42:17.954-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Detailed  network interface statistics on Linux</title><content type='html'>Here is a helpful command for getting interface statistics on your linux box. It's called ip. It's bundled with iproute package. You can see information about dropped, collisions,crc,transmit and other info about your network interface.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;root@helga:~# ip -s -s link show eth0&lt;br /&gt;2: eth0: &lt;broadcast,multicast,up,lower_up&gt; mtu 1500 qdi&lt;br /&gt;WN qlen 1000&lt;br /&gt;  link/ether 00:24:8c:d5:6a:a7 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;  RX: bytes  packets  errors  dropped overrun mcast&lt;br /&gt;  1633058095 16933162 0       0       0       0    &lt;br /&gt;  RX errors: length  crc     frame   fifo    missed&lt;br /&gt;             0        0       0       0       0    &lt;br /&gt;  TX: bytes  packets  errors  dropped carrier collsns&lt;br /&gt;  1994496524 5588574  0       0       0       0    &lt;br /&gt;  TX errors: aborted fifo    window  heartbeat&lt;br /&gt;             0        0       0       0    &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6028222678965378300?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6028222678965378300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6028222678965378300' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6028222678965378300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6028222678965378300'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2010/02/detailed-network-interface-statistics.html' title='Detailed  network interface statistics on Linux'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3052652202178704048</id><published>2009-09-11T03:58:00.000-07:00</published><updated>2009-09-23T07:40:52.362-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>I/O usage per process on Linux</title><content type='html'>Linux kernel 2.6.20 and later supports per process I/O accounting. You can access every process/thread's I/O read/write values by using /proc filesystem. You can check if your kernel has built with I/O account by just simply checking /proc/self/io file. If it exists then you have I/O accounting built-in.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;$ cat /proc/self/io&lt;br /&gt;rchar: 3809&lt;br /&gt;wchar: 0&lt;br /&gt;syscr: 10&lt;br /&gt;syscw: 0&lt;br /&gt;read_bytes: 0&lt;br /&gt;write_bytes: 0&lt;br /&gt;cancelled_write_bytes: 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Field Descriptions:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;rchar  - bytes read&lt;br /&gt;wchar  - byres written&lt;br /&gt;syscr  - number of read syscalls&lt;br /&gt;syscw  - number of write syscalls&lt;br /&gt;read_bytes  - number of bytes caused by this process to  read&lt;br /&gt;            from underlying storage&lt;br /&gt;write_bytes - number of bytes caused by this process to written from&lt;br /&gt;            underlying storage&lt;br /&gt;&lt;/pre&gt;As you know, ever process is presented by it's pid number under /proc directory. You can access any process's I/O accounting values by just looking /proc/#pid/io file. There is a utility called &lt;a href="http://guichaz.free.fr/iotop/"&gt;iotop&lt;/a&gt; which collects these values and shows you in like top utility. You see your processes I/O activity with iotop utility.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SqozxBAg7tI/AAAAAAAAANQ/U7Q6mz405Gw/s1600-h/iotop.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 217px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SqozxBAg7tI/AAAAAAAAANQ/U7Q6mz405Gw/s320/iotop.png" alt="" id="BLOGGER_PHOTO_ID_5380169622024679122" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3052652202178704048?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3052652202178704048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3052652202178704048' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3052652202178704048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3052652202178704048'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/09/io-usage-per-process-on-linux.html' title='I/O usage per process on Linux'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SqozxBAg7tI/AAAAAAAAANQ/U7Q6mz405Gw/s72-c/iotop.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6208672073080631945</id><published>2009-09-04T12:24:00.000-07:00</published><updated>2009-09-06T23:25:13.050-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mysql'/><title type='text'>problem compiling Mysql 5.1 with sphinx engine support</title><content type='html'>&lt;div&gt;Mysql's full-text search engine is not very powerful and support comes only with Myisam engine. &lt;a href="http://www.sphinxsearch.com/"&gt;Sphinx&lt;/a&gt; is a full-text search engine replacement for Mysql and Postgresql. Also, It's possible to use Sphinx full-text search engine with both Myisam and InnoDB engines.  You can read detailed information about mysql compilation with sphinx on &lt;a href="http://www.sphinxsearch.com/docs/current.html#sphinxse"&gt;Sphinx&lt;/a&gt; site.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;I have faced with following error message, while compiling Mysql with innodb and sphinx engine support ( ./configure --prefix=/data/mysql3/ --with-plugins=sphinx,innobase). I used the innodb (base) which bundled with Mysql. You can also compile &lt;a href="http://www.innodb.com/products/innodb_plugin/"&gt;innodb plugin&lt;/a&gt; which has additional features. For example, on the fly compression, speed improvements.&lt;br /&gt;&lt;/div&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;configure: error: unknown plugin: sphinx&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The trick was to run autorun.sh command in Mysql's source tree before running configure with sphinx engine support. This script will create a new configure script which knows how to compile sphinx engine.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;# ./BUILD/autorun.sh&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6208672073080631945?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6208672073080631945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6208672073080631945' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6208672073080631945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6208672073080631945'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/09/problem-compiling-mysql-51-with-sphinx.html' title='problem compiling Mysql 5.1 with sphinx engine support'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-2435215490508216706</id><published>2009-09-03T00:31:00.000-07:00</published><updated>2009-09-03T00:35:22.526-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>nethogs network utility</title><content type='html'>&lt;a href="http://nethogs.sourceforge.net/"&gt;Nethogs&lt;/a&gt; is a small but very useful utility, if you like to see your machine's bandwidth usage per processes. Here is a simple screenshot from my linuxbox.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sp9xXq0APSI/AAAAAAAAANI/6Bm9ZL34NW0/s1600-h/nethogs.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 217px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sp9xXq0APSI/AAAAAAAAANI/6Bm9ZL34NW0/s320/nethogs.png" alt="" id="BLOGGER_PHOTO_ID_5377141131547000098" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-2435215490508216706?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/2435215490508216706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=2435215490508216706' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2435215490508216706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2435215490508216706'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/09/nethogs-network-utility.html' title='nethogs network utility'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/Sp9xXq0APSI/AAAAAAAAANI/6Bm9ZL34NW0/s72-c/nethogs.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7745660372894226773</id><published>2009-07-12T01:41:00.000-07:00</published><updated>2009-07-12T02:00:13.920-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Fast Copy on Unix systems</title><content type='html'>I needed to copy so many small files and directories (1.2 TB) to another machine with &lt;a href="http://netcat.sourceforge.net/"&gt;netcat&lt;/a&gt; (nc). But I  faced with a problem when I tried to run nc program on the background with bash. Bash was suspending standard input when I move nc process to background job, this was causing nc processess to die when standard input was blocked. So, I have found another netcat like utility called &lt;a href="http://www.dest-unreach.org/socat/"&gt;socat&lt;/a&gt;. Socat is not stop execution while it was working as background job on bash shell. I was able to utilize 100mbit ethernet with few socat processes on server and client side. First of all, I run socat processes on destination server as daemons to listen specific ports. Following, command will run socat in daemon mode to listen on tcp port 4123 and pipe incoming data to tar command on the background.&lt;br /&gt;&lt;br /&gt;# (socat -u tcp4-listen:4123 - | tar xzp -C .) &amp;amp;&lt;br /&gt;&lt;br /&gt;On source server, I run socat to feed incoming tar data to destination socat daemon where it listens on tcp port 4123. My destination server's ip adddess was 192.168.36.199 .&lt;br /&gt;&lt;br /&gt;# (tar -czp - /mydir/1/ | socat -u - tcp4:192.168.3.199:4123)&amp;amp;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;So, with a simple bash script I was able to run few socat daemons on destination server with different ports and feed them from source server to achieve higher data transer rate.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7745660372894226773?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7745660372894226773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7745660372894226773' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7745660372894226773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7745660372894226773'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/07/fast-copy-on-unix-systems.html' title='Fast Copy on Unix systems'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-5969427329682329867</id><published>2009-06-08T09:13:00.000-07:00</published><updated>2009-06-08T10:10:10.296-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bash'/><title type='text'>socket programming with Bash</title><content type='html'>I have many memcached servers around. So, I needed a tool to check status information on these servers like top utility. I decided to write it in bash scripting language (100% in bash except printf,date and sleep commands :) ). You can simply enhance the script for example getting server names and ports from a config file or display interval parameter from command line.  Memcached supports tcp and udp protocols for communication with clients. I used tcp communication in my bash script. Here is information about &lt;a href="http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt"&gt;Memcached's supported server commands&lt;/a&gt;. My example script uses "stats" command. Here is sample output for "stats" command from one memcached server. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/Si07smyDUOI/AAAAAAAAAMg/MPQ5ibYim0w/s1600-h/memcache.jpg"&gt;&lt;img style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 320px; height: 224px; text-align: center; " src="http://1.bp.blogspot.com/_bOa3aOPXCQo/Si07smyDUOI/AAAAAAAAAMg/MPQ5ibYim0w/s320/memcache.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5344993970269409506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have used the information provided by "stats" command. Script uses pure bash builtin commands to access a tcp server like memcached.&lt;br /&gt;&lt;br /&gt;You can download the script from &lt;a href="http://lserinol.googlepages.com/memcache_stats.sh"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is sample output from the script.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/Si09Oyz43BI/AAAAAAAAAMo/pNaJvXITwN0/s1600-h/stats.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 224px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/Si09Oyz43BI/AAAAAAAAAMo/pNaJvXITwN0/s320/stats.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5344995657125518354" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you're using Ubuntu, probably you will not be able to run this script, because bash is not compiled with "--enable-net-redirections" parameter on Ubuntu systems. RedHat based distributions has no problem with bash net-directions like Fedora,Centos and RedHat ES.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-5969427329682329867?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/5969427329682329867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=5969427329682329867' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5969427329682329867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5969427329682329867'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/06/socket-programming-with-bash.html' title='socket programming with Bash'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/Si07smyDUOI/AAAAAAAAAMg/MPQ5ibYim0w/s72-c/memcache.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-140625370549586113</id><published>2009-05-31T02:06:00.000-07:00</published><updated>2009-05-31T02:58:44.931-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Mirroring your OpenSolaris root disk with ZFS</title><content type='html'>Solaris/OpenSolaris supports booting with ZFS filesystem. For example, if you look into your opensolaris insallation you'll notice the zfs rpool (root pool). ZFS is default filesystem on opensolaris (optional with Solaris). If you look into detailts of that pool with zpool utility , you'll see that it's a single disk or a partition (depends how you partitioned your disk on installation process of opensolaris). If that single disk crashes, you may lost your data and operating system.That's one point of failure. The simple solution is to convert our zpool into &lt;a href="http://en.wikipedia.org/wiki/RAID_1#RAID_1"&gt;RAID-1&lt;/a&gt; with a secondary disk (with same capacity or bigger one). &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJTIl98LdI/AAAAAAAAAMA/5YJ9Xpvu-8U/s1600-h/zpool1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5341923515110796754" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 256px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJTIl98LdI/AAAAAAAAAMA/5YJ9Xpvu-8U/s320/zpool1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As you can see, our zpool contains a single disk called c4t0d0. Let's add a new disk to our rpool to convert it into mirror. zpool will do it automatically for us. One important point here is that  Solaris doesn't support boot devices to be in EFI label format. So, if your new disk label is in EFI format, you need to convert it into SMI label. So, I'll use fdisk command to create a Solaris2 partition and remove any EFI labels if present. My new disk name is c4t1d0.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJQBiTYujI/AAAAAAAAALg/GaxL2Nsif5I/s1600-h/zpool3.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5341920095333038642" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 256px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJQBiTYujI/AAAAAAAAALg/GaxL2Nsif5I/s320/zpool3.JPG" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;After creating the partition which covers whole disk area, I copied partition map of original rpool member c4t0d0 to our new disk c4t1d0.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SiJQ4dQua8I/AAAAAAAAALo/tKywtDHmyPg/s1600-h/zpool4.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5341921038872505282" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 256px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SiJQ4dQua8I/AAAAAAAAALo/tKywtDHmyPg/s320/zpool4.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Now, it's time to attach our brand new disk into rpool. After attaching the disk, our rpool pool will be converted into mirror (raid-1). Except one thing, the grub boot manager. We need to install it into new disk by hand using installgrub command.&lt;p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SiJRxqfhp5I/AAAAAAAAALw/Plu6JoOsuVw/s1600-h/zpool5.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5341922021676787602" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 256px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SiJRxqfhp5I/AAAAAAAAALw/Plu6JoOsuVw/s320/zpool5.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, we have created our mirror on rpool. It will take time to sync original disk to new disk. You can watch this process by using zpool's status command.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJSPShpy0I/AAAAAAAAAL4/rdXMR9B5d5E/s1600-h/zpool6.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5341922530639334210" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 256px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJSPShpy0I/AAAAAAAAAL4/rdXMR9B5d5E/s320/zpool6.JPG" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-140625370549586113?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/140625370549586113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=140625370549586113' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/140625370549586113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/140625370549586113'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/05/mirroring-your-opensolaris-root-disk.html' title='Mirroring your OpenSolaris root disk with ZFS'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bOa3aOPXCQo/SiJTIl98LdI/AAAAAAAAAMA/5YJ9Xpvu-8U/s72-c/zpool1.JPG' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-8749117064390937596</id><published>2009-05-23T03:21:00.001-07:00</published><updated>2009-05-23T04:24:55.491-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>FreeBSD and procfs</title><content type='html'>Many Unix systems have support for proc file system (process file system).Procfs filesystem type is pseudo. FreeBSD is one of that Unix systems. Unlike Linux, which has information other than  processes, FreeBSD procfs support is only about the processes on the system. FreeBSD doesn't mount the procfs on boot by default. You need to manually add it to fstab for auto mount on boot or mount it by command for temporarily usage.Common mount point for procfs is /proc on Unix systems.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;echo "&lt;/span&gt;none            /proc        procfs  rw   0 0" &gt;&gt; /etc/fsab&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;mount -t procfs none /proc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Every process is presented as directories named by it's pid number on the /proc mount point. &lt;br /&gt;Procfs gives information on running processes on the system like memory mapping,command line arguments of running process, process resource limits and many other.Following is a sample procfs directory structure on a FreeBSD machine.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/ShfRihkaVWI/AAAAAAAAALQ/CknjYr6WFmM/s1600-h/mount_procfs_ls.jpeg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 224px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/ShfRihkaVWI/AAAAAAAAALQ/CknjYr6WFmM/s320/mount_procfs_ls.jpeg" border="0" alt=""id="BLOGGER_PHOTO_ID_5338966274327860578" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As you can see, every pid is represented as a directory in procfs.  Every directory contains following files. Some of the files are write only or read only where you read information or send information to process. &lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;&lt;br /&gt;- status  (read-only) : returns process status&lt;br /&gt;- mem     (read/write): virtual memory image of the process&lt;br /&gt;- file    (depends)   : symbolic link to running process&lt;br /&gt;- regs    (read/write): process registers&lt;br /&gt;- ctl     (write-only): used to send signal to process or &lt;br /&gt;                        attach/deattach it for debugging&lt;br /&gt;- cmdline (read-only) : command line arguments of running process&lt;br /&gt;- rlimits (read-only) : current resource limits of running process&lt;br /&gt;- map     (read-only) : memory mappings of the running process.&lt;br /&gt;- etype   (read-only) : type of the executable (eg. FreeBSD ELF32)&lt;br /&gt;- fpregs  (read/write): floating point registers &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some of the information provided by these files are in binary format.For example "regs"  and "fpregs" files are in binary format. They depend on the architecture of the underlying machine (i386, amd64,sparc64,etc..). Following is the format of the "regs" file on the i386 machine.&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;&lt;br /&gt;struct reg {&lt;br /&gt;        unsigned int    r_fs;&lt;br /&gt;        unsigned int    r_es;&lt;br /&gt;        unsigned int    r_ds;&lt;br /&gt;        unsigned int    r_edi;&lt;br /&gt;        unsigned int    r_esi;&lt;br /&gt;        unsigned int    r_ebp;&lt;br /&gt;        unsigned int    r_isp;&lt;br /&gt;        unsigned int    r_ebx;&lt;br /&gt;        unsigned int    r_edx;&lt;br /&gt;        unsigned int    r_ecx;&lt;br /&gt;        unsigned int    r_eax;&lt;br /&gt;        unsigned int    r_trapno;&lt;br /&gt;        unsigned int    r_err;&lt;br /&gt;        unsigned int    r_eip;&lt;br /&gt;        unsigned int    r_cs;&lt;br /&gt;        unsigned int    r_eflags;&lt;br /&gt;        unsigned int    r_esp;&lt;br /&gt;        unsigned int    r_ss;&lt;br /&gt;        unsigned int    r_gs;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can use "cat" command to read information provided by procfs for text based information unlike the ones I mentioned above in binary format like "regs","fpregs" and "mem". &lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;&lt;br /&gt;[root@freebsd ]# cat cmdline &lt;br /&gt;/usr/sbin/moused-p/dev/ums0-tauto-I/var/run/moused.ums0.pid&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can check a running process's resource limits by looking into rlimit file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;&lt;br /&gt;[root@freebsd ]# cat rlimit &lt;br /&gt;cpu -1 -1&lt;br /&gt;fsize -1 -1&lt;br /&gt;data 536870912 536870912&lt;br /&gt;stack 67108864 67108864&lt;br /&gt;core -1 -1&lt;br /&gt;rss -1 -1&lt;br /&gt;memlock -1 -1&lt;br /&gt;nproc 5547 5547&lt;br /&gt;nofile 11095 11095&lt;br /&gt;sbsize -1 -1&lt;br /&gt;vmem -1 -1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;First digits is minimum and last one is maximum values of the given resource name. "-1" means infinite. For examle, nofile (open file descriptor) limit for this process is 11095 as minimum and maximum.&lt;br /&gt;&lt;br /&gt;"status" file gives information about process status as follows.&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;- command name&lt;br /&gt;- pid&lt;br /&gt;- parent pid&lt;br /&gt;- process group id&lt;br /&gt;- session id&lt;br /&gt;- major/minor of the terminal, "-" if no terminal is in action&lt;br /&gt;- process flags&lt;br /&gt;- process start time in seconds and microseconds separated by comma&lt;br /&gt;- user time in seconds and microseconds separated by comma&lt;br /&gt;- system time in seconds and microseconds separated by comma&lt;br /&gt;- wait channel name&lt;br /&gt;- effective userid and group lists separated by comma&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Following is "cat status" result of a process.&lt;br /&gt;&lt;pre style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; BORDER-LEFT: gray 1px solid; PADDING-TOP: 10px; overflow:scroll;white-space:nowrap;height:40px;BORDER-BOTTOM: gray 1px solid"&gt;[root@freebsd ]# cat status &lt;br /&gt;svscan 28246 1 28245 0 ttyp0 noflags 1242921860,839572 0,318052 3,263576 nanslp 0 0 0,0,0,5 -&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-8749117064390937596?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/8749117064390937596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=8749117064390937596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8749117064390937596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8749117064390937596'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/05/freebsd-and-procfs.html' title='FreeBSD and procfs'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bOa3aOPXCQo/ShfRihkaVWI/AAAAAAAAALQ/CknjYr6WFmM/s72-c/mount_procfs_ls.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6823439439113643835</id><published>2009-05-16T04:49:00.000-07:00</published><updated>2009-05-16T06:08:44.576-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sun'/><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Configuring ILOM manager on Sun X4540 Thumper</title><content type='html'>&lt;a href="http://www.sun.com/servers/x64/x4540/"&gt;Sun X4540 Thumper&lt;/a&gt;  storage server provides 48TB hard disk  capacity on one server. It has 2 AMD Quad x64 Opteron processors and 32GB of memory. Thumper has 48 hard disk slots. You can use 1TB sata hard disks in each slot. This will give you 48TB hard disk area as you can see in following photo.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sg6tS6osCMI/AAAAAAAAAKw/dUXK54J0nuo/s1600-h/IMG_3753.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sg6tS6osCMI/AAAAAAAAAKw/dUXK54J0nuo/s320/IMG_3753.jpg" alt="" id="BLOGGER_PHOTO_ID_5336393148969781442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;You can run Solaris,OpenSolaris, Linux and Windows operating systems on Thumper. Thumper includes  Sun Microsystem's &lt;a href="http://www.sun.com/systemmanagement/ilom.jsp"&gt;ILOM&lt;/a&gt; (Sun Integrated Lights Out Manager) manager. You can use ILOM to upgrade your server's firmware, remotely accessing your server's console by using your web browser, modify and see sensors, see hardware components and so on.  You can access ILOM by using a serial console,ssh client or a web browser.You need to set an ip address for your ILOM manager if you need to use ssh or a web browser.If you don't have a dhcp server around you'll need to configure your ILOM manager with a static ip address. I have used a serial console connected on Thumpers "Ser MGT" port and on the other side a linux desktop and minicom application. You need to change your minicom settings to 9600 baud rate , 8 data bits, no parity and one stop bit (9600-8-N-1) with no hardware and software flow control.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/Sg6xRpZC-CI/AAAAAAAAAK4/9jv9Br3cUFE/s1600-h/ilom1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 183px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/Sg6xRpZC-CI/AAAAAAAAAK4/9jv9Br3cUFE/s320/ilom1.png" alt="" id="BLOGGER_PHOTO_ID_5336397525207414818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Yes, that's right, It's Linux :) . Sun ILOM uses embeded Linux.  When you connect to ILOM by a serial console you will need to login in by using ILOM's factory default  login name "root" and password "changeme". ILOM has a simple built-in command interface. You can use "help" command for details when you logged in ILOM manager. Setting the static ip address of ILOM is simple. I captured the screenshot when I gave one of my local ip addresses to Thumper's ILOM.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/Sg6zGpFIaUI/AAAAAAAAALA/yJF_ToRm1sM/s1600-h/ilom2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 183px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/Sg6zGpFIaUI/AAAAAAAAALA/yJF_ToRm1sM/s320/ilom2.png" alt="" id="BLOGGER_PHOTO_ID_5336399535168579906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After, you commit your static ip network settings settings with "set commitpending=true" command, you need to connect Thumper's "net mgt" ethernet interface to your network.Now, you can access ILOM by using any ssh client or a web browser. My plan is to use OpenSolaris and 48TB ZFS Raid-Z on this storage server and see the results on a production environment :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6823439439113643835?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6823439439113643835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6823439439113643835' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6823439439113643835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6823439439113643835'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/05/configuring-ilom-manager-on-sun-x4540.html' title='Configuring ILOM manager on Sun X4540 Thumper'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/Sg6tS6osCMI/AAAAAAAAAKw/dUXK54J0nuo/s72-c/IMG_3753.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6048167491758673906</id><published>2009-05-03T01:35:00.000-07:00</published><updated>2009-05-03T04:09:23.402-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>getting detailed process information on Freebsd</title><content type='html'>Freebsd &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=procstat&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+7.1-RELEASE&amp;format=html"&gt;procstat&lt;/a&gt; utility gives detailed information about all of the processes on the system or just for a given process id number, such as virtual memory mapping, thread stack, command line arguments and open files.&lt;br /&gt;&lt;br /&gt;Running procstat with "-a" argument prints information like pid,pid,login, process name, wchan (which event the process waiting) of all processes on the system.&lt;br /&gt;&lt;br /&gt;# procstat -a &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf14zVTtsqI/AAAAAAAAAKQ/7QHsvOJvKBQ/s1600-h/procstat_a.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf14zVTtsqI/AAAAAAAAAKQ/7QHsvOJvKBQ/s320/procstat_a.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5331550357165028002" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Procstat "-c" option shows you the command line arguments of a process and "-f" option shows opened files by given process.Following sample output shows the command line arguments and the files currently opened with their permissions by vi process.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf15Ivvw7mI/AAAAAAAAAKY/tDbXabD1eEY/s1600-h/procstat_vi.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf15Ivvw7mI/AAAAAAAAAKY/tDbXabD1eEY/s320/procstat_vi.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5331550725039255138" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can access virtual memory mapping information a process with "-v" option. Following sample shows vi process virtual memory mappings.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sf16I_g595I/AAAAAAAAAKg/nMw2fYOhYbI/s1600-h/procstat_v.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sf16I_g595I/AAAAAAAAAKg/nMw2fYOhYbI/s320/procstat_v.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5331551828783527826" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Finally, "-k" option shows kernel threads stacks details of given process.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sf169eePLAI/AAAAAAAAAKo/Bsoi6rUW8bQ/s1600-h/procstat_k.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sf169eePLAI/AAAAAAAAAKo/Bsoi6rUW8bQ/s320/procstat_k.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5331552730447031298" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6048167491758673906?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6048167491758673906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6048167491758673906' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6048167491758673906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6048167491758673906'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/05/getting-detailed-process-information-on.html' title='getting detailed process information on Freebsd'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf14zVTtsqI/AAAAAAAAAKQ/7QHsvOJvKBQ/s72-c/procstat_a.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-2446335216875429259</id><published>2009-05-03T00:18:00.000-07:00</published><updated>2009-05-03T01:22:15.233-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>watching interrupt usage on Freebsd</title><content type='html'>You can easily see how many interrupts taken by each device on Linux by simply looking in /proc/interrupts file. Freebsd has no such information in procfs. But you can access the same information by using "vmstat -i" command in Freebsd.But you can't see which cpu handling which irq as shown by Linux. Following is a sample output of "vmstat -i" command from a Freebsd machine.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf1HwjmkqFI/AAAAAAAAAJ4/CpL9ZJEiWhI/s1600-h/int.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf1HwjmkqFI/AAAAAAAAAJ4/CpL9ZJEiWhI/s320/int.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5331496433392855122" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can write a simple c shell script to watch interrupt usage like this.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf1IFwTD4jI/AAAAAAAAAKA/6jsKWuljpxQ/s1600-h/interval.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf1IFwTD4jI/AAAAAAAAAKA/6jsKWuljpxQ/s320/interval.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5331496797577929266" /&gt;&lt;/a&gt;Vmstat uses sysctl interface to gather interrupt usage information by using hw.intrnames and hw.intrcnt oid names. As names suggest intrnames holds all interrupt names and intrcnt holds their irq counts since system startup for each interrupt. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/Sf1TxRcQBVI/AAAAAAAAAKI/SfQbAi0xWus/s1600-h/sysctl_hw.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/Sf1TxRcQBVI/AAAAAAAAAKI/SfQbAi0xWus/s320/sysctl_hw.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5331509639837123922" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-2446335216875429259?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/2446335216875429259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=2446335216875429259' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2446335216875429259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2446335216875429259'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/05/watching-interrupt-usage-on-freebsd.html' title='watching interrupt usage on Freebsd'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bOa3aOPXCQo/Sf1HwjmkqFI/AAAAAAAAAJ4/CpL9ZJEiWhI/s72-c/int.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7562377184400280729</id><published>2009-04-24T03:56:00.001-07:00</published><updated>2009-04-24T04:34:48.659-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Linux NFS and "permission denied" mount problem</title><content type='html'>Today, I have faced with following strange nfs mount problem.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;[root@nfsclient ~]# mount /mymount&lt;br /&gt;mount: XXX.XXX.XXX.XXX:/mymount failed, &lt;br /&gt;reason given by server: Permission denied&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;My nfs client is FC4 and nfs server is Centos 4.6.First, I have checked the server from nfs client side by using "showmount -e myserver" command. Exports was okay.After that, I decided to check rpc services on server with "rpcinfo -p" command. &lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;[root@nfsclient ~]# rpcinfo -p myserver&lt;br /&gt;&lt;br /&gt;  program vers proto   port&lt;br /&gt;   100000    2   tcp    111  portmapper&lt;br /&gt;   100000    2   udp    111  portmapper&lt;br /&gt;   100024    1   udp    638  status&lt;br /&gt;   100024    1   tcp    641  status&lt;br /&gt;   100021    1   udp  32768  nlockmgr&lt;br /&gt;   100021    3   udp  32768  nlockmgr&lt;br /&gt;   100021    4   udp  32768  nlockmgr&lt;br /&gt;   100021    1   tcp  32772  nlockmgr&lt;br /&gt;   100021    3   tcp  32772  nlockmgr&lt;br /&gt;   100021    4   tcp  32772  nlockmgr&lt;br /&gt;   100011    1   udp    903  rquotad&lt;br /&gt;   100011    2   udp    903  rquotad&lt;br /&gt;   100011    1   tcp    906  rquotad&lt;br /&gt;   100011    2   tcp    906  rquotad&lt;br /&gt;   100003    2   udp   2049  nfs&lt;br /&gt;   100003    3   udp   2049  nfs&lt;br /&gt;   100003    4   udp   2049  nfs&lt;br /&gt;   100003    2   tcp   2049  nfs&lt;br /&gt;   100003    3   tcp   2049  nfs&lt;br /&gt;   100003    4   tcp   2049  nfs&lt;br /&gt;   100005    1   udp    925  mountd&lt;br /&gt;   100005    1   tcp    928  mountd&lt;br /&gt;   100005    2   udp    925  mountd&lt;br /&gt;   100005    2   tcp    928  mountd&lt;br /&gt;   100005    3   udp    925  mountd&lt;br /&gt;   100005    3   tcp    928  mountd&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Mandatory NFS services was working correctly as seen above rpc report.I didn't have a firewall between these machines or iptables on any of them.This was not the problem also here.I haven't check nfs client side because it was mounting other nfs server's mount points without a problem at all. So, I have focused on nfs server side. Restarting nfsd service or re-exporting nfs file systems with exportfs didn't work out. I can see nfs clients that mounted server's nfs mount by looking in /var/lib/nfs/rmtab file (showmount -a) on server. But I couldn't access /proc/fs/nfsd/ directory. It was not mounted on nfs server.So,I manually mounted it by using following mount command.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;mount -t nfsd nodev /proc/fs/nfsd&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After mounting /proc/fs/nfsd manually, I was able to mount the nfs server from client side again.&lt;br /&gt;&lt;br /&gt;If you look at into /etc/modprobe.conf.dist file, you can see that when kernel installs module nfsd , it mounts /proc/fs/nfsd and /var/lib/nfs/rpc_pipefs mount points.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;install nfsd /sbin/modprobe --first-time --ignore-install nfsd &amp;amp;&amp;amp; &lt;br /&gt;{ /bin/mount -t nfsd nfsd /proc/fs/nfsd &gt; /dev/null 2&gt;&amp;amp;1 || :; }&lt;br /&gt;install sunrpc /sbin/modprobe --first-time --ignore-install sunrpc &amp;amp;&amp;amp; &lt;br /&gt;{ /bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs &gt; &lt;br /&gt;/dev/null 2&gt;&amp;amp;1 || :; }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7562377184400280729?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7562377184400280729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7562377184400280729' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7562377184400280729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7562377184400280729'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/04/linux-nfs-and-permission-denied-mount.html' title='Linux NFS and &quot;permission denied&quot; mount problem'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7955896092227570520</id><published>2009-04-14T15:18:00.000-07:00</published><updated>2009-04-14T16:21:18.168-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Process IO Top utility with Solaris DTrace</title><content type='html'>&lt;a href="http://www.sun.com/software/solaris/ds/dtrace.jsp"&gt;DTrace&lt;/a&gt; is dynamic tracing framework created by Sun Microsystems for Solaris OS. DTrace let's any system administrator or developer to get internal view of how an operating system works, find any system bottlenecks, examine a live system or process, get information on system calls, network internals and many other things.  For this purpose DTrace has many providers for specific tasks. You can get list of the DTrace providers and probe function names by running following command:&lt;br /&gt;&lt;br /&gt;# dtrace -l&lt;br /&gt;&lt;br /&gt;DTrace also adopted to other operating systems like FreeBSD and Mac OS X.  DTrace uses D Language which is subset of C programming language. You can find more information about DTrace on &lt;a href="http://www.sun.com/bigadmin/content/dtrace/"&gt;Sun's BigAdmin Portal&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Following example demostrates you, how easy to find the information you want on Solaris with DTrace.I wrote it to see which files are most written or read by which processes on the Solaris.&lt;br /&gt;&lt;br /&gt;&lt;pre style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; BORDER-LEFT: gray 1px solid; PADDING-TOP: 10px; overflow:scroll;white-space:nowrap;height:500px;BORDER-BOTTOM: gray 1px solid"&gt;&lt;br /&gt;#!/usr/bin/bash&lt;br /&gt;# process_io_top -  show procesess by top read/write KB I/O per file&lt;br /&gt;#      Written by Levent Serinol (lserinol@gmail.com)&lt;br /&gt;#      http://lserinol.blogspot.com&lt;br /&gt;# Apr/14/2009&lt;br /&gt;#&lt;br /&gt;# USAGE: process_io_top [-s interval] [-p pid]&lt;br /&gt;#   &lt;br /&gt;#  -s interval  # gather and show statistics in given interval (seconds)&lt;br /&gt;#  -p pid  # show read/write KB I/O just for given PID&lt;br /&gt;#  -h   # show usage information&lt;br /&gt;#&lt;br /&gt;# eg:&lt;br /&gt;# process_io_top -s 10 &lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;####################################################################################&lt;br /&gt;interval=5&lt;br /&gt;show_pid=0&lt;br /&gt;pid=0&lt;br /&gt;&lt;br /&gt;function usage()&lt;br /&gt;{&lt;br /&gt;echo "&lt;br /&gt;USAGE: io.sh [-s interval] [-p pid]&lt;br /&gt;         -s             # set interval, default is 5 seconds&lt;br /&gt;         -p pid         # pid&lt;br /&gt;  eg, &lt;br /&gt;         io -p 630                # io activity of pid 630&lt;br /&gt;         io -s 10                 # refresh output in every 10 seconds";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;while getopts h:p:s:a name&lt;br /&gt;do&lt;br /&gt;        case $name in&lt;br /&gt;        p)      show_pid=1; pid=$OPTARG ;;&lt;br /&gt;        s)      interval=$OPTARG ;;&lt;br /&gt;        h|?)    usage;&lt;br /&gt;               exit 1&lt;br /&gt;        esac&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;/usr/sbin/dtrace -Cws &amp;lt;( cat &amp;lt;&amp;lt;EOF&lt;br /&gt;&lt;br /&gt; inline int PID  = $pid;&lt;br /&gt; inline int SHOW_PID    = $show_pid;&lt;br /&gt; inline int INTERVAL    = $interval;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#pragma D option quiet&lt;br /&gt;#pragma D option aggsortrev&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dtrace:::BEGIN &lt;br /&gt;{&lt;br /&gt;  secs = INTERVAL;&lt;br /&gt;  printf("Please wait....\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;io:::start &lt;br /&gt;/ (SHOW_PID == 1) &amp;&amp; ( pid == PID) /&lt;br /&gt;{&lt;br /&gt; self-&gt;rw=args[0]-&gt;b_flags &amp; B_READ ? "R" : "W";&lt;br /&gt; @files[pid,execname,self-&gt;rw,args[2]-&gt;fi_pathname] = sum (args[0]-&gt;b_bcount);&lt;br /&gt; @total_blks[self-&gt;rw]=count();&lt;br /&gt; @total_bytes[self-&gt;rw]=sum (args[0]-&gt;b_bcount);&lt;br /&gt; self-&gt;rw=0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;io:::start &lt;br /&gt;/ SHOW_PID == 0 /&lt;br /&gt;/* SHOW_PID == 0 &amp;&amp; args[2]-&gt;fi_pathname != "&amp;lt;none&amp;gt;" */&lt;br /&gt;{&lt;br /&gt; self-&gt;rw=args[0]-&gt;b_flags &amp; B_READ ? "R" : "W";&lt;br /&gt; @files[pid,execname,self-&gt;rw,args[2]-&gt;fi_pathname] = sum (args[0]-&gt;b_bcount);&lt;br /&gt; @total_blks[self-&gt;rw]=count();&lt;br /&gt; @total_bytes[self-&gt;rw]=sum (args[0]-&gt;b_bcount);&lt;br /&gt; self-&gt;rw=0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;profile:::tick-1s&lt;br /&gt;{&lt;br /&gt;        secs--;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;profile:::tick-1s&lt;br /&gt;/secs == 0/&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; trunc(@files,30);&lt;br /&gt; normalize(@files,1024);&lt;br /&gt; system("/usr/bin/clear"); &lt;br /&gt; printf("%Y ",walltimestamp);&lt;br /&gt; printa("%s %@11d blocks, ",@total_blks);&lt;br /&gt; printa("%s %@11d bytes, ",@total_bytes);&lt;br /&gt; printf("\n%6s %-12s %3s %8s %3s\n", "PID", "CMD","R/W", "KB", "FILE");&lt;br /&gt; printa("%6d %-12.12s %1s %@10d %s\n",@files);&lt;br /&gt; secs = INTERVAL;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;dtrace:::END&lt;br /&gt;{&lt;br /&gt;        trunc(@files);&lt;br /&gt;}&lt;br /&gt;EOF&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can download it here &lt;a href="http://lserinol.googlepages.com/process_io_top"&gt;process_io_top&lt;/a&gt;. This scripts briefly shows you how to pass arguments from shell to DTrace. Using aggregations and sort them in reverse order by using pragma "aggsortrev". Defining probes (io:::start) more than once with different predicate conditions. Following is a sample output from process_io_top script.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SeUaRhzrxsI/AAAAAAAAAJw/59WQekAuwbE/s1600-h/process_io_top.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SeUaRhzrxsI/AAAAAAAAAJw/59WQekAuwbE/s320/process_io_top.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5324691022870726338" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7955896092227570520?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7955896092227570520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7955896092227570520' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7955896092227570520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7955896092227570520'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/04/process-io-top-utility-with-solaris.html' title='Process IO Top utility with Solaris DTrace'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SeUaRhzrxsI/AAAAAAAAAJw/59WQekAuwbE/s72-c/process_io_top.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1004179434301193019</id><published>2009-03-30T23:51:00.000-07:00</published><updated>2009-03-31T02:13:15.522-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nginx'/><title type='text'>speeding up your nginx server with memcached</title><content type='html'>&lt;a href="http://nginx.net/"&gt;Nginx&lt;/a&gt; is a high performance web and proxy  (web and mail proxy) server. Generally, nginx is used as a front-end proxy server to &lt;a href="http://httpd.apache.org"&gt;Apache&lt;/a&gt; webserver. Nginx is known to be slow while serving dynamic pages like php. Normally, nginx is using fast-cgi method which is slow. Therefore, it's a good idea to run Apache as back-end server to Nginx and serve dynamic php pages from Apache. If your website's php pages suitable to cache for a certain time, you can use Nginx proxy module and proxy_store command to cache Apache served php pages output in Nginx automatically as html.  Here, I'll give you instructions how to use &lt;a href="http://wiki.nginx.org/NginxHttpMemcachedModule"&gt;Nginx's memcache module&lt;/a&gt; and Danga Software's &lt;a href="http://www.danga.com/memcached/"&gt;memcached deamon&lt;/a&gt; to store your content in memory and serve it. Serving content from memory will be faster than serving it from disk. memcached's default listening port is 11211. You can find instructions on Danga Software's website how to compile and run memcached.&lt;br /&gt;&lt;br /&gt;Now, we can look our Nginx configuration for memcache implementation. Let's suppose we have two Apache webservers running on two different physical servers. IP addresses of the Apache webservers are 192.168.2.3 and 192.168.2.4. We'll use those Apache webservers as back-end servers. We have a Nginx server as front-end to them on 192.168.2.1 ip adress. First of all, we have to tell Nginx about those back-end servers. We use &lt;a href="http://wiki.nginx.org/NginxHttpUpstreamModule"&gt;Nginx upstream module&lt;/a&gt; for this purpose. As you can see below, we defined a upstream named "backend". The configuration has our two Apache webservers ip addresses. Upstream module let's you also give weight to each server in configuration. Our first server's hardware configuration is better than the second one, so we gave the first one weight value 2. This configuration should be in http section of Nginx configration file (nginx.conf).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;upstream backend {&lt;br /&gt;     server 192.168.2.3 weight=2;&lt;br /&gt;     server 192.168.2.4;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We have created our upstream configuration. Now, we have to tell Nginx, which files will be server by memcache module. I have decided to only serve some image types by memcache. The following configuration part should be in server section of Nginx configuration. The "location"  directive tell's the nginx to handle every file which ends with given extensions like .jpg,.png and .gif in url. As first step, Nginx will check the url in memcached. Memcached is simple key value memory database.  Every row has a unique key.In our case the key is our url. If Nginx, finds the key (url) in memcached, it will get contents of the key from mecached and send it back to client. This operation is running completely from memory. In case  that the key (url) not found, it will fallback to 404 and as you can see, we catch 404 error and send request  to our back-end Apache servers. Nginx will then send Apache's response to client.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;location ~* \.(jpg|png|gif)$ {&lt;br /&gt;access_log   off;&lt;br /&gt;expires      max;&lt;br /&gt;add_header   Last-Modified "Thu, 26 Mar 2000 17:35:45 GMT";&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;set $memcached_key $uri;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;memcached_pass     127.0.0.1:11211;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;error_page         404 = /fetch;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;location /fetch {&lt;/span&gt;&lt;br /&gt;internal;&lt;br /&gt;access_log   off;&lt;br /&gt;expires      max;&lt;br /&gt;add_header   Last-Modified "Thu, 26 Mar 2000 17:35:45 GMT";&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;proxy_pass http://backend;&lt;/span&gt;&lt;br /&gt;break;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Of course, we have a drawback here. Nginx's memcache module never put anything automatically in memcached. You have to store your information in it manually by using something like a script. Considering our example, if we forget to store information about a file in memcached, it will be always served by back-end Apache servers. Here is a simple php script, which finds given image types and deploy it into memcached for Nginx.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid gray; padding: 10px;"&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;function rscandir($base='', &amp;amp;$data=array()) {&lt;br /&gt;$array = array_diff(scandir($base), array('.', '..'));&lt;br /&gt;&lt;br /&gt;foreach($array as $value) :&lt;br /&gt;  if (is_dir($base.$value)) {&lt;br /&gt;    $data = rscandir($base.$value.'/', $data);&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;  elseif (is_file($base.$value)) {&lt;br /&gt;   $rest = substr($value, -4);&lt;br /&gt;   if ((!strcmp($rest,'.jpg')) || (!strcmp($rest,'.png'))&lt;br /&gt;                                || (!strcmp($rest,'.gif')) ){&lt;br /&gt;         $data[] = $base.$value;&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;endforeach;&lt;br /&gt;return $data;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$mylist=rscandir("/var/www/mysite");&lt;br /&gt;&lt;br /&gt;$srch = array('/var/www/mysite');&lt;br /&gt;$newval = array('');&lt;br /&gt;&lt;br /&gt;$memcache_obj = memcache_connect("192.168.2.1", 11211);&lt;br /&gt;&lt;br /&gt;while (list($key, $val) = each($mylist)) {&lt;br /&gt;  $url=str_replace($srch,$newval,$val);&lt;br /&gt;  echo "$key =&gt; $val -&gt; ".filesize($val)."\n";&lt;br /&gt;  $value = file_get_contents($val);&lt;br /&gt;  memcache_add($memcache_obj, $url, $value, false, 0);&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You need to run this script one time, it will find all given image types and store them into memcached. I run this on one of the Apache  back-end servers. It will store data into memcached. This memcached is located on Nginx server which ip address is 192.168.2.1 .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1004179434301193019?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1004179434301193019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1004179434301193019' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1004179434301193019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1004179434301193019'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/03/speeding-up-your-nginx-server-with.html' title='speeding up your nginx server with memcached'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-9088667322603910227</id><published>2009-03-22T03:31:00.000-07:00</published><updated>2009-03-22T05:28:14.387-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DragonFly BSD'/><title type='text'>Hammer Filesystem</title><content type='html'>On Feb 17 2009, new &lt;a href="http://www.dragonflybsd.org/release22/"&gt;release 2.2 of DragonFly BSD&lt;/a&gt; released which includes a new filesystem called &lt;a href="http://www.dragonflybsd.org/hammer/"&gt;hammer&lt;/a&gt;. Hammer is a new filesystem which intented to replace ffs on DragonFly systems. Hammer filesystem has many advanced futures compared to ffs filesystem like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;instant crash recovery&lt;/li&gt;&lt;li&gt;large file systems and multivolume support&lt;/li&gt;&lt;li&gt;data integrity checking&lt;/li&gt;&lt;li&gt;history and snapshots&lt;/li&gt;&lt;li&gt;reblocking (on the fly defragmentation)&lt;/li&gt;&lt;li&gt;mirroring&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Let's start by creating a new hammer filesystem on a new disk device by using hammer's &lt;a href="http://leaf.dragonflybsd.org/cgi/web-man?command=newfs_hammer&amp;amp;section=8"&gt;newfs_hammer&lt;/a&gt; command. As you can see below, we used the '-L' parameter. Every hammer filesystem requires a label name and it's mandatory.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/ScYf3GmkkPI/AAAAAAAAAIg/8dq2B20AaUk/s1600-h/hammer_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/ScYf3GmkkPI/AAAAAAAAAIg/8dq2B20AaUk/s320/hammer_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315971441683108082" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Let's mount in under /mnt directory by using "noatime" option.  &lt;a href="http://leaf.dragonflybsd.org/cgi/web-man?command=mount_hammer&amp;amp;section=8"&gt;mount_hammer&lt;/a&gt; command must be used for this operation.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYgawL4sLI/AAAAAAAAAIo/_Jln3EUNeP0/s1600-h/hammer_2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYgawL4sLI/AAAAAAAAAIo/_Jln3EUNeP0/s320/hammer_2.JPG" alt="" id="BLOGGER_PHOTO_ID_5315972054140891314" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Looking to df output you can see our new hammer filesystem labeled as "mydata". Now, let's see where hammer filesystem differs from ffs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;History feature&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;History metadata of a hammer filesystem is written on every 30 seconds. You can use &lt;a href="http://leaf.dragonflybsd.org/cgi/web-man?command=hammer&amp;amp;section=8"&gt;hammer&lt;/a&gt; utility to access your files history data. Usage is simple as, calling hammer utility with history command and given your file name which you want to see whole history.&lt;br /&gt;&lt;br /&gt;# hammer history /mnt/test.txt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYh9JyPn6I/AAAAAAAAAIw/BsA7-yWk6LA/s1600-h/history_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYh9JyPn6I/AAAAAAAAAIw/BsA7-yWk6LA/s320/history_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315973744639844258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;You may be noticed that I have used "sync" command, because I didn't want to wait the the kernel sync operation occur (30 seconds) and forced it by using sync comand to get history result fast.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Snapshot feature&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now let's see hammer's snapshot feature. I have created a directory called "/snapshots" where I want to keep all of my hammer filesystem snaphosts. We'll use hammer utility for taking snapshots.&lt;br /&gt;&lt;br /&gt;# hammer snapshot   /mnt    /snapshots/mnt_snapshot1&lt;br /&gt;&lt;br /&gt;I have created a file on /mnt filesystem and took a snapshot. After a sucsessful snapshot, I deleted the original file from /mnt and accessed it by using the snapshot I took before deleting the file (/snapshots/mnt_snapshot1/test.txt).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/ScYk3QTnPlI/AAAAAAAAAJI/O7SQGluK3Lc/s1600-h/snapshot_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/ScYk3QTnPlI/AAAAAAAAAJI/O7SQGluK3Lc/s320/snapshot_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315976941846085202" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Undo Feature&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can see and rollback every change between the taken snapshots and original files by using hammer's &lt;a href="http://leaf.dragonflybsd.org/cgi/web-man?command=undo&amp;amp;section=1"&gt;undo&lt;/a&gt; command. You can use "-d" option to get diff output to see every changes on the given file line by line between every snapshot and original one. Also, "-a" option gives you whole change history of given file. Here, I created a test file called "myfile.txt" under my new hammer filesystem (/mnt) and then took a snapshot. After taking snapshot, I added one more line to my test file and used "undo -d /mnt/myfile.txt" to get diff output and see what changes made the file between snapshots.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/ScYrCkcPV8I/AAAAAAAAAJo/iAcKJwSH4rQ/s1600-h/undo_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/ScYrCkcPV8I/AAAAAAAAAJo/iAcKJwSH4rQ/s320/undo_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315983733299304386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Mutivolume Feature &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As I mentioned above, you can use multi volumes and create a big disk volume with hammer filesystem.  Now, we'll create a single hammer volume by using two disks (ad1 and ad3).&lt;br /&gt;You just call  newfs_hammer and mount_hammer commands by only giving two or more disk device names instead of one.Commands are straight forward. First, we need to create new hammer filesystem on disks.&lt;br /&gt;&lt;br /&gt;# newfs_hammer -L big /dev/ad1 /dev/ad3&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/ScYjaHBupXI/AAAAAAAAAI4/ExLrJ4mYrng/s1600-h/multi_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/ScYjaHBupXI/AAAAAAAAAI4/ExLrJ4mYrng/s320/multi_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315975341627319666" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have used to disks and each size is 8GB. After creating new hammer filesystems on disks , we can mount them as one big volume. (I know 8GB is not big :) ).&lt;br /&gt;&lt;br /&gt;# mount_hammer /dev/ad1 /dev/ad3 /mnt&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/ScYjxqmPfzI/AAAAAAAAAJA/m56Xkp3aGAI/s1600-h/multi_2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/ScYjxqmPfzI/AAAAAAAAAJA/m56Xkp3aGAI/s320/multi_2.JPG" alt="" id="BLOGGER_PHOTO_ID_5315975746312699698" border="0" /&gt;&lt;/a&gt;You can see on /mnt mount point we have a disk in size 16GB, total of two 8GB disks.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Mirror Feature&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hammer uses Pseudo File Systems (PFS) to  duplicate inode numbers to slaves. Therefore, mount_null command required for this operation. This duplication is triggered by using hammer utlity with mirror-copy parameter. First we need to create two pfs, called for master and slave. I created them as /mymaster and /myslave. Master volume must be created with pfs-master and slave with pfs-slave parameter by using hammer utility. One thing to take in accounting here is that slave pfs must use master's shared-uuid number.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYnpbSikYI/AAAAAAAAAJQ/n5TNT8eun74/s1600-h/mirror_1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYnpbSikYI/AAAAAAAAAJQ/n5TNT8eun74/s320/mirror_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315980002811089282" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After creating mymaster and myslave pfs we have to use mirror-copy to start initial mirroring operation by using these pfs links , because mount_null can't access them without this copy operation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/ScYoTqHwJsI/AAAAAAAAAJY/mK6QnjEg38c/s1600-h/mirror_2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/ScYoTqHwJsI/AAAAAAAAAJY/mK6QnjEg38c/s320/mirror_2.JPG" alt="" id="BLOGGER_PHOTO_ID_5315980728346879682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;After,  running  first mirror copy operation on our pfs links, we can mount our original hamme volumes where we want and associate them with the pfs links we created and  sync (mirror-copy)  our mounted hammer volumes.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYozvqFgRI/AAAAAAAAAJg/IVs0WNWN9z0/s1600-h/mirror_3.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/ScYozvqFgRI/AAAAAAAAAJg/IVs0WNWN9z0/s320/mirror_3.JPG" alt="" id="BLOGGER_PHOTO_ID_5315981279588876562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;You can use mount_null mount points to do your filesystems operations. You can see that slave volume (myslave) is read-only and you don't have write access to it. You can only use master volume (mymaster) to make your write operations.If you're looking an alternative filesystem to ffs on BSD systems, I suggest you to evaluate both ZFS on FreeBSD  and Hammer on DragonFly BSD.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-9088667322603910227?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/9088667322603910227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=9088667322603910227' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9088667322603910227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9088667322603910227'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/03/hammer-filesystem.html' title='Hammer Filesystem'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/ScYf3GmkkPI/AAAAAAAAAIg/8dq2B20AaUk/s72-c/hammer_1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-8737479284380006041</id><published>2009-03-16T12:52:00.000-07:00</published><updated>2009-03-16T13:31:26.098-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>xfs filesystem fragmentation</title><content type='html'>Many filesystems use many techniques to overcome &lt;a href="http://en.wikipedia.org/wiki/File_system_fragmentation"&gt;filesystem fragmentation&lt;/a&gt; and &lt;a href="http://oss.sgi.com/projects/xfs/"&gt;XFS filesystem&lt;/a&gt; is one of them. But in long usage, you may face with fragmentation problems.Here, I will show you how to find fragmentation ratio in your xfs filesystem and how to re-organize your xfs filesystem with xfs_fsr utility to reduce fragmentation on a live xfs filesystem. First, let's check our xfs filesystem's fragmenation ratio using xfs_db (xfs debugger) utility.  As shown below, we used two parameters. First one is "-r", this means that we use debugger in read-only mode. We do not want to accidently do anything bad to our filesystem. Also, this option is useful if we are debugging a mounted filesystem. Second option is "-c" command, which simply takes it's parameter as xfs_db command and run it. Without "-c" parameter, xfs_db will run it's interactive shell where you can run xfs_db commands.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/Sb6yUHKkKqI/AAAAAAAAAIQ/K-UspuGkrnQ/s1600-h/xfs_1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/Sb6yUHKkKqI/AAAAAAAAAIQ/K-UspuGkrnQ/s320/xfs_1.png" alt="" id="BLOGGER_PHOTO_ID_5313880668934253218" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We see that our xfs filesystem on /dev/sdb device has 0.14% fragmentation. This is very low fragmentation. We don't need to defrag it. But here how to do it with  xfs_fsr. This utility re-organizes a xfs filesystem while it's mounted file by file. As you can see in sample below, it runs with "-t" parameter, this tells xfs_fsr utility to run maximum that given seconds and quit.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sb6yaw9UKEI/AAAAAAAAAIY/18d6C1r8-qM/s1600-h/xfs_2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sb6yaw9UKEI/AAAAAAAAAIY/18d6C1r8-qM/s320/xfs_2.png" alt="" id="BLOGGER_PHOTO_ID_5313880783232182338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;There is one more option you can use while using xfs filesystem to avoid future fragmentations. It's called "allocsize", where it  preallocates disk space before writing to a file. You have to set this preallocation size while mounting your xfs filesystem. This will prevent fragmentation on your xfs filesystem if  you give a reasonable size depending on your average file sizes.&lt;br /&gt;&lt;br /&gt;mount -t xfs -o noatime,allocsize=8M /dev/sdb /mydata&lt;br /&gt;&lt;br /&gt;you can also set this option in your /etc/fstab.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; &lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-8737479284380006041?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/8737479284380006041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=8737479284380006041' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8737479284380006041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8737479284380006041'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/03/xfs-filesystem-fragmentation.html' title='xfs filesystem fragmentation'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/Sb6yUHKkKqI/AAAAAAAAAIQ/K-UspuGkrnQ/s72-c/xfs_1.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7236206041988921437</id><published>2009-03-11T15:35:00.000-07:00</published><updated>2009-03-11T16:10:21.254-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>stopping and resuming a process run in Linux</title><content type='html'>You can stop (pause)  a running process by sending "-STOP"  signal via kill command in Linux. You can re-run same stopped process again by sending "-CONT" signal to it. Assume that we have a process to stop and it's pid is 8674. Following, command will stop the running process  id 8674.&lt;br /&gt;&lt;br /&gt;# kill -STOP 8674&lt;br /&gt;&lt;br /&gt;Now the process is stopped, to resume it's running state, you have to send "-CONT" signal.&lt;br /&gt;&lt;br /&gt;# kill -CONT 8674&lt;br /&gt;&lt;br /&gt;In Solaris, you can do the same task by using pstop and prun utilities or you can use kill command and use signals "SIGSTOP" and "SIGCONT".&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7236206041988921437?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7236206041988921437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7236206041988921437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7236206041988921437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7236206041988921437'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/03/stopping-and-resuming-process-run-in.html' title='stopping and resuming a process run in Linux'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7732271604485725385</id><published>2009-03-07T13:25:00.000-08:00</published><updated>2009-03-07T13:46:57.923-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>measuring your network throughput on Solaris</title><content type='html'>You can use &lt;a href="http://www.brendangregg.com/K9Toolkit/nicstat.c"&gt;nicstat&lt;/a&gt; utility to measure your network device utilization and throughput. The utility itself uses solaris kstat for network device statistics information. Statistics include network read and write in kilobytes, packets and device utilization.You can compile nicstat with gcc as shown below.&lt;br /&gt;&lt;br /&gt;# gcc nicstat.c -o nicstat -lkstat -lgen -lsocket&lt;br /&gt;&lt;br /&gt;Following image shows a sample output from nicstat utility.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SbLqwForXkI/AAAAAAAAAHw/yxoJUhAAzWQ/s1600-h/nicstat.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SbLqwForXkI/AAAAAAAAAHw/yxoJUhAAzWQ/s320/nicstat.png" alt="" id="BLOGGER_PHOTO_ID_5310565022490648130" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7732271604485725385?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7732271604485725385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7732271604485725385' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7732271604485725385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7732271604485725385'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/03/measuring-your-network-throughput-on.html' title='measuring your network throughput on Solaris'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/SbLqwForXkI/AAAAAAAAAHw/yxoJUhAAzWQ/s72-c/nicstat.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6546429852767382331</id><published>2009-03-07T12:13:00.000-08:00</published><updated>2009-03-07T12:44:03.266-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>getting network interface statistics on Solaris</title><content type='html'>There are many ways to get network interface status and statistics on Solaris. I'll show some of them. First one is well known command netstat. netstat's "-i" parameter will give you statistics of devices used for ip traffic. Statistics  include input/output total packets,errors and collisions for each  network device.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SbLYEJMXl9I/AAAAAAAAAHI/sbktcUHrm2M/s1600-h/netstat.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SbLYEJMXl9I/AAAAAAAAAHI/sbktcUHrm2M/s320/netstat.png" alt="" id="BLOGGER_PHOTO_ID_5310544476322109394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Next method is by using &lt;a href="http://docs.sun.com/app/docs/doc/816-5166/ndd-1m?l=en&amp;amp;a=view&amp;amp;q=ndd"&gt;solaris ndd&lt;/a&gt; command. First, we have to find our device name. This can be done by ifconfig command.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SbLYtyXTw9I/AAAAAAAAAHQ/PZzY7HmbLUU/s1600-h/ndd_1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SbLYtyXTw9I/AAAAAAAAAHQ/PZzY7HmbLUU/s320/ndd_1.png" alt="" id="BLOGGER_PHOTO_ID_5310545191748486098" border="0" /&gt;&lt;/a&gt;My network device name is "e1000g0" as seen in sample output above. Now, it's time to ask ndd which parameters are supported by this device. We do this by calling ndd (ndd /dev/e1000g0 \?) with our device name and "\?" parameter to display every supported parameter.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SbLZY0id96I/AAAAAAAAAHY/fUjk1KbVJQk/s1600-h/ndd_2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SbLZY0id96I/AAAAAAAAAHY/fUjk1KbVJQk/s320/ndd_2.png" alt="" id="BLOGGER_PHOTO_ID_5310545931066537890" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;ndd let's you change some interface settings. They're marked as "read and write". The parameter names clearly shows what they are for. As you can  see in sample output below, ndd can give us link speed, link status (cable plugged/unplugged),duplex mode and autoneg status. Following sample output shows us that my network interface link status is 1, which means the network cable is plugged,Network speed is 1000mbit and auto negotiation is on.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SbLat_yzoZI/AAAAAAAAAHg/gkcsg0SvNdg/s1600-h/ndd_3.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SbLat_yzoZI/AAAAAAAAAHg/gkcsg0SvNdg/s320/ndd_3.png" alt="" id="BLOGGER_PHOTO_ID_5310547394376737170" border="0" /&gt;&lt;/a&gt;The other command is called &lt;a href="http://docs.sun.com/app/docs/doc/816-5166/dladm-1m?l=en&amp;amp;a=view&amp;amp;q=dladm"&gt;dladm&lt;/a&gt;. dladm can give us above results with one command and in easily readable format. Also, it can give network interface statistics like netstat with "-s" parameter except collisions.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/SbLbUQWo-eI/AAAAAAAAAHo/cuI38gz2HBg/s1600-h/dladm.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/SbLbUQWo-eI/AAAAAAAAAHo/cuI38gz2HBg/s320/dladm.png" alt="" id="BLOGGER_PHOTO_ID_5310548051657030114" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6546429852767382331?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6546429852767382331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6546429852767382331' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6546429852767382331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6546429852767382331'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/03/getting-network-interface-statistics-on.html' title='getting network interface statistics on Solaris'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/SbLYEJMXl9I/AAAAAAAAAHI/sbktcUHrm2M/s72-c/netstat.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1890970290182946349</id><published>2009-02-28T23:32:00.000-08:00</published><updated>2009-03-01T00:28:37.626-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>iptables and connection limit</title><content type='html'>Linux iptables uses a module called ip_conntrack. The name of the module exactly says what it does. It tracks every connection attempt (every connection state) in  a hashed table.Every hash entry contains a linked list. Each linked listed entry is called  a bucket presenting a connection. You can see your machine's current connections by using ip_conntrack module's proc entry.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sao8JaRumeI/AAAAAAAAAGo/i2X6kq4LiYc/s1600-h/Centos5-2009-03-01-09-35-20.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/Sao8JaRumeI/AAAAAAAAAGo/i2X6kq4LiYc/s320/Centos5-2009-03-01-09-35-20.png" alt="" id="BLOGGER_PHOTO_ID_5308121243179719138" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Of course, this table has a default value. It is likely that you will reach this limit on a machine getting high connection rates. First clue will be the following log message on your system logs (/var/log/messages).&lt;br /&gt;&lt;span style="font-family:monospace;"&gt;&lt;br /&gt;&lt;/span&gt;ip_conntrack: table full, dropping packet&lt;br /&gt;&lt;br /&gt;In this case, your machine (iptables) will drop every incoming connection because there is no free hash entry to store any incoming connection (udp or tcp). In this case, there is a configuration option to bump this connection limit to higher values. It's called ip_conntrack_max. It's in /proc filesystem (/proc/sys/net/ipv4/ip_conntrack_max).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/Sao9z12_XDI/AAAAAAAAAGw/coS_Ek7of-E/s1600-h/Centos5-2009-03-01-09-47-36.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/Sao9z12_XDI/AAAAAAAAAGw/coS_Ek7of-E/s320/Centos5-2009-03-01-09-47-36.png" alt="" id="BLOGGER_PHOTO_ID_5308123071649897522" border="0" /&gt;&lt;/a&gt;You can easily increase this number by simply echo 'ing new number in to this file.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/Sao-jMGi0kI/AAAAAAAAAG4/kRXdUXBgITk/s1600-h/Centos5-2009-03-01-09-51-14.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/Sao-jMGi0kI/AAAAAAAAAG4/kRXdUXBgITk/s320/Centos5-2009-03-01-09-51-14.png" alt="" id="BLOGGER_PHOTO_ID_5308123885074567746" border="0" /&gt;&lt;/a&gt;This conntrack tables is divided in linked list entries by hash number as I mention above. The calculation is CONNTRACK_MAX/HASHSIZE. Every hash contains linked lists for connections.This parameter is locted in /sys/module/ip_conntrack/parameters/hashsize. In our case it's default value is 4096. You remember that before changing our default value of conntrack_max, it was 32768. The default hashsize 4096 is produced by 32768/8 calculation. You can tweak this number on your system to increase performance of iptables. Don't forget to put your settings in /etc/sysctl.conf. Because overriding this /proc/ and /sys/ values is only temporary change. There will be gone when  you reboot your machine. The hashsize parameter in /sys/ is called buckets in sysctl conf configuration. Also, check other conntrack parameters via "sysctl net.ipv4.netfilter". By setting some other options like wait time can reduce your entries in conntrack table.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1890970290182946349?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1890970290182946349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1890970290182946349' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1890970290182946349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1890970290182946349'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/iptables-and-connection-limit.html' title='iptables and connection limit'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/Sao8JaRumeI/AAAAAAAAAGo/i2X6kq4LiYc/s72-c/Centos5-2009-03-01-09-35-20.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3750618161707954616</id><published>2009-02-21T01:35:00.000-08:00</published><updated>2009-02-21T02:10:02.969-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Solaris Interrupts</title><content type='html'>In this post, I'll be shown you how to access irq table on a Solaris system and how to get statistics about the number of interrupts produced on Solaris. We'll use two commands intrstat and mdb.&lt;br /&gt;intrstat command shows how many interrupts produced by each device and how many of them handled by each cpu on the system. "%tim" column shows the time where spend by that driver's interrupt handler on processing cpu. You can pass a parameter to intrstat and tell it to gather information in given intervals (in seconds). Following is a sample output of intrstat where it gets statistics in 5 seconds interval.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SZ_NLVYSL3I/AAAAAAAAAGQ/KtBSbqiCrto/s1600-h/solaris_intrstat.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SZ_NLVYSL3I/AAAAAAAAAGQ/KtBSbqiCrto/s320/solaris_intrstat.jpg" alt="" id="BLOGGER_PHOTO_ID_5305184480666988402" border="0" /&gt;&lt;/a&gt;Now, after getting interrupt statistics we can now examine the irq table on Solaris system. For this job, we'll use solaris mdb (Solaris modular debugger). We can access irq table through the kernel. So, we'll pass the "-k" parameter to mdb. This will tell it to get in kernel debugging mode. mdb will use /dev/ksyms and /dev/kmem to access Solaris kernel. After running "mdb -k", type "::interrupts" command to acess irq table in Solaris system. Here is a sample output:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SZ_PgqSj0iI/AAAAAAAAAGY/IKfWKrfhG68/s1600-h/solaris_mdb_interrupts.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SZ_PgqSj0iI/AAAAAAAAAGY/IKfWKrfhG68/s320/solaris_mdb_interrupts.jpg" alt="" id="BLOGGER_PHOTO_ID_5305187046080631330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This table shows us which driver(s) (ISR) using which irq. Share column shows how many devices sharing the same irq. IPL gives irq priority. Type column show irq type used Fixed (legacy), MSI, IPI  interprocessor interrupt (xcalls - cross call).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3750618161707954616?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3750618161707954616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3750618161707954616' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3750618161707954616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3750618161707954616'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/solaris-interrupts.html' title='Solaris Interrupts'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SZ_NLVYSL3I/AAAAAAAAAGQ/KtBSbqiCrto/s72-c/solaris_intrstat.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-4721497570610841880</id><published>2009-02-21T01:11:00.000-08:00</published><updated>2009-02-21T01:22:23.336-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>disk error statistics with Solaris</title><content type='html'>Solaris iostat command normally shows you disk activity statistics and cpu utilization information. But it has another useful option which shows you disk error statistics. Those parameters are "-e" and "-E"."-e" options show summary disk error statistics for soft, hard and trasnportation errors. The other option "-E" shows all errors on the disks and information about the devices like the vendor,model,size and media erros.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SZ_HGoKLIII/AAAAAAAAAGI/EbljmBA97hQ/s1600-h/disk_error_solaris.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SZ_HGoKLIII/AAAAAAAAAGI/EbljmBA97hQ/s320/disk_error_solaris.jpg" alt="" id="BLOGGER_PHOTO_ID_5305177802738966658" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-4721497570610841880?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/4721497570610841880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=4721497570610841880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/4721497570610841880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/4721497570610841880'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/disk-error-statistics-with-solaris.html' title='disk error statistics with Solaris'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bOa3aOPXCQo/SZ_HGoKLIII/AAAAAAAAAGI/EbljmBA97hQ/s72-c/disk_error_solaris.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3257737044834978253</id><published>2009-02-17T05:19:00.001-08:00</published><updated>2009-02-17T05:22:23.821-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Stopping and Running process on the fly with Solaris/OpenSolaris</title><content type='html'>Solaris/OpenSolaris has two utilities called &lt;a href="http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9p2?a=view"&gt;pstop&lt;/a&gt; and &lt;a href="http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9p2?a=view"&gt;prun&lt;/a&gt; which has ability to stop a running process and run it again. Both of the ulities takes pid or pid/lwp (light weight process - thread) as parameter. As the name says, pstop stops a running process when given an pid of a process. Given the same process id of a stopped process to prun , makes the process runnable again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3257737044834978253?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3257737044834978253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3257737044834978253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3257737044834978253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3257737044834978253'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/stopping-and-running-process-on-fly.html' title='Stopping and Running process on the fly with Solaris/OpenSolaris'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3623227235369994986</id><published>2009-02-17T00:19:00.000-08:00</published><updated>2009-02-17T00:36:41.382-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Booting OpenSolaris in verbose mode</title><content type='html'>When OpenSolaris boots it does not show kernel messages on the console by default. You can see them by passing an argument to kernel when booting. OpenSolaris uses grub boot loader. On the grub menu press "e" to enter edit mode.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SZp0WvI4nwI/AAAAAAAAAFo/6KoWMTLTL-4/s1600-h/grub1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SZp0WvI4nwI/AAAAAAAAAFo/6KoWMTLTL-4/s320/grub1.jpg" alt="" id="BLOGGER_PHOTO_ID_5303679445141856002" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Move to the line where kernel parameters are written with cursor keys.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SZp0oQyWWnI/AAAAAAAAAFw/zMU-gfGJvgo/s1600-h/grub2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SZp0oQyWWnI/AAAAAAAAAFw/zMU-gfGJvgo/s320/grub2.jpg" alt="" id="BLOGGER_PHOTO_ID_5303679746231917170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Press "e" again for edit mode for the grub. Than add "-v" parameter to the end of kernel parameters.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SZp1EOW8u3I/AAAAAAAAAF4/rF2LhtIgwsI/s1600-h/grub3.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SZp1EOW8u3I/AAAAAAAAAF4/rF2LhtIgwsI/s320/grub3.jpg" alt="" id="BLOGGER_PHOTO_ID_5303680226616458098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;After adding "-v" verbose parameter to kernel press "enter" and than "b" to boot OpenSolaris with verbose mode enabled.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/SZp1Yx4mawI/AAAAAAAAAGA/yht-TTDwXx0/s1600-h/grub4.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/SZp1Yx4mawI/AAAAAAAAAGA/yht-TTDwXx0/s320/grub4.jpg" alt="" id="BLOGGER_PHOTO_ID_5303680579750226690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;If you need this option to be permanent, you need to modify grub config file in OpenSolaris. It's  located in /boot/grub/menu.lst . If you use zfs root, than it's located in /rpool/boot/grub/menu.lst.You can do this on a Sun Sparc machine with Solaris when the openboot procedure begins by pressing "STOP-A" combination and type "boot -v"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3623227235369994986?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3623227235369994986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3623227235369994986' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3623227235369994986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3623227235369994986'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/booting-opensolaris-in-verbose-mode.html' title='Booting OpenSolaris in verbose mode'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bOa3aOPXCQo/SZp0WvI4nwI/AAAAAAAAAFo/6KoWMTLTL-4/s72-c/grub1.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-761760844237871988</id><published>2009-02-13T05:26:00.000-08:00</published><updated>2009-02-14T04:30:43.950-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>IRQ affinity in Linux</title><content type='html'>Some hardware components like ethernet cards,disk controllers,etc. produces &lt;a href="http://en.wikipedia.org/wiki/Interrupt"&gt;interrupts&lt;/a&gt; when needs to get attention from cpu. For example, when  ethernet card receives packet from network. You can examine your machine's interrupts usage on cpu's by looking in /proc/interrupts proc entry.&lt;br /&gt;&lt;br /&gt;# cat /proc/interrupts&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SZWO0--q71I/AAAAAAAAAFg/Bijuktwg8Uk/s1600-h/interrupts.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 114px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SZWO0--q71I/AAAAAAAAAFg/Bijuktwg8Uk/s320/interrupts.jpg" alt="" id="BLOGGER_PHOTO_ID_5302301177208827730" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This information includes which devices are working on which irq and how many interrupts processed by each cpu for this device.In normal cases, you will not face with a problem and no need to change irq handling process for any cpu.But in some cases, for example if you are running a linux box as firewall which has high incoming or outgoing traffic, this can cause problems. Suppose that you have 2 ethernet cards on your firewall and both ethernet cards handling many packets. In some cases you can see high cpu usage on one of your cpus.This can be caused by many interrupts produced by your network cards. You can check this by looking in /proc/interrupts and see if that cpu is handling interrupts of both cards. If this is the case, what you can do is looking for most idle cpus on your system and specify those ethernet card irqs to be served by each cpu seperately. But beware that you can only do this in a system with IO-APIC enabled device drivers. You can check if your device supports IO-APIC by looking /proc/interrupts.&lt;br /&gt;&lt;br /&gt;In ethernet card case, there is an implementation called &lt;a href="http://en.wikipedia.org/wiki/NAPI"&gt;NAPI&lt;/a&gt; which can reduce interrupt usage on incoming network traffic.&lt;br /&gt;&lt;br /&gt;You can see which irq is served by which cpu or cpus by looking in /proc/irq directory. Directory layout is very simple. For every used irq in system it is presented by a directory by it's irq number.Every directory contains a file called smp_affinity where you can  set cpu settings. File content shows currently which cpu is serving this irq. The value is in hex format. Calculation is shown below.As you can see in example figure, eth0 is on irq 25 and eth1 is in irq 26. Let's say we want to set irq25 to be served only by cpu3. First of all, we have to calculate the value for cpu3 in hex value. Calculation is shown below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Calculation&lt;br /&gt;&lt;pre&gt;            Binary       Hex&lt;br /&gt; CPU 0    0001         1&lt;br /&gt; CPU 1    0010         2&lt;br /&gt; CPU 2    0100         4&lt;br /&gt;+ CPU 3    1000         8&lt;br /&gt; -----------------------&lt;br /&gt; both     1111         f&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;Calculation is shown for 4 cpu system for simplicity. normally the value for all cpus on a system is represented by 8 digit hex value.As you can see in binary format every bit represents a cpu. We see that binary representation of cpu3 is 8 in hex. Then we write it into smp_affinity file for irq 25 as show below.&lt;br /&gt;&lt;br /&gt;# echo 8 &gt; /proc/irq/25/smp_affinity&lt;br /&gt;&lt;br /&gt;You can check the setting by looking in to file content.&lt;br /&gt;&lt;br /&gt;# cat /proc/irq/25/smp_affinity&lt;br /&gt;00000008&lt;br /&gt;&lt;br /&gt;Another example, let's say we want irq25 to handled by cpu0 and cpu1.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;   CPU 0    0001         1&lt;br /&gt;+  CPU 1    0010         2&lt;br /&gt;--------------------------&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;                              0011                        3&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;Setting bit for cpu0 and cpu1 is giving us the value 3.For example if we need all cpus to handle our device's irq, we set every bit in our calculation and write it into smp_affinity as hex value which is F. There is an implementation in Linux called &lt;a href="http://irqbalance.org/"&gt;irqbalance&lt;/a&gt; , where a daemon distributes interrupts automatically for every cpu in the system. But in some cases this is giving bad performance where you need to stop the service and do it manually by yourself as I described above for higher performance.Also, irqbalance configuration let's you to configure where it will not balance given irqs or use specified cpus. In this case you can configure it to not touch your manually configured irqs and your preferred cpus and let it run to automatically load balance rest of the irqs and cpus for you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-761760844237871988?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/761760844237871988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=761760844237871988' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/761760844237871988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/761760844237871988'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/irq-affinity-in-linux.html' title='IRQ affinity in Linux'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SZWO0--q71I/AAAAAAAAAFg/Bijuktwg8Uk/s72-c/interrupts.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-8538412997619757608</id><published>2009-02-10T05:54:00.000-08:00</published><updated>2009-02-10T08:07:29.614-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bash'/><title type='text'>arrays in bash shell  - Part 2</title><content type='html'>In my &lt;a href="http://lserinol.blogspot.com/2009/02/arrays-in-bash-shell.html"&gt;previous post&lt;/a&gt;, I explained basic arrays usage in bash shell. Now, I'll show more advanced topics with bash arrays.Let's create a simple array called myarray.&lt;br /&gt;&lt;br /&gt;# myarray=(first second third fourth)&lt;br /&gt;&lt;br /&gt;Now, assume that you want to learn string length of second element of myarray.&lt;br /&gt;&lt;br /&gt;# echo ${#myarray[1]}&lt;br /&gt;&lt;br /&gt;this will 6  for string "second".Note here that, array indexes are starting from 0. So, 1 index numbers actually is 2nd element of the array.&lt;br /&gt;&lt;br /&gt;Here is another example, this one will skip first element of the array and gives rest of the array.So,following will do the trick.&lt;br /&gt;&lt;br /&gt;# echo ${myarray[@]:1}&lt;br /&gt;&lt;br /&gt;going further with this example.Let's say we want to skip first element and need no more than 2 elements in the array&lt;br /&gt;&lt;br /&gt;# echo ${myarray[@]:1:2}&lt;br /&gt;&lt;br /&gt;result will be "second third".&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Search and Replace&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can search and replace patterns or characters in given array or any array element. &lt;br /&gt;Here is two examples, first one will search all elements of array for character "r" and replace all characters with "R". Second example, will do the same thing but only for 2nd element of the given array.&lt;br /&gt;&lt;br /&gt;# echo ${myarray[@]/r/R}&lt;br /&gt;&lt;br /&gt;# echo ${myarray[1]/r/R}&lt;br /&gt;&lt;br /&gt;Above examples, will only replaces first occurrences, for replacing whole occurrences use double slashes.For example,&lt;br /&gt;&lt;br /&gt;# echo ${myarray[1]//r/R}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Deleting and Adding Array Elements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Deleting any element is very simple. You just have to use "unset" command and give index number of array element.Following, will delete 2nd element of the array.&lt;br /&gt;&lt;br /&gt;# unset myarray[1]&lt;br /&gt;&lt;br /&gt;now our example array will contain "first third fourth" elements.Deleting the whole array is very simple.Don't pass the index number to unset.&lt;br /&gt;&lt;br /&gt;# unset myarray&lt;br /&gt;&lt;br /&gt;Now, Let's a new entry to our array.&lt;br /&gt;&lt;br /&gt;# myarray=("${myarray[@]}" "fifth_element")&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-8538412997619757608?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/8538412997619757608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=8538412997619757608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8538412997619757608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8538412997619757608'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/arrays-in-bash-shell-part-2.html' title='arrays in bash shell  - Part 2'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6516350262415630721</id><published>2009-02-07T04:15:00.000-08:00</published><updated>2009-02-07T04:24:59.458-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bash'/><title type='text'>substring operation with bash</title><content type='html'>You can get a substring (substr) value of an string variable as following in bash.&lt;br /&gt;Syntax is simple ${VARIABLE_NAME:start:length}&lt;br /&gt;&lt;br /&gt;let's assume we have a string variable called mystring and it has the value "test".&lt;br /&gt;&lt;br /&gt;mystring="test"&lt;br /&gt;&lt;br /&gt;If you want to access first character of the string you can use following statement.&lt;br /&gt;c=${mystring:0:1}&lt;br /&gt;&lt;br /&gt;now c value contains "t" character.&lt;br /&gt;&lt;br /&gt;c=${mystring:2:2} &lt;br /&gt;&lt;br /&gt;Now c contains "st" substring.&lt;br /&gt;&lt;br /&gt;Hint: You can calculate the length of a string value as follows.&lt;br /&gt;&lt;br /&gt;${#mystring}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6516350262415630721?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6516350262415630721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6516350262415630721' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6516350262415630721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6516350262415630721'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/substring-operation-with-bash.html' title='substring operation with bash'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3192900765553547761</id><published>2009-02-06T11:24:00.000-08:00</published><updated>2009-02-06T11:45:18.036-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mysql'/><title type='text'>Mysql General Query Log</title><content type='html'>Before Mysql version 5.1.6, you can only log to files what mysqld was doing. 5.1.6 comes with an option where it let's you keep this log in a table called mysql.general_log. Even further, version 5.1.12 came with a new ability to let you disable general query logging on the fly. &lt;br /&gt;&lt;br /&gt;You can enable/disable mysql general query logging by setting global variable "general_log".For example following command, starts general logging on the fly.&lt;br /&gt;&lt;br /&gt;SET GLOBAL general_log = 'ON';&lt;br /&gt;&lt;br /&gt;You have to options, either you can log the queries on in a file where it was the only option before version 5.1.6 , or you can log in the table I mentioned above called mysql.general_log by using global variable "log_output".&lt;br /&gt;The following statement tells mysql to log queries in table mysql.general_log instead of a file.&lt;br /&gt;&lt;br /&gt;set global log_output='table';&lt;br /&gt;&lt;br /&gt;In any time, you can truncate the table to delete it's contents.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SYyTC_ZqZ-I/AAAAAAAAAFQ/yjE7odYcfwg/s1600-h/mysql_1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 50px;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SYyTC_ZqZ-I/AAAAAAAAAFQ/yjE7odYcfwg/s320/mysql_1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5299772541096323042" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After logging the queries, you can see them by simply using a select statement.&lt;br /&gt;&lt;br /&gt;select * from mysql.general_log;&lt;br /&gt;&lt;br /&gt;to make it more readable you can use \G at the end of the query.&lt;br /&gt;select * from mysql.general_log\G;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SYyTLCScVHI/AAAAAAAAAFY/_oH661nPqTc/s1600-h/mysql_2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 190px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SYyTLCScVHI/AAAAAAAAAFY/_oH661nPqTc/s320/mysql_2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5299772679310300274" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3192900765553547761?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3192900765553547761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3192900765553547761' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3192900765553547761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3192900765553547761'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/mysql-general-query-log.html' title='Mysql General Query Log'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/SYyTC_ZqZ-I/AAAAAAAAAFQ/yjE7odYcfwg/s72-c/mysql_1.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-4198181365673167060</id><published>2009-02-06T02:14:00.000-08:00</published><updated>2009-02-06T03:44:45.287-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bash'/><title type='text'>arrays in bash shell</title><content type='html'>BASH shell is very powerful script language. In my previous blog posts, I give some detail about bash regular expression support. In this post, I will give some information about bash array support.&lt;br /&gt;Declaring an array is very simple in bash. Here is some examples.&lt;br /&gt;&lt;br /&gt;# declared an array named called "array" and containing elements.&lt;br /&gt;# "This", "is", "an", "array"&lt;br /&gt;array=(This is an array)&lt;br /&gt;&lt;br /&gt;# declaring an array called a by giving elements one by one.&lt;br /&gt;a[0]="123"&lt;br /&gt;a[1]="abc"&lt;br /&gt;a[2]="xyz"&lt;br /&gt;&lt;br /&gt;# get output of an df -h&lt;br /&gt;&lt;br /&gt;myarray=($(df -h))&lt;br /&gt;&lt;br /&gt;Reading value element of an array is in following syntax ${array[#index_number]}. Please note the curly bracket notation.&lt;br /&gt;&lt;br /&gt;# print element number 2 of array called myarray&lt;br /&gt;echo ${myarray[2]}&lt;br /&gt;&lt;br /&gt;# print all elements&lt;br /&gt;echo ${myarray[*]} &lt;br /&gt;&lt;br /&gt;# print index numbers of array&lt;br /&gt;echo ${!myarray[*]}&lt;br /&gt;&lt;br /&gt;# number of elements in array&lt;br /&gt;echo ${#myarray[*]}&lt;br /&gt;&lt;br /&gt;Here is a simple script using arrays. It simply reports the file systems where disk usage is &lt;br /&gt;over 90% percent.&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;(df -h|grep "^/") | while read d; do&lt;br /&gt;  array=( $d )&lt;br /&gt;  array[4]=${array[4]%\%}&lt;br /&gt;  if [ ${array[4]} -gt 90 ]; then&lt;br /&gt;     echo "${array[5]} is over limit. current size is ${array[4]}%"&lt;br /&gt;     #do whatever you want here, for example send an email to warn sysadmin about high disk usage.&lt;br /&gt;  fi&lt;br /&gt;done&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-4198181365673167060?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/4198181365673167060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=4198181365673167060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/4198181365673167060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/4198181365673167060'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/arrays-in-bash-shell.html' title='arrays in bash shell'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7839714098891098437</id><published>2009-02-03T10:19:00.000-08:00</published><updated>2009-02-03T10:56:21.803-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><title type='text'>Solaris pargs command</title><content type='html'>Solaris &lt;a href="http://docs.sun.com/app/docs/doc/816-0210/6m6nb7mgm?a=view"&gt;pargs&lt;/a&gt; gives you environment and arguments information for any given process id. If you pass just a process id (pid) to pargs, it gives you all argument variables of the running process. If you need to have arguments as a single line for using it with for example on shell use -l argument with it. Also pargs can give you environment information of any running process if you run it with -e parameter.&lt;br /&gt;Sometimes this utility can be handy if you cannot see the parameters or environment variables of a process with other methods like ps or any other well known utilities.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SYiMKHDmVbI/AAAAAAAAAFI/lEhLIAHHdUc/s1600-h/pargs.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SYiMKHDmVbI/AAAAAAAAAFI/lEhLIAHHdUc/s320/pargs.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5298639066922112434" /&gt;pargs&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7839714098891098437?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7839714098891098437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7839714098891098437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7839714098891098437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7839714098891098437'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/02/solaris-pargs-command.html' title='Solaris pargs command'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SYiMKHDmVbI/AAAAAAAAAFI/lEhLIAHHdUc/s72-c/pargs.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-5427734995031764409</id><published>2009-01-30T07:34:00.000-08:00</published><updated>2009-01-31T02:27:30.652-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>FreeBSD kernel profiling with kgmon</title><content type='html'>Sometimes, it's not possible to find a system bottleneck by profiling and debugging user space processess. You have to profile the kernel to pinpoint the perfomance bottleneck. Here, I will show how to configure a freebsd system for kernel profiling and using &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=kgmon&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+7.1-RELEASE&amp;format=html"&gt;kgmon&lt;/a&gt; utility to gather kernel profiling data. kgmon produces &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=gprof&amp;sektion=1&amp;apropos=0&amp;manpath=FreeBSD+7.1-RELEASE"&gt;gprof&lt;/a&gt; compatible output. The default output file is called gmon.out .&lt;br /&gt;&lt;br /&gt;First of all, we need a profiling enabled kernel configured and build. First step is to use &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=config&amp;sektion=8&amp;apropos=0&amp;manpath=FreeBSD+7.1-RELEASE"&gt;config&lt;/a&gt; utility. Now, we need to run config utility from our kernel source configuration directory. I'm using a i386 system. The conf file directory depends on your architecture. &lt;br /&gt;The default directory is /usr/src/sys/ARCH/conf. In my case it's /usr/src/sys/i386/conf/.&lt;br /&gt;We run config utility from where our kernel conf file resides with parameter -p. This tell's the compiler to compile our kernel for low resolution profiling. If we need a high resolution profiling we need to run config with -pp parameter instead of -p. config utility needs a second parameter called SYSTEM_NAME. This is our default system name. FreeBSD's default system name is GENERIC. This can be different on your system, if you build a new kernel with different config file. Older versions of freebsd default GENERIC kernels was not using smp. So it's possible to you have build a new kernel for smp.Therefore you can have a custom build kernel on your system or for another reason. You can see your default system name by using "uname -a" command.&lt;br /&gt;Here is mine is called TESTKERNEL. You'll probably see GENERIC in your case.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SYMjpbZ-JiI/AAAAAAAAAEg/1He4HiqtsnI/s1600-h/generic.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SYMjpbZ-JiI/AAAAAAAAAEg/1He4HiqtsnI/s320/generic.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5297116781356131874" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After learning you SYSTEM NAME, it's now time to configure our kernel source for profiling. The following picture shows you how to run config with -p option on i386 arch with GENERIC system name. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_bOa3aOPXCQo/SYMkgT4_NcI/AAAAAAAAAEo/tvRhaC8xcfQ/s1600-h/config.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/SYMkgT4_NcI/AAAAAAAAAEo/tvRhaC8xcfQ/s320/config.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5297117724231546306" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After running "make cleandepend &amp;&amp; depend" command, we run the "make" command on the same directory and it will built a profiling enabled kernel for us.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SYMlqVQknYI/AAAAAAAAAEw/HEXeouFoEI4/s1600-h/make.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SYMlqVQknYI/AAAAAAAAAEw/HEXeouFoEI4/s320/make.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5297118995909221762" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After the make command, we have build our kernel, now run "make install.debug" command and it will install our debug kernel.&lt;br /&gt;&lt;br /&gt;Now, it's time to reboot our machine. After rebooting check kernel messages for following message to see if build is successful for profiling enabled kernel Addresses should be different but seeing message "Profiling kernel" means it's ok.&lt;br /&gt;&lt;br /&gt;Profiling kernel, textsize=6845824 [c045cbe0..c0ae4160]&lt;br /&gt;&lt;br /&gt;It's time to run kgmon to collect profiling data on our kernel.&lt;br /&gt;&lt;br /&gt;# kgmon -b&lt;br /&gt;&lt;br /&gt;Now kernel profiling is running for low profiling. For high profiling -B option must be used and don't forget you have to use config -pp for high profiling.&lt;br /&gt;You can now, run the application which was causing the problems on your system to profile it, or create the same situation on server where you were having problems.&lt;br /&gt;Now, after creating and seeing the problem, let's kgmon to dump the profiled kernel data.&lt;br /&gt;&lt;br /&gt;# kgmon -p&lt;br /&gt;&lt;br /&gt;As I said before, kgmon will create a file called gmon.out for profiled data in gprof format.&lt;br /&gt;&lt;br /&gt;Now, we gathered our data, we can now stop profiling.&lt;br /&gt;&lt;br /&gt;# kgmon -h&lt;br /&gt;&lt;br /&gt;We collected the data we need. Let's see what the gmon.out file contains.&lt;br /&gt;&lt;br /&gt;# gprof /boot/kernel/kernel gmon.out&lt;br /&gt;&lt;br /&gt;Here is a snippet from gprof output.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/SYQlgZ0SY1I/AAAAAAAAAFA/qRzRqGat2qE/s1600-h/gprof.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/SYQlgZ0SY1I/AAAAAAAAAFA/qRzRqGat2qE/s320/gprof.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5297400300310782802" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'll explain the meaning of the gprof output in another post.&lt;br /&gt;&lt;br /&gt;NOTE: you can apply this technique to other freebsd deriatives like dragonfly bsd and netbsd.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-5427734995031764409?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/5427734995031764409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=5427734995031764409' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5427734995031764409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5427734995031764409'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/01/freebsd-kernel-profiling-with-kgmon.html' title='FreeBSD kernel profiling with kgmon'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SYMjpbZ-JiI/AAAAAAAAAEg/1He4HiqtsnI/s72-c/generic.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-154634923236985806</id><published>2009-01-29T13:00:00.000-08:00</published><updated>2009-01-29T06:33:44.420-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network programming'/><category scheme='http://www.blogger.com/atom/ns#' term='djb tools'/><title type='text'>simple tcp server with djb tcpserver</title><content type='html'>&lt;a href="http://cr.yp.to/ucspi-tcp.html"&gt;DJB ucspi-tcp&lt;/a&gt; package has a program called tcpserver. Simply it accepts incoming tcp connections for a given port and run specified program when a connection established on that port. The good part is that you can write a program in any language which reads stdin and writes data to stdout file descriptors. In this way, you can read data coming from tcp socket simply by stdin file descriptor and send data to tcp client side by writing desired data on stdout file descriptor. &lt;br /&gt;&lt;br /&gt;Here is a simple perl code snippet which reads stdin and writes data to stdout.&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$| = 1;&lt;br /&gt;print "Hello !\r\n";&lt;br /&gt;&lt;br /&gt;while ($line=&amp;lt;STDIN&amp;gt;) {&lt;br /&gt;&lt;br /&gt; print "Your input is:".$line."\r\n";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Let's call this file as simple.pl&lt;br /&gt;Here is the tcpserver command to run this program on port 9090. tcpserver has other parameters such as given uid and gid to running process. Please see tcpserver man page for details.&lt;br /&gt;&lt;br /&gt;# tcpserver -vRH -l test 0 9090 simple.pl&lt;br /&gt;&lt;br /&gt;now, you can telnet your server's 9090 port from another machine and test it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-154634923236985806?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/154634923236985806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=154634923236985806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/154634923236985806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/154634923236985806'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/12/simple-tcp-server-with-djb-tcpserver.html' title='simple tcp server with djb tcpserver'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3721691574571790032</id><published>2009-01-29T00:43:00.000-08:00</published><updated>2009-01-29T02:33:04.892-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>lsof alternatives on FreeBSD</title><content type='html'>&lt;a href="http://people.freebsd.org/~abe/"&gt;lsof&lt;/a&gt; is a utility which gives information about open sockets/files/pipes on many unix systems. You can easily install lsof and try it on your freebsd installation by using pkg_add command.&lt;br /&gt;&lt;br /&gt;# pkg_add -r lsof&lt;br /&gt;&lt;br /&gt;But FreeBSD has two utilities coming bundled with default installation. They are called &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=fstat&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+7.1-RELEASE&amp;format=html"&gt;fstat&lt;/a&gt; and &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=sockstat&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+7.1-RELEASE&amp;format=html"&gt;sockstat&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;fstat tells you which user,command and pid opened the file, which mount point the file is and information about the open file descriptor like read/write, inode number and mount point of the opened file.Please see man page of fstat for other options.&lt;br /&gt;&lt;br /&gt;sockstat gives you information about the opened sockets like which process/command is using it, user of the process,pid,protocol like tcp/udp,stream,dgram,etc.. and connected ports of local and remote servers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3721691574571790032?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3721691574571790032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3721691574571790032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3721691574571790032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3721691574571790032'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/01/lsof-alternatives-on-freebsd.html' title='lsof alternatives on FreeBSD'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-9060131534647602669</id><published>2009-01-24T08:22:00.000-08:00</published><updated>2009-01-29T02:46:11.018-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>Freebsd kernel process tracing</title><content type='html'>&lt;a href="http://www.freebsd.org/cgi/man.cgi?query=ktrace&amp;sektion=1&amp;apropos=0&amp;manpath=FreeBSD+7.1-RELEASE"&gt;ktrace&lt;/a&gt; utility enables to trace and log kernel system calls made by process. By default, it logs to ktrace.out file but this can be overwritten by providing another log filename with -f parameter. You need to pass your command to ktrace or use the pid of a running process.&lt;br /&gt;Also you have to say the kernel what system calls to trace by -t parameter. -t parameter has following options:&lt;br /&gt;&lt;br /&gt;c    trace system calls&lt;br /&gt;n    trace namei translations&lt;br /&gt;i    trace I/O&lt;br /&gt;s    trace signal processing&lt;br /&gt;t    trace various structures&lt;br /&gt;u    userland traces&lt;br /&gt;w    context switches&lt;br /&gt;+    trace the default set of trace points - c, n, i, s, t, u&lt;br /&gt;&lt;br /&gt;While tracing is going in kernel , logging stops when the process stops execution or trace popint ends. The other way is to use -c parameter of the ktrace and provide the pid of the process to stop tracing any further.&lt;br /&gt;&lt;br /&gt;to trace and log any running processes simply use the -p parameter and pass the process number (pid) to ktrace. here is a simple example with ktrace to trace find command:&lt;br /&gt;&lt;br /&gt;# ktrace -t+w /usr/bin/find /&lt;br /&gt;&lt;br /&gt;and following is a short snippet from the log created by ktrace and dispayled using kdump utility&lt;br /&gt;&lt;br /&gt;# kdump -f ktrace.out&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/SXtD-oVOHfI/AAAAAAAAAEA/a1kmwJ0AUW8/s1600-h/kdump.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/SXtD-oVOHfI/AAAAAAAAAEA/a1kmwJ0AUW8/s320/kdump.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5294900530161524210" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The log file created by ktrace can be read with &lt;a href="http://www.freebsd.org/cgi/man.cgi?query=kdump&amp;sektion=1&amp;apropos=0&amp;manpath=FreeBSD+7.1-RELEASE"&gt;kdump&lt;/a&gt; utility. Simply pass your ktrace log filename to kdump with -f parameter.&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-9060131534647602669?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/9060131534647602669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=9060131534647602669' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9060131534647602669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9060131534647602669'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/01/freebsd-kernel-process-tracing.html' title='Freebsd kernel process tracing'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bOa3aOPXCQo/SXtD-oVOHfI/AAAAAAAAAEA/a1kmwJ0AUW8/s72-c/kdump.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-2220803346068582003</id><published>2009-01-22T01:46:00.000-08:00</published><updated>2009-01-29T02:33:37.173-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>freebsd network tuning</title><content type='html'>Few days ago, I couldn't reach on of my freebsd 7.1 servers via ssh. Machine was not giving any response to any packets on the network. This is a server which gets moderate network traffic created by short and long lived network connections.  After log in from console, I ran the "vmstat -z" command.&lt;br /&gt;Looking closely to vmstat -z output, I figured out that some kernel zone allocations failed for following zones:&lt;br /&gt;mbuf_cluster:            2048,    25600,     1278,    24322, 393553280,     1384&lt;br /&gt;tcptw:                     52,     5184,        0,     5184,  3348441,  1304539&lt;br /&gt;tcpreass:                  20,     1690,        0,     1690, 10759020,   503124&lt;br /&gt;&lt;br /&gt;simply,&lt;br /&gt;tcptw -&gt; tcp timewait&lt;br /&gt;tcpreass -&gt; tcp reassembly &lt;br /&gt;mbuf_cluser -&gt; network buffer data stored by freebsd kernel&lt;br /&gt;&lt;br /&gt;I decided to bump the default numbers. I have used /etc/sysctl.conf to increase &lt;br /&gt;net.inet.tcp.maxtcptw = 12000&lt;br /&gt;kern.ipc.nmbclusters = 32768&lt;br /&gt;&lt;br /&gt;numbers. then run /etc/rc.d/sysctl restart. you can run vmstat -z to see if the numbers are in effect. tcpreass is a bit different. It should be written in /boot/loader.conf file and will take effect after rebooting your machine.&lt;br /&gt;&lt;br /&gt;net.inet.tcp.reass.maxsegments = 4096&lt;br /&gt;&lt;br /&gt;After rebooting my machine I checked the results but I didn't get tcpreass numbers as I wrote to boot loader.conf file. I decided to look what happened. I examined the freebsd 7.1 kernel sources and see tcp_reass_init() has an EVENTHANDLER_REGISTER  which calls tcp_reass_zone_change() function when nmbclusters numbers changed by sysctl. The rule is simple, when the machine boots&lt;br /&gt;tcp_reass_init functions calculates tcpreass default value as nmbclusters / 16. But if you add net.inet.tcp.reass.maxsegments to your boot loader it skips the auto calculated default and gets the number you've given. Then as default register a event handler to watch nmbclusters changes by users for auto calculate tcpreass again.In my case it gets the given number but when systcl gets into the account kernel detects that nmbclusters changed and recalculates it. So, I decied to remove my parameter from boot loader.conf and instead of that increase the mbuf cluster number to a little bit higer via sysctl.conf. The reasons here is that tcpreass queue uses mbufs, therefore it's auto tuned by freebsd kernel to not run out of mbuf clusters on system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NOTE: put this accounting that each mbuf cluster allocates 2KB in memory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-2220803346068582003?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/2220803346068582003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=2220803346068582003' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2220803346068582003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2220803346068582003'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/01/freebsd-network-tuning.html' title='freebsd network tuning'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-9047960733456542530</id><published>2009-01-09T03:47:00.000-08:00</published><updated>2009-01-29T02:46:01.747-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='erlang'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>profiling performance of an erlang application with eprof</title><content type='html'>Sometimes it's hard to pinpoint performance problems. In this cases profiling tools come handy. One of the profiling tools in Erlang is called eprof. Here is a simple example how to profile your erlang application with eprof.&lt;br /&gt;First of all, you need to find which pid (module) to profile. You can use "nregs()." command to find your application's pid number in erl shell. In my case pid number is "&lt;0.34.0&gt;".&lt;br /&gt;After finding the pid number start eprof module:&lt;br /&gt;&lt;br /&gt; eprof:start().&lt;br /&gt;&lt;br /&gt;now tell eprof to start profiling your application by giving the pid number.&lt;br /&gt;&lt;br /&gt;eprof:start_profiling([pid(0,34,0)]).&lt;br /&gt;&lt;br /&gt;note here that I have changed the dot in pid number to commas.&lt;br /&gt;&lt;br /&gt;now wait sometime for eprof to collect some data  or did something where you think the application was responding slow or stalling the cpu or whatever.&lt;br /&gt;&lt;br /&gt;now stop profiling.&lt;br /&gt;&lt;br /&gt;eprof:stop_profiling().&lt;br /&gt;&lt;br /&gt;ok now we can see which functions was occupying our cpu with following command:&lt;br /&gt;&lt;br /&gt;eprof:total_analyse().&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;br /&gt;Here is some screen output for total_analyse from my case:&lt;br /&gt;6&gt; eprof:total_analyse().&lt;br /&gt;FUNCTION                                       CALLS      TIME &lt;br /&gt;file:file_name_1/1                             3450       13 % &lt;br /&gt;erlang:port_control/3                          250        7 % &lt;br /&gt;prim_inet:enc_opts/2                           300        5 % &lt;br /&gt;erlang:port_command/2                          50         4 % &lt;br /&gt;erlang:port_close/1                            50         4 % &lt;br /&gt;prim_inet:enc_opt_val/4                        300        3 % &lt;br /&gt;gen:wait_resp_mon/3                            200        3 % &lt;br /&gt;filename:do_flatten/2                          650        3 % &lt;br /&gt;gen:do_call/4                                  200        2 % &lt;br /&gt;prim_inet:dec_opt_val/3                        300        2 % &lt;br /&gt;&lt;br /&gt;if you like to see results for process by process use "analyse()" instead of "total_analyse()"&lt;br /&gt;Also,It's possible to log these results to file  by eprof's "log" function.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-9047960733456542530?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/9047960733456542530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=9047960733456542530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9047960733456542530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9047960733456542530'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/01/profiling-performance-of-erlang.html' title='profiling performance of an erlang application with eprof'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1195334615302256648</id><published>2009-01-01T05:51:00.000-08:00</published><updated>2009-01-29T02:34:03.697-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Caching filesystems on linux with fs-cache (cachefilesd)</title><content type='html'>fs-cache can be use to cache nfs,local or other network filesystems. Here is an example howto cache a nfs mount point on Centos linux distribution. First of make sure that cachefilesd package is installed. Then make sure that cachefilesd (/etc/init.d/cachefilesd) runs on every boot. You can set it to run on startup by chkconfig utility if you like.&lt;br /&gt;Cachefilesd has a config file named /etc/cachefilesd.conf, where you can set where the cache content will be written. The option is called "dir". &lt;br /&gt;&lt;br /&gt;eg. dir /cache&lt;br /&gt;&lt;br /&gt;Note: caching directory should be an ext3 filesystem.&lt;br /&gt;&lt;br /&gt;Let's assume that we have a nfs mount point called mydisk on server 192.168.0.2. Let's create an entry in our fstab for this mount point&lt;br /&gt;&lt;br /&gt;192.168.0.2:/mydisk  /mydisk        nfs tcp,fsc   0 0&lt;br /&gt;&lt;br /&gt;the only option here is "fsc" for letting the caching start. After using check your cache directory in this case our directory is /cache to see it's working. There will be 2 directories there called graveyard and cache. Here is some cache filenames created on my cache directory.&lt;br /&gt;&lt;br /&gt;./cache/@4a/I03nfs/@4f/Jk0M00wg00000000000000Y--knmon200/@08&lt;br /&gt;./cache/@4a/I03nfs/@4f/Jk0M00wg00000000000000Y--knmon200/@08/Eo0g000M00E60180000gA5Ac0gmgO00FY0100&lt;br /&gt;./cache/@4a/I03nfs/@4f/Jk0M00wg00000000000000Y--knmon200/@10&lt;br /&gt;./cache/@4a/I03nfs/@4f/Jk0M00wg00000000000000Y--knmon200/@10/Eo0g000M00E601800000D5Ac0cmgO04FY0100&lt;br /&gt;./cache/@4a/I03nfs/@4f/Jk0M00wg00000000000000Y--knmon200/@77&lt;br /&gt;./cache/@4a/I03nfs/@4f/Jk0M00wg00000000000000Y--knmon200/@77/Eo0g000M00E60180000wcAv20fak00Ad12000&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1195334615302256648?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1195334615302256648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1195334615302256648' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1195334615302256648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1195334615302256648'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2009/01/caching-filesystems-on-linux-with-fs.html' title='Caching filesystems on linux with fs-cache (cachefilesd)'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-5231303284119563191</id><published>2008-12-15T02:56:00.000-08:00</published><updated>2009-01-29T02:34:11.905-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='erlang'/><title type='text'>logging errors with erlang and mochiweb</title><content type='html'>If you would like to run mochiweb or any erlang application and log messages to disk to review later, all you have to do is create a simple config file and wrote something in it like as follows:&lt;br /&gt;&lt;br /&gt;[{sasl, [&lt;br /&gt;         %% minimise shell error logging&lt;br /&gt;         {sasl_error_logger, false},&lt;br /&gt;         %% only report errors&lt;br /&gt;         {errlog_type, error},&lt;br /&gt;         %% define the parameters of the rotating log&lt;br /&gt;         %% the log file directory&lt;br /&gt;         {error_logger_mf_dir,"/var/logs/error_logs"},&lt;br /&gt;         %% # bytes per logfile&lt;br /&gt;         {error_logger_mf_maxbytes,10485760}, % 10 MB&lt;br /&gt;         %% maximum number of&lt;br /&gt;         {error_logger_mf_maxfiles, 10}&lt;br /&gt;        ]}].&lt;br /&gt;&lt;br /&gt;let's say we call this filename erlang_log.config. The trick here is that we have to create the log directory for erlang and make sure it's writable by the user which runs erlang process.&lt;br /&gt;# mkdir /var/logs/error_logs/&lt;br /&gt;you can also make it world writable if you don't care about who reads it on the server.&lt;br /&gt;# chmod 777 /var/log/error_logs/&lt;br /&gt;&lt;br /&gt;now pass the config file as parameter to your erl command (on mochiweb part, you can edit start.sh or start-dev.sh file).&lt;br /&gt;&lt;br /&gt;erl -config erlang_log&lt;br /&gt;&lt;br /&gt;when you first run your erlang process or mochiweb, first of all run on your erlang command prompt&lt;br /&gt;rb:start().&lt;br /&gt;to create index files in log directory and load rb module.Here is some useful commands to see log messages created by erlang. The log files in the directory are binary so you cannot simple read them.You have to read them through erlang (rb module).&lt;br /&gt;rb:list(). &lt;br /&gt;%% shows log messages index&lt;br /&gt;rb:show(number). &lt;br /&gt;%% shows given indexed numbered message details&lt;br /&gt;rb:rescan(). &lt;br /&gt;%% re-reads the error log directory index.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-5231303284119563191?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/5231303284119563191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=5231303284119563191' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5231303284119563191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5231303284119563191'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/12/logging-errors-with-erlang-and-mochiweb.html' title='logging errors with erlang and mochiweb'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1889708792057693845</id><published>2008-12-15T02:11:00.000-08:00</published><updated>2009-01-29T02:34:25.235-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='erlang'/><title type='text'>running mochiweb or any erlang application in background</title><content type='html'>&lt;a href="http://www.erlang.org/"&gt;Erlang&lt;/a&gt; is Ericsson's concurrent programming language.See &lt;a href="http://en.wikipedia.org/wiki/Erlang_(programming_language)"&gt;Erlang Wikipedia&lt;/a&gt; for more information. &lt;a href="http://code.google.com/p/mochiweb/"&gt;Mochiweb&lt;/a&gt; is a web framework to create lightweight http servers written in Erlang language.&lt;br /&gt;After creating a skeleton project with mochiweb (./scripts/new_mochiweb.erl). You can write your own code and compile it. Here is an &lt;a href="http://jimmyg.org/2007/12/31/multipart-post-with-erlang-and-mochiweb/"&gt;article&lt;/a&gt; shows this in detail.&lt;br /&gt;After all, running your new http server is done by star.sh or start-dev.sh in your application directory where you created by new_mochiweb.erl script. The script runs erl (The Erlang Emulator) command with some parameters. But it runs in foreground, if you want to run the erlang application in background simply add "-detached" parameter to your erl command. But, there is a drawback here. The erlang application runs in background and we cannot see the error and any information log messages now. I'll will explain how to log theses messages in log file and read them in another post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1889708792057693845?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1889708792057693845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1889708792057693845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1889708792057693845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1889708792057693845'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/12/running-mochiweb-or-any-erlang.html' title='running mochiweb or any erlang application in background'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1596167559372416269</id><published>2008-11-25T10:45:00.000-08:00</published><updated>2009-01-29T02:46:46.527-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>profiling mysql queries</title><content type='html'>Mysql database server has a new query profiling option. It's a very useful feature to profile queries on server and find bottlenecks.&lt;br /&gt;There is an article on mysql site which describes this feature in detail.&lt;br /&gt;&lt;a href="http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html"&gt;Using the New MySQL Query Profiler&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1596167559372416269?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1596167559372416269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1596167559372416269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1596167559372416269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1596167559372416269'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/11/profiling-mysql-queries.html' title='profiling mysql queries'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-5623318700774207064</id><published>2008-11-06T11:06:00.000-08:00</published><updated>2009-01-29T02:35:34.931-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Filesystems'/><title type='text'>finding backup superblocks on ext2 and ext3 filesystems</title><content type='html'>If you have a situation where your ext2 or ext3 filesystem's primary superblock is corrupted, you need to pass one of the backup superblocks to fsck program. In this case you can find the backup superblocks by using mkfs program. All you have to do is, run mkfs with "-n" option, where mkfs is run in dry mode. It will not destroy your filesystem, it only prints out what it will do on real mkfs procedure.By the way, you have to add the parameters if you have used when your filesystem originally created to get correct values.&lt;br /&gt;&lt;br /&gt;eg. mke2fs -n /dev/sda1&lt;br /&gt;&lt;br /&gt;and now you can pass your backup superblock number to fsck (fsck.ext2,fsck.ext3) with "-b" parameter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-5623318700774207064?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/5623318700774207064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=5623318700774207064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5623318700774207064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5623318700774207064'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/11/finding-backup-superblocks-on-ext2-and.html' title='finding backup superblocks on ext2 and ext3 filesystems'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3723053097930760704</id><published>2008-11-06T10:55:00.000-08:00</published><updated>2009-02-19T13:57:26.615-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>freeing cache on linux with drop_caches</title><content type='html'>Linux kernel 2.6.16 and later has a option which let's you free inode/dentry and pagecache caches on your system. The file is located on /proc filesystem.&lt;br /&gt;It has 3 options. For example:&lt;br /&gt;&lt;br /&gt;# echo 1 &gt; /proc/sys/vm/drop_caches&lt;br /&gt;&lt;br /&gt;frees pagecache on your system.&lt;br /&gt;&lt;br /&gt;# echo 2 &gt; /proc/sys/vm/drop_caches&lt;br /&gt;&lt;br /&gt;frees inodes and dentry caches&lt;br /&gt;&lt;br /&gt;# echo 3 &gt; /proc/sys/vm/drop_caches&lt;br /&gt;&lt;br /&gt;frees pagecache and inode/dentry caches.&lt;br /&gt;&lt;br /&gt;tip: some dirty caches are not freeable so it's better to use "sync" command before using drop_caches for freeing much more memory on your linux system.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3723053097930760704?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3723053097930760704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3723053097930760704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3723053097930760704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3723053097930760704'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/11/freeing-cache-on-linux-with-dropcaches.html' title='freeing cache on linux with drop_caches'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-9209155713020459660</id><published>2008-10-29T03:53:00.000-07:00</published><updated>2009-01-29T02:35:56.056-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>disabling bell beep sound  on linux  console</title><content type='html'>Sometimes its annoying to hear a beep sound everytime you hit on tab button for completion on linux console. Here is the quickway how to disable that beep sound.&lt;br /&gt;All you have to do is add the following line in /etc/inputrc file or uncomment it if it presents.&lt;br /&gt;&lt;br /&gt;set bell-style none&lt;br /&gt;&lt;br /&gt;the following image is the default inputrc file on centos system. You can uncomment the line which says "set bell-style none" for disabling tab completion beep sound.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bOa3aOPXCQo/SQhCFxlpleI/AAAAAAAAADg/12N0Xmyi6u4/s1600-h/bell.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://3.bp.blogspot.com/_bOa3aOPXCQo/SQhCFxlpleI/AAAAAAAAADg/12N0Xmyi6u4/s320/bell.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5262528831560455650" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-9209155713020459660?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/9209155713020459660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=9209155713020459660' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9209155713020459660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/9209155713020459660'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/10/disabling-bell-beep-sound-on-linux.html' title='disabling bell beep sound  on linux  console'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bOa3aOPXCQo/SQhCFxlpleI/AAAAAAAAADg/12N0Xmyi6u4/s72-c/bell.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1462940685277841604</id><published>2008-10-27T01:56:00.000-07:00</published><updated>2009-01-29T02:46:54.685-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>resolving latency problems on linux with latencytop utility</title><content type='html'>Finding out what is causing unresponsive behaviour, audio delays or stalls on your linux machines can be a hard task.&lt;br /&gt;&lt;a href=" http://www.latencytop.org/"&gt;Latencytop&lt;/a&gt; utility gives information where latency is occured to diagnose problem.&lt;br /&gt;&lt;br /&gt;Here is an example how to use latencytop on fedora core 9 distribution.&lt;br /&gt;&lt;br /&gt;yum install latencytop&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;By default kernel does not enable latency  statistics reporting.You have to enable it by hand.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo 1 &gt; /proc/sys/kernel/latencytop&lt;br /&gt;&lt;br /&gt;this command enables it. disabling it is easy by echo 0 &gt; /proc/sys/kernel/latencytop&lt;br /&gt;latencytop uses the statistics from proc file system. statistics is in /proc/latency_stats file.&lt;br /&gt;&lt;br /&gt;here is a screenshot where it shows latency caused disk io on ext3 filesystem and with which pid caused it. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bOa3aOPXCQo/SQWCt6BLRjI/AAAAAAAAADM/SKtbIXZVUNQ/s1600-h/latencytop.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 187px;" src="http://2.bp.blogspot.com/_bOa3aOPXCQo/SQWCt6BLRjI/AAAAAAAAADM/SKtbIXZVUNQ/s320/latencytop.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5261755464832206386" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;note: if your linux system does not have /proc/latency_stats file. it's either is disabled when kernel is compiled or your kernel does not have latency stats support. In that case you have to patch your kernel an recompile it.&lt;br /&gt;for patch see http://www.latencytop.org/download.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1462940685277841604?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1462940685277841604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1462940685277841604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1462940685277841604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1462940685277841604'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/10/resolving-latency-problems-on-linux.html' title='resolving latency problems on linux with latencytop utility'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bOa3aOPXCQo/SQWCt6BLRjI/AAAAAAAAADM/SKtbIXZVUNQ/s72-c/latencytop.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-8089918802118485536</id><published>2008-10-20T11:10:00.000-07:00</published><updated>2009-01-29T02:47:02.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>extending laptop battery lifetime with Intel's Powertop utility</title><content type='html'>&lt;a href="http://www.lesswatts.org/projects/powertop/"&gt;Powertop&lt;/a&gt; is designed to pinpoint resources (device drivers, software,etc..) that wakes up idle cpu and lets you extend battery life time by fixing or stopping the application. It's useful for laptop users and also for datacenters who wants to save power consumption.&lt;br /&gt;&lt;br /&gt;Here is a sample output  disk I/O which showing by powetop:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bOa3aOPXCQo/SPzNm12OK5I/AAAAAAAAADE/NKoxaqZG1os/s1600-h/powetop.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_bOa3aOPXCQo/SPzNm12OK5I/AAAAAAAAADE/NKoxaqZG1os/s320/powetop.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5259304532035120018" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-8089918802118485536?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/8089918802118485536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=8089918802118485536' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8089918802118485536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8089918802118485536'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/10/extending-laptop-battery-with-intels.html' title='extending laptop battery lifetime with Intel&apos;s Powertop utility'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bOa3aOPXCQo/SPzNm12OK5I/AAAAAAAAADE/NKoxaqZG1os/s72-c/powetop.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-440086034978978041</id><published>2008-10-18T03:33:00.000-07:00</published><updated>2009-01-29T02:36:27.596-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>display system statistics with systat on bsd systems</title><content type='html'>systat utility displays system statistics on bsd systems (freebsd, dragonfly, etc.). &lt;br /&gt;system statistics includes swap, network interface, disk I/O , virtual memory (vmstat), network utilitzation (mbuf), TCP/IP statistics, network connections (netstat), icmp.&lt;br /&gt;&lt;br /&gt;here is some systat options:&lt;br /&gt;pigs,icmp,ip,tcp,ifstat,iostat,swap,mbufs,vmstat,netstat.&lt;br /&gt;following is sample output for "systat -iostat" command:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bOa3aOPXCQo/SPm-6-HG29I/AAAAAAAAAC8/eb3XpOpG0Yo/s1600-h/systat.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_bOa3aOPXCQo/SPm-6-HG29I/AAAAAAAAAC8/eb3XpOpG0Yo/s320/systat.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5258443960246262738" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-440086034978978041?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/440086034978978041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=440086034978978041' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/440086034978978041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/440086034978978041'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/10/display-system-statistics-with-systat.html' title='display system statistics with systat on bsd systems'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bOa3aOPXCQo/SPm-6-HG29I/AAAAAAAAAC8/eb3XpOpG0Yo/s72-c/systat.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-2759361457570488846</id><published>2008-08-29T16:41:00.000-07:00</published><updated>2009-01-29T02:36:45.235-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>editing text files with more</title><content type='html'>You can edit documents when using more. if you press "v" , your default editor will be started on current line. After saving and exiting your editor, you can continue using more. &lt;br /&gt;Default editor is chosen by VISUAL and EDITOR variables. VISUAL environment overrides EDITOR variable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-2759361457570488846?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/2759361457570488846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=2759361457570488846' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2759361457570488846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2759361457570488846'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/08/editing-text-files-with-more.html' title='editing text files with more'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6608473800781548539</id><published>2008-07-26T05:44:00.000-07:00</published><updated>2009-01-29T02:47:26.209-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>block I/O debugging in Linux</title><content type='html'>block_dump option enables you to see all read/write and block dirtying operations on files. It's default value is 0. Setting value to 1 enables block I/O debugging. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo "1" &gt; /proc/sys/vm/block_dump&lt;br /&gt;&lt;br /&gt;You can see the log via dmesg, here is a sample output.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_bOa3aOPXCQo/SIslKsm8ljI/AAAAAAAAACc/yDCbBLrqHKA/s1600-h/block_dump.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_bOa3aOPXCQo/SIslKsm8ljI/AAAAAAAAACc/yDCbBLrqHKA/s320/block_dump.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5227312658197026354" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;to set if off:&lt;br /&gt;&lt;br /&gt;echo "0" &gt; /proc/sys/vm/block_dump&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6608473800781548539?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6608473800781548539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6608473800781548539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6608473800781548539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6608473800781548539'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/07/block-io-debugging-in-linux.html' title='block I/O debugging in Linux'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_bOa3aOPXCQo/SIslKsm8ljI/AAAAAAAAACc/yDCbBLrqHKA/s72-c/block_dump.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-8949932985319018252</id><published>2008-07-19T03:49:00.000-07:00</published><updated>2009-01-29T02:37:23.648-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Want to see which memory bank is in use on your system?</title><content type='html'>&lt;a href="http://www.dmtf.org/standards/smbios/"&gt;System Management BIOS (SMBIOS) pecification&lt;/a&gt; reports information of your hardware. In short terms, it tells you what your system bios detects and supports.&lt;br /&gt;&lt;br /&gt;In Linux, you can use &lt;a href="http://www.nongnu.org/dmidecode/"&gt;dmidecode&lt;/a&gt; for accessing smbios information. For example, if you like to see which memory banks is in use and what the ram module sizes, you simply call dmidecode with memory parameter.&lt;br /&gt;&lt;br /&gt;# dmidecode -t memory&lt;br /&gt;&lt;br /&gt;Here is the output on my system, If you look sample output below, you will see total memory supported by your system and max memory module size which can be installed. Also which banks are installed and memory module details like size and speed.&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;# dmidecode 2.9&lt;br /&gt;SMBIOS 2.4 present.&lt;br /&gt;&lt;br /&gt;Handle 0x0005, DMI type 5, 24 bytes&lt;br /&gt;Memory Controller Information&lt;br /&gt; Error Detecting Method: 8-bit Parity&lt;br /&gt; Error Correcting Capabilities:&lt;br /&gt;  None&lt;br /&gt; Supported Interleave: One-way Interleave&lt;br /&gt; Current Interleave: One-way Interleave&lt;br /&gt; Maximum Memory Module Size: 1024 MB&lt;br /&gt; Maximum Total Memory Size: 4096 MB&lt;br /&gt; Supported Speeds:&lt;br /&gt;  Other&lt;br /&gt; Supported Memory Types:&lt;br /&gt;  Other&lt;br /&gt; Memory Module Voltage: 5.0 V&lt;br /&gt; Associated Memory Slots: 4&lt;br /&gt;  0x0006&lt;br /&gt;  0x0007&lt;br /&gt;  0x0008&lt;br /&gt;  0x0009&lt;br /&gt; Enabled Error Correcting Capabilities:&lt;br /&gt;  None&lt;br /&gt;&lt;br /&gt;Handle 0x0006, DMI type 6, 12 bytes&lt;br /&gt;Memory Module Information&lt;br /&gt; Socket Designation: A0&lt;br /&gt; Bank Connections: 1&lt;br /&gt; Current Speed: Unknown&lt;br /&gt; Type: DIMM SDRAM&lt;br /&gt; Installed Size: 1024 MB (Single-bank Connection)&lt;br /&gt; Enabled Size: 1024 MB (Single-bank Connection)&lt;br /&gt; Error Status: OK&lt;br /&gt;&lt;br /&gt;Handle 0x0007, DMI type 6, 12 bytes&lt;br /&gt;Memory Module Information&lt;br /&gt; Socket Designation: A1&lt;br /&gt; Bank Connections: 2&lt;br /&gt; Current Speed: Unknown&lt;br /&gt; Type: Unknown&lt;br /&gt; Installed Size: Not Installed&lt;br /&gt; Enabled Size: Not Installed&lt;br /&gt; Error Status: OK&lt;br /&gt;&lt;br /&gt;Handle 0x0008, DMI type 6, 12 bytes&lt;br /&gt;Memory Module Information&lt;br /&gt; Socket Designation: A2&lt;br /&gt; Bank Connections: 3&lt;br /&gt; Current Speed: Unknown&lt;br /&gt; Type: Unknown&lt;br /&gt; Installed Size: Not Installed&lt;br /&gt; Enabled Size: Not Installed&lt;br /&gt; Error Status: OK&lt;br /&gt;&lt;br /&gt;Handle 0x0009, DMI type 6, 12 bytes&lt;br /&gt;Memory Module Information&lt;br /&gt; Socket Designation: A3&lt;br /&gt; Bank Connections: 4&lt;br /&gt; Current Speed: Unknown&lt;br /&gt; Type: Unknown&lt;br /&gt; Installed Size: Not Installed&lt;br /&gt; Enabled Size: Not Installed&lt;br /&gt; Error Status: OK&lt;br /&gt;&lt;br /&gt;Handle 0x001B, DMI type 16, 15 bytes&lt;br /&gt;Physical Memory Array&lt;br /&gt; Location: System Board Or Motherboard&lt;br /&gt; Use: System Memory&lt;br /&gt; Error Correction Type: None&lt;br /&gt; Maximum Capacity: 4 GB&lt;br /&gt; Error Information Handle: Not Provided&lt;br /&gt; Number Of Devices: 4&lt;br /&gt;&lt;br /&gt;Handle 0x001C, DMI type 17, 27 bytes&lt;br /&gt;Memory Device&lt;br /&gt; Array Handle: 0x001B&lt;br /&gt; Error Information Handle: Not Provided&lt;br /&gt; Total Width: 64 bits&lt;br /&gt; Data Width: 64 bits&lt;br /&gt; Size: 1024 MB&lt;br /&gt; Form Factor: DIMM&lt;br /&gt; Set: None&lt;br /&gt; Locator: A0&lt;br /&gt; Bank Locator: Bank0/1&lt;br /&gt; Type: Unknown&lt;br /&gt; Type Detail: None&lt;br /&gt; Speed: 667 MHz (1.5 ns)&lt;br /&gt; Manufacturer: None&lt;br /&gt; Serial Number: None&lt;br /&gt; Asset Tag: None&lt;br /&gt; Part Number: None&lt;br /&gt;&lt;br /&gt;Handle 0x001D, DMI type 17, 27 bytes&lt;br /&gt;Memory Device&lt;br /&gt; Array Handle: 0x001B&lt;br /&gt; Error Information Handle: Not Provided&lt;br /&gt; Total Width: Unknown&lt;br /&gt; Data Width: Unknown&lt;br /&gt; Size: No Module Installed&lt;br /&gt; Form Factor: DIMM&lt;br /&gt; Set: None&lt;br /&gt; Locator: A1&lt;br /&gt; Bank Locator: Bank2/3&lt;br /&gt; Type: Unknown&lt;br /&gt; Type Detail: None&lt;br /&gt; Speed: Unknown&lt;br /&gt; Manufacturer: None&lt;br /&gt; Serial Number: None&lt;br /&gt; Asset Tag: None&lt;br /&gt; Part Number: None&lt;br /&gt;&lt;br /&gt;Handle 0x001E, DMI type 17, 27 bytes&lt;br /&gt;Memory Device&lt;br /&gt; Array Handle: 0x001B&lt;br /&gt; Error Information Handle: Not Provided&lt;br /&gt; Total Width: Unknown&lt;br /&gt; Data Width: Unknown&lt;br /&gt; Size: No Module Installed&lt;br /&gt; Form Factor: DIMM&lt;br /&gt; Set: None&lt;br /&gt; Locator: A2&lt;br /&gt; Bank Locator: Bank4/5&lt;br /&gt; Type: Unknown&lt;br /&gt; Type Detail: None&lt;br /&gt; Speed: Unknown&lt;br /&gt; Manufacturer: None&lt;br /&gt; Serial Number: None&lt;br /&gt; Asset Tag: None&lt;br /&gt; Part Number: None&lt;br /&gt;&lt;br /&gt;Handle 0x001F, DMI type 17, 27 bytes&lt;br /&gt;Memory Device&lt;br /&gt; Array Handle: 0x001B&lt;br /&gt; Error Information Handle: Not Provided&lt;br /&gt; Total Width: Unknown&lt;br /&gt; Data Width: Unknown&lt;br /&gt; Size: No Module Installed&lt;br /&gt; Form Factor: DIMM&lt;br /&gt; Set: None&lt;br /&gt; Locator: A3&lt;br /&gt; Bank Locator: Bank6/7&lt;br /&gt; Type: Unknown&lt;br /&gt; Type Detail: None&lt;br /&gt; Speed: Unknown&lt;br /&gt; Manufacturer: None&lt;br /&gt; Serial Number: None&lt;br /&gt; Asset Tag: None&lt;br /&gt; Part Number: None&lt;br /&gt;&lt;br /&gt; dmidecode also gives you information about your system's cache, bios and cpu.&lt;br /&gt;Here is a sample output for processor:&lt;br /&gt;&lt;br /&gt;# dmidecode -t processor&lt;br /&gt;&lt;br /&gt;# dmidecode 2.9&lt;br /&gt;SMBIOS 2.4 present.&lt;br /&gt;&lt;br /&gt;Handle 0x0004, DMI type 4, 35 bytes&lt;br /&gt;Processor Information&lt;br /&gt; Socket Designation: Socket 775&lt;br /&gt; Type: Central Processor&lt;br /&gt; Family: Other&lt;br /&gt; Manufacturer: Intel&lt;br /&gt; ID: F6 06 00 00 FF FB EB BF&lt;br /&gt; Version: Intel(R) Core(TM)2 CPU 630&lt;br /&gt; Voltage: 1.3 V&lt;br /&gt; External Clock: 266 MHz&lt;br /&gt; Max Speed: 4000 MHz&lt;br /&gt; Current Speed: 1866 MHz&lt;br /&gt; Status: Populated, Enabled&lt;br /&gt; Upgrade: Socket 478&lt;br /&gt; L1 Cache Handle: 0x000A&lt;br /&gt; L2 Cache Handle: 0x000B&lt;br /&gt; L3 Cache Handle: Not Provided&lt;br /&gt; Serial Number:  &lt;br /&gt; Asset Tag:  &lt;br /&gt; Part Number:  &lt;br /&gt;&lt;br /&gt;information about your system cache&lt;br /&gt;# dmidecode -t cache&lt;br /&gt;&lt;br /&gt;# dmidecode 2.9&lt;br /&gt;SMBIOS 2.4 present.&lt;br /&gt;&lt;br /&gt;Handle 0x000A, DMI type 7, 19 bytes&lt;br /&gt;Cache Information&lt;br /&gt; Socket Designation: Internal Cache&lt;br /&gt; Configuration: Enabled, Not Socketed, Level 1&lt;br /&gt; Operational Mode: Write Back&lt;br /&gt; Location: Internal&lt;br /&gt; Installed Size: 64 KB&lt;br /&gt; Maximum Size: 64 KB&lt;br /&gt; Supported SRAM Types:&lt;br /&gt;  Synchronous&lt;br /&gt; Installed SRAM Type: Synchronous&lt;br /&gt; Speed: Unknown&lt;br /&gt; Error Correction Type: Unknown&lt;br /&gt; System Type: Unknown&lt;br /&gt; Associativity: Unknown&lt;br /&gt;&lt;br /&gt;Handle 0x000B, DMI type 7, 19 bytes&lt;br /&gt;Cache Information&lt;br /&gt; Socket Designation: External Cache&lt;br /&gt; Configuration: Enabled, Not Socketed, Level 2&lt;br /&gt; Operational Mode: Write Back&lt;br /&gt; Location: Internal&lt;br /&gt; Installed Size: 2048 KB&lt;br /&gt; Maximum Size: 1024 KB&lt;br /&gt; Supported SRAM Types:&lt;br /&gt;  Synchronous&lt;br /&gt; Installed SRAM Type: Synchronous&lt;br /&gt; Speed: Unknown&lt;br /&gt; Error Correction Type: Unknown&lt;br /&gt; System Type: Unknown&lt;br /&gt; Associativity: Unknown&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# dmidecode -t bios&lt;br /&gt;&lt;br /&gt;bios information includes  vendor of your bios and it's version.Useful, to see if you are using and old bios and needing and bios update. Also, which devices are supported and which ones can be use for booting up your system.&lt;br /&gt;&lt;b:if cond='data:blog.pageType != "item"'&gt;&lt;br /&gt;&lt;br /&gt;   &lt;a expr:href='data:post.url'&gt;Read more!&lt;/a&gt;&lt;br /&gt;&lt;/b:if&gt;&lt;br /&gt;# dmidecode 2.9&lt;br /&gt;SMBIOS 2.4 present.&lt;br /&gt;&lt;br /&gt;Handle 0x0000, DMI type 0, 20 bytes&lt;br /&gt;BIOS Information&lt;br /&gt; Vendor: Award Software International, Inc.&lt;br /&gt; Version: F6&lt;br /&gt; Release Date: 05/28/2007&lt;br /&gt; Address: 0xE0000&lt;br /&gt; Runtime Size: 128 kB&lt;br /&gt; ROM Size: 512 kB&lt;br /&gt; Characteristics:&lt;br /&gt;  PCI is supported&lt;br /&gt;  PNP is supported&lt;br /&gt;  APM is supported&lt;br /&gt;  BIOS is upgradeable&lt;br /&gt;  BIOS shadowing is allowed&lt;br /&gt;  Boot from CD is supported&lt;br /&gt;  Selectable boot is supported&lt;br /&gt;  EDD is supported&lt;br /&gt;  5.25"/360 KB floppy services are supported (int 13h)&lt;br /&gt;  5.25"/1.2 MB floppy services are supported (int 13h)&lt;br /&gt;  3.5"/720 KB floppy services are supported (int 13h)&lt;br /&gt;  3.5"/2.88 MB floppy services are supported (int 13h)&lt;br /&gt;  Print screen service is supported (int 5h)&lt;br /&gt;  8042 keyboard services are supported (int 9h)&lt;br /&gt;  Serial services are supported (int 14h)&lt;br /&gt;  Printer services are supported (int 17h)&lt;br /&gt;  CGA/mono video services are supported (int 10h)&lt;br /&gt;  ACPI is supported&lt;br /&gt;  USB legacy is supported&lt;br /&gt;  LS-120 boot is supported&lt;br /&gt;  ATAPI Zip drive boot is supported&lt;br /&gt;  BIOS boot specification is supported&lt;br /&gt;&lt;br /&gt;Handle 0x001A, DMI type 13, 22 bytes&lt;br /&gt;BIOS Language Information&lt;br /&gt; Installable Languages: 3&lt;br /&gt;  n|US|iso8859-1&lt;br /&gt;  n|US|iso8859-1&lt;br /&gt;  r|CA|iso8859-1&lt;br /&gt; Currently Installed Language: n|US|iso8859-1&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-8949932985319018252?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/8949932985319018252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=8949932985319018252' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8949932985319018252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/8949932985319018252'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/07/want-to-see-which-memory-bank-is-in-use.html' title='Want to see which memory bank is in use on your system?'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6955767704456686335</id><published>2008-07-13T01:59:00.000-07:00</published><updated>2009-01-29T02:37:34.298-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Filesystems'/><title type='text'>fscking large ext2/ext3 volumes</title><content type='html'>If you got following memory allocation error while fscking a large ext2/ext3 volume on a 32-bit system&lt;br /&gt;&lt;br /&gt;/dev/sdaX contains a file system with errors, check forced.&lt;br /&gt;Pass 1: Checking inodes, blocks, and sizes&lt;br /&gt;&lt;strong&gt;Error allocating directory block array: Memory allocation failed&lt;/strong&gt;&lt;br /&gt;e2fsck: aborted&lt;br /&gt;&lt;br /&gt;You can try one of the following methods:&lt;br /&gt;1- boot with a 64-bit live cd and fsck your volume&lt;br /&gt;2- if you don't have a 64-bit cpu, use your one of the partitions or disks for fsck  cache.&lt;br /&gt;edit following file&lt;br /&gt;/etc/e2fsck.conf &lt;br /&gt;&lt;br /&gt;and add following lines to point fsck to a directory where it can store it's cache files during fsck.&lt;br /&gt;[scratch_files]&lt;br /&gt;           directory = /home/myuser/tmp/&lt;br /&gt;&lt;br /&gt;be sure that the directory exists, before running fsck.By this way you will reduce the needed memory for fsck. The disadvantage is disk is slow, therefore fsck will take more time to finish it's job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6955767704456686335?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6955767704456686335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6955767704456686335' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6955767704456686335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6955767704456686335'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/07/fscking-large-ext2ext3-volumes.html' title='fscking large ext2/ext3 volumes'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7141074557871827673</id><published>2008-07-07T07:12:00.000-07:00</published><updated>2009-01-29T02:38:00.409-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bash'/><title type='text'>Regular expression in Bash</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Regular_expression"&gt;Regular expressions&lt;/a&gt; are handy way of quickly manipulating text data or searching any substring or character in it. Almost every language supports it. For example: perl,C,php,java,etc...&lt;br /&gt;&lt;br /&gt;Here is some quick tips on regexp with bash.&lt;br /&gt;&lt;br /&gt;This if statement is true if string in data variable starts with numeric values.&lt;br /&gt;if [[ $data =~ ^[0-9] ]]; then&lt;br /&gt;&lt;br /&gt;^ means start of the string&lt;br /&gt;[0-9] is range from 0 to 9.&lt;br /&gt;[a-z] from a to z but in lower case.&lt;br /&gt;[A-Z] from A to Z but in capital. as you see it's case sensitive.&lt;br /&gt;&lt;br /&gt;if string lasts with a digit&lt;br /&gt;if [[ $data =~ [0-9]$ ]]; then&lt;br /&gt;&lt;br /&gt;if string starts with a digit and it's not more than 3 digits&lt;br /&gt;if [[ $data =~ ^[0-9]{1,3} ]]; then&lt;br /&gt;&lt;br /&gt;{1,3} means 1 character or at most 3 characters of previous declaration&lt;br /&gt;&lt;br /&gt;this one  means that string starts with lower case letter and ends again with lower case letter&lt;br /&gt;any other character or numeric value fails this if statement&lt;br /&gt;&lt;br /&gt;if [[ $data =~ ^[a-z]+*$ ]]; then&lt;br /&gt;&lt;br /&gt;$ means end of line&lt;br /&gt;+ means one or more of the preceding element&lt;br /&gt;&lt;br /&gt;here is search and replace statements&lt;br /&gt;&lt;br /&gt;this one searches character "a" in data variable and changes its first match with "b| character&lt;br /&gt;data=${data/a/b}&lt;br /&gt;&lt;br /&gt;this one is exact with previous example with one difference, it searches for all "a" characters and replace all of them with "b" character, please notice double slash.&lt;br /&gt;data=${data//a/b}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7141074557871827673?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7141074557871827673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7141074557871827673' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7141074557871827673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7141074557871827673'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/07/regular-expression-in-bash.html' title='Regular expression in Bash'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-3594834971315487606</id><published>2008-07-06T02:08:00.000-07:00</published><updated>2009-01-29T02:47:37.034-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>Analyzing linux resources with Systemtap</title><content type='html'>Systemp lets you gather information about your running linux system. So you can diagnose performance and problems on your system(I/O activity, network, sockets,etc.). It provides a command line interface and a scripting language. There is also a gui interface called &lt;a href="http://stapgui.sourceforge.net"&gt;stapgui&lt;/a&gt; on sourceforge.net. Installing it on Ubuntu is straight forward &lt;br /&gt;&lt;br /&gt;sudo apt-get install systemtap&lt;br /&gt;sudo apt-get install linux-image-debug-generic&lt;br /&gt;sudo ln -s /boot/vmlinux-debug-$(uname -r) /lib/modules/$(uname -r)/vmlinux&lt;br /&gt;&lt;br /&gt; Systemtap uses kprobes to trace events. Kprobes are markers which are placed on predefined points in kernel. For example if you like to see which programs are run by your system you call syscall exec probe.&lt;br /&gt;Here is a simple stap script which shows which programs are run by your system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/usr/bin/env stap&lt;br /&gt;probe syscall.exec* { &lt;br /&gt; printf("exec %s %s\n", execname(), argstr)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;As you can see, stap is similiar to C language.&lt;br /&gt;The key point is to choose which probe point you would like to use.&lt;br /&gt;It is also possible to probe only which process you want by pid or it's name.For example:&lt;br /&gt;probe process("/bin/bash").syscall&lt;br /&gt;&lt;br /&gt;Here is another example, suppose you have a disk I/O activity and want to know which processes are causing this.&lt;br /&gt;&lt;br /&gt;#!/usr/bin/env stap&lt;br /&gt;&lt;br /&gt;global reads, writes, total_io&lt;br /&gt;probe kernel.function("vfs_read").return {&lt;br /&gt;   reads[execname()] = total_io[execname()] += $return&lt;br /&gt;}&lt;br /&gt;probe kernel.function("vfs_write").return {   &lt;br /&gt;   writes[execname()] = total_io[execname()] += $return&lt;br /&gt;}&lt;br /&gt;probe timer.s(1) {&lt;br /&gt;  foreach(p in total_io- limit 10)&lt;br /&gt;      printf("%15s r: %8d KiB w: %8d KiB\n",p, reads[p]/1024,writes[p]/1024)&lt;br /&gt;  printf("\n")&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can read further at systemtap site&lt;br /&gt;http://sourceware.org/systemtap/langref/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-3594834971315487606?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/3594834971315487606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=3594834971315487606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3594834971315487606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/3594834971315487606'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/07/analyzing-linux-resources-with.html' title='Analyzing linux resources with Systemtap'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-5530677023273066081</id><published>2008-06-05T14:09:00.000-07:00</published><updated>2009-01-29T02:47:49.872-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><title type='text'>Linux  Block Tracing</title><content type='html'>blktrace let's you see detailed information about I/O traffic on a disk devices.&lt;br /&gt;&lt;br /&gt;You need to have a 2.6.17-rc1 or newer kernel with "Block io tracing" and debugfs enabled in kernel to use blktrace command. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can download and install blkrace from http://brick.kernel.dk/snaps/ site or if you use ubuntu you can install it with apt-get.&lt;br /&gt;on ubuntu:&lt;br /&gt;&lt;br /&gt;$ sudo apt-get install blktrace&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;blktrace requires debugfs to run. run mount command to see if it's mounted. &lt;br /&gt;If you can't see debugfs in mount command output for example create a directory called /debugfs and mount it by following command as root&lt;br /&gt;&lt;br /&gt;# mount -t debugfs none /debugfs&lt;br /&gt;&lt;br /&gt;now you can run blkrace command.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;blktrace -r /debugfs/ -d /dev/sda -o - | blkparse -i -&lt;br /&gt;&lt;br /&gt;default format of blkparse output is as follows (you can change output format if you like with -f option):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_bOa3aOPXCQo/SElu4zfzkgI/AAAAAAAAACQ/E9PC8ieTpDc/s1600-h/bl.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_bOa3aOPXCQo/SElu4zfzkgI/AAAAAAAAACQ/E9PC8ieTpDc/s320/bl.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5208816366206030338" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;by this way you can get detailed information about ongoing disk activity on your system.&lt;br /&gt;&lt;br /&gt;Description of Events: &lt;br /&gt;&lt;br /&gt;      A      IO was remapped to a different device&lt;br /&gt;&lt;br /&gt;      B      IO bounced&lt;br /&gt;&lt;br /&gt;      C      IO completion&lt;br /&gt;&lt;br /&gt;      D      IO issued to driver&lt;br /&gt;&lt;br /&gt;      F      IO front merged with request on queue&lt;br /&gt;&lt;br /&gt;      G      Get request&lt;br /&gt;&lt;br /&gt;      I      IO inserted onto request queue&lt;br /&gt;&lt;br /&gt;      M      IO back merged with request on queue&lt;br /&gt;&lt;br /&gt;      P      Plug request&lt;br /&gt;&lt;br /&gt;      Q      IO handled by request queue code&lt;br /&gt;&lt;br /&gt;      S      Sleep request&lt;br /&gt;&lt;br /&gt;      T      Unplug due to timeout&lt;br /&gt;&lt;br /&gt;      U      Unplug request&lt;br /&gt;&lt;br /&gt;      X      Split&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-5530677023273066081?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/5530677023273066081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=5530677023273066081' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5530677023273066081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/5530677023273066081'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/06/linux-block-tracing.html' title='Linux  Block Tracing'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_bOa3aOPXCQo/SElu4zfzkgI/AAAAAAAAACQ/E9PC8ieTpDc/s72-c/bl.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6676691937454303943</id><published>2008-05-25T00:48:00.000-07:00</published><updated>2009-01-29T02:38:28.908-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>simple load balancing with iptables</title><content type='html'>iptables has an extension called clusterip. Clusterip extension uses &lt;a href="http://www.firewall.cx/multicast-intro.php"&gt;multicast arp&lt;/a&gt; feature to achieve load balancing. Let's say we have two web servers called web1(192.168.0.1) and web2(192.168.0.2) and a virtual ip (192.168.0.10) which will be accepting requests for these machines.&lt;br /&gt;&lt;br /&gt;virtual ip:192.168.0.10&lt;br /&gt;web1:192.168.0.1&lt;br /&gt;web2:192.168.0.2&lt;br /&gt;&lt;br /&gt;Virtual ip will accept the requests and load balance them between these two web servers.&lt;br /&gt;&lt;br /&gt;on web1 server run:&lt;br /&gt;&lt;br /&gt;# iptables -I INPUT -d 192.168.0.10 -i eth0 -p tcp --dport 80 -j CLUSTERIP --new --clustermac 01:02:03:04:05:06 --total-nodes 2 --local-node 1 --hashmode sourceip&lt;br /&gt;# ifconfig eth0:1 192.168.0.10 netmask 255.255.255.0 up&lt;br /&gt;&lt;br /&gt;on web2 server run:&lt;br /&gt;# iptables -I INPUT -d 192.168.0.10 -i eth0 -p tcp --dport 80 -j CLUSTERIP --new --clustermac 01:02:03:04:05:06 --total-nodes 2 --local-node 2 --hashmode sourceip&lt;br /&gt;# ifconfig eth0:1 192.168.0.10 netmask 255.255.255.0 up&lt;br /&gt;&lt;br /&gt;only difference between web1 and web2 commands is local-node option as seen above.&lt;br /&gt;now any web requests coming to 192.168.0.10 will be load balanced between web1 and web2. &lt;br /&gt;&lt;br /&gt;clusterip supports three hashmodes (sourceip,sourceip-sourceport and sourceip-sourceport-destport)  to determine how to route requests to each servers.&lt;br /&gt;&lt;br /&gt;This configuration has one drawback. If one of the nodes fall, the other one does not serves incoming requests for the other one. You need to install linux-ha.  &lt;br /&gt;&lt;br /&gt;If you want to see which requests served by web1 for example, simply run&lt;br /&gt;# cat /proc/net/ipt_CLUSTERIP/192.168.0.1&lt;br /&gt;&lt;br /&gt;Let's say web2 is crashed and we would like to first web server (web1) to take  care the requests coming to web2.&lt;br /&gt;on web1 server run:&lt;br /&gt;# echo "+2" &gt;&gt; /proc/net/ipt_CLUSTERIP/192.168.0.1&lt;br /&gt;now on, web1 will take the requests coming to web1. &lt;br /&gt;When you up the web2 server, just run &lt;br /&gt;# echo "-2" &gt;&gt; /proc/net/ipt_CLUSTERIP/192.168.0.1&lt;br /&gt;and web1 will not serve the request for web2.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6676691937454303943?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6676691937454303943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6676691937454303943' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6676691937454303943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6676691937454303943'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/05/simple-load-balancing-with-iptables.html' title='simple load balancing with iptables'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-135517846854400539</id><published>2008-05-10T04:57:00.000-07:00</published><updated>2009-01-29T02:43:47.081-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Patches'/><title type='text'>clamsmtp  rbl support patch</title><content type='html'>clamsmtp is  lightweight anti virus smtp proxy. You can put it in front or back of your smtp server. But if you run it in front of your smtp server and relay traffic back to your original smtp server, you cannot use any rbl server.&lt;br /&gt;&lt;br /&gt;So, I decided to write a patch which  adds this new rbl option to clamsmtpd server. You can download patch from here &lt;a href="http://lserinol.googlepages.com/clamsmtprbl"&gt; clamsmtp rbl patch &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-135517846854400539?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/135517846854400539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=135517846854400539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/135517846854400539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/135517846854400539'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/05/clamsmtp-rbl-support-patch.html' title='clamsmtp  rbl support patch'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-1471265779918251970</id><published>2008-05-06T10:11:00.000-07:00</published><updated>2009-01-29T02:39:31.390-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='qmail'/><title type='text'>qmail  linefeed problems hotmail , dcc and others</title><content type='html'>While I was testing &lt;a href="http://www.rhyolite.com/anti-spam/dcc/"&gt;DCC Checksum&lt;/a&gt; , I discovered that some email messages are truncated and dcc reports that body part is missing with an error message "missing message body". I figured out that not only the body part is missing also the headers also truncated. &lt;br /&gt;&lt;br /&gt; A quick investigation with tcpdump showed that spamc is sending truncated messages to spamd server which is passed to dcc server. A second tcpdump run on smtp server showed that some messages is rejected by qmail server with "451 See http://pobox.com/~djb/docs/smtplf.html." message. This was hitting a small amount of mails but the ones especially coming from hotmail.com.&lt;br /&gt;&lt;br /&gt;I have quickly fixed the problem with djb's &lt;a href="http://cr.yp.to/ucspi-tcp/fixcrio.html"&gt;fixcrio&lt;/a&gt; application which comes with DJB's ucspi-tcp package. No more "missing message body" error messages anymore with dcc :)&lt;br /&gt;&lt;br /&gt;Running fixcrio is easy. Just put the command before qmail-smtpd where you run it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-1471265779918251970?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/1471265779918251970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=1471265779918251970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1471265779918251970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/1471265779918251970'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/05/qmail-linefeed-problems-hotmail-dcc-and.html' title='qmail  linefeed problems hotmail , dcc and others'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-6951080112590936760</id><published>2008-05-01T12:04:00.000-07:00</published><updated>2009-01-29T02:39:39.938-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VI'/><title type='text'>VI tricks part one</title><content type='html'>I have finished first part of my VI editor tricks article. Part one explains main commands and tricks like sort data, replacing selected lines and feeding vi document content as input to any program while getting output as new document.&lt;br /&gt;You can read &lt;a href="http://lserinol.googlepages.com/vitrickspart1"&gt; VI tricks part one&lt;/a&gt; here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-6951080112590936760?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/6951080112590936760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=6951080112590936760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6951080112590936760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/6951080112590936760'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/05/vi-tricks-part-one.html' title='VI tricks part one'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-2402605904209313243</id><published>2008-04-20T10:03:00.000-07:00</published><updated>2009-01-29T02:39:51.806-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Freebsd'/><title type='text'>FreeBSD GJournal (Filesystem Journal)</title><content type='html'>Freebsd 7.0 has a new geom extenstion called  &lt;a href="http://www.freebsd.org/doc/en/books/handbook/geom-gjournal.html"&gt;gjournal&lt;/a&gt;. You can easily create a journaled filesystem with gjournal on bsd systems. &lt;br /&gt;First of all, gjournal support has to be built in kernel. It's currently built in 7.x series. The kernel option is called UFS_GJOURNAL&lt;br /&gt;&lt;br /&gt;You should disable soft updates on filesystems where gjournal is used. Because journalling takes place and there is no need to use soft updates for data recovery on a crash.&lt;br /&gt;&lt;br /&gt;While the filesystem is journalled, the mount option async will boost the performance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example, let's say we have a disk called ad1 and it has existing filesystem on it.&lt;br /&gt;&lt;br /&gt;All we have to do is create a label. &lt;br /&gt;&lt;br /&gt;# gjournal label -f /dev/ad1&lt;br /&gt;&lt;br /&gt;notice the -f option. It will force convert operation of an  existing file system to journal. Journal device will be separate and called in this example as /dev/ad1.journal.&lt;br /&gt;&lt;br /&gt;now it's time to load geom gjournal kernel module.&lt;br /&gt;&lt;br /&gt;# gjournal load&lt;br /&gt;&lt;br /&gt;now add journalling support to our existing filesystem.&lt;br /&gt;&lt;br /&gt;# tunefs -J enable /dev/ad1.journal&lt;br /&gt;&lt;br /&gt;it's better now to disable soft updates.&lt;br /&gt;&lt;br /&gt;# tunefs -n disable /dev/ad1.journal&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;now we mount our new journalled filesystem with async option.&lt;br /&gt;&lt;br /&gt;# mount  -o asyn /dev/ad1.journal /mnt&lt;br /&gt;&lt;br /&gt;in our example, we don't have any slices on our disk. In slice case new devices will be created (eg. /dev/ad1s1.journal)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-2402605904209313243?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/2402605904209313243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=2402605904209313243' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2402605904209313243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/2402605904209313243'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/04/freebsd-gjournal-filesystem-journal.html' title='FreeBSD GJournal (Filesystem Journal)'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-4766942994236966008</id><published>2008-02-05T12:33:00.000-08:00</published><updated>2009-01-29T02:44:51.099-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Patches'/><title type='text'>Sqlite compression</title><content type='html'>Sqlite database has no built-in compression support. But it has a feature called loadable extension, which let's developers to create any addon feature for sqlite database. I have wrote some documentation about sqlite loadable extension and how to add compress/uncompress ability to sqlite database to compress your data's on the fly.&lt;br /&gt;Here is &lt;a href="http://lserinol.googlepages.com/sqlitecompress"&gt;my article&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-4766942994236966008?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/4766942994236966008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=4766942994236966008' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/4766942994236966008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/4766942994236966008'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/02/sqlite-compression.html' title='Sqlite compression'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-7218341048137073103</id><published>2008-01-13T00:04:00.000-08:00</published><updated>2009-01-29T02:44:20.531-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Patches'/><title type='text'>ucspi-tcp mysql patch</title><content type='html'>Finally, I had spare time to finish my &lt;a href="http://lserinol.googlepages.com/tcpservermysql.htm"&gt; ucspi-tcp mysql patch &lt;/a&gt;. Putting tcpserver rules in a mysql table has many advantages like centralized access rule lists and easy management.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-7218341048137073103?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/7218341048137073103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=7218341048137073103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7218341048137073103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/7218341048137073103'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2008/01/ucspi-tcp-mysql-patch.html' title='ucspi-tcp mysql patch'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1610041778732887994.post-141133055139680009</id><published>2007-09-12T05:02:00.000-07:00</published><updated>2009-01-29T02:40:28.869-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><title type='text'>prevent caching of swf,flv or other files</title><content type='html'>The header fields Cache-Control and Pragma can be used to cache or prevent caching of web content.  Using this header fields on html meta tags doesn't seem to work. Forcing them from http server, seems the best way that works with Internet Explorer.&lt;br /&gt;&lt;br /&gt;Following example shows how to configure no cache option on Apache web servers&lt;br /&gt;You should add following statements into your httpd.conf file (mod_header should be enabled of course)&lt;br /&gt;&lt;br /&gt;Header set Cache-Control "no-cache, must-revalidate"&lt;br /&gt;Header set Pragma no-cache&lt;br /&gt;&lt;br /&gt;Another example in php language&lt;br /&gt;&lt;br /&gt; header("Cache-Control: no-cache, must-revalidate");&lt;br /&gt; header("Pragma: no-cache");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For further details and how to configure IIS server please see  &lt;a href="http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q234/0/67.ASP&amp;amp;NoWebContent=1%29"&gt;this&lt;/a&gt; article on Microsoft's site.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1610041778732887994-141133055139680009?l=lserinol.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lserinol.blogspot.com/feeds/141133055139680009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1610041778732887994&amp;postID=141133055139680009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/141133055139680009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1610041778732887994/posts/default/141133055139680009'/><link rel='alternate' type='text/html' href='http://lserinol.blogspot.com/2007/09/prevent-caching-of-swfflv-or-other.html' title='prevent caching of swf,flv or other files'/><author><name>Levent Serinol</name><uri>https://profiles.google.com/108921201928469162999</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-1WoenUGwywA/AAAAAAAAAAI/AAAAAAAAAYk/Q0Md3QqUsTc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
