<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>vyatta</title>
	<atom:link href="http://mohitsuley.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mohitsuley.wordpress.com</link>
	<description>open thought and learning</description>
	<lastBuildDate>Wed, 30 Sep 2009 05:54:41 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mohitsuley.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/a4136d932f57a3f7a9d1b395afd96ebe?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>vyatta</title>
		<link>http://mohitsuley.wordpress.com</link>
	</image>
			<item>
		<title>Standard Deviation and Degrees of Freedom</title>
		<link>http://mohitsuley.wordpress.com/2009/09/30/standard-deviation-and-degrees-of-freedom/</link>
		<comments>http://mohitsuley.wordpress.com/2009/09/30/standard-deviation-and-degrees-of-freedom/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 05:54:41 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[mathematics]]></category>
		<category><![CDATA[deviation]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=128</guid>
		<description><![CDATA[In order to brush up some elementary statistics, I decided to read more about standard deviation as a measure of variability. What I couldn&#8217;t understand initially was the difference between

as &#8217;standard deviation of a sample&#8217;, and &#8230;

which is &#8217;sample standard deviation&#8217;.The difference here lies in the denominator &#8211; n versus n-1.
The wikipedia article on SD [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=128&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In order to brush up some elementary statistics, I decided to read more about standard deviation as a measure of variability. What I couldn&#8217;t understand initially was the difference between</p>
<p><img class="alignnone" src="http://upload.wikimedia.org/math/6/1/6/616b3bfb2e10653483fa05b3ecab46ef.png" alt="" width="187" height="60" /></p>
<p>as &#8217;standard deviation of a sample&#8217;, and &#8230;</p>
<p><img class="alignnone" src="http://upload.wikimedia.org/math/8/5/3/853c79575bd7e5a9fdbc480844b76337.png" alt="" width="217" height="60" /></p>
<p>which is &#8217;sample standard deviation&#8217;.The difference here lies in the denominator &#8211; <em>n</em> versus<em> n-1</em>.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Standard_deviation" target="_blank">wikipedia</a> article on SD calls it Bessel&#8217;s correction and the wiki entry on that is equally impenetrable, only for qualified mathematicians. Here&#8217;s a more plausible (in my own words) explanation of the reason behind reducing <em>n</em> to <em>n-1</em> that I read in the book &#8216;How to think about statistics&#8217;:</p>
<p>Enter <strong>Degrees of Freedom</strong>.</p>
<p>They are essentially values of data, or scores, that are free to vary. Consider a set of 5 numbers. If you were asked to guess those numbers, you could theoretically be free to think of any number. Let&#8217;s say that the first number is 3. What&#8217;s the second number? Again, you could think of anything. Let&#8217;s say you come up with 4 (let&#8217;s keep it simple); and so on (3, 4, 5 and 7). Now, assuming you know the mean (5 for our example) of the scores, what could be the missing value? There&#8217;s only one possible number &#8211; 6.</p>
<p>So, if you know the mean of a set of scores with a single value missing, you are no longer free to select its value and the only way to <em>determine</em> value for the 5th score is by using the remaining 4 scores. That&#8217;s the <em>n-1 </em>right there.</p>
<p>When you calculate the mean of a set of scores, all scores were free to have whichever values they were. So you divide them by <em>n</em> and get a mean for that set of scores. Remember, when you calculate the mean for score(s), your degrees of freedom remains <em>n. </em></p>
<p>When you calculate standard deviation, you are not using those independent values, but the <em>mean</em> as well! If you had a score missing, using the mean would have been fine. However, in order to ensure our standard deviation isn&#8217;t biased and is based on &#8216;truly independent&#8217; scores, you have to make corrections for the loss of a single degree of freedom.</p>
<p>Which is why an &#8216;accurate&#8217; formula for standard deviation will have <em>n-1</em> and not <em>n. </em>The reason this is usually ignored is that the effect on standard deviation for a large set of scores doesn&#8217;t really change that much. A sample of 100 scores will only have 1% difference on the number of samples to be used.</p>
<p>I know I sound like a complete novice at this &#8211; I am. Knowing mathematics and actually writing about it are two completely different things. Let&#8217;s see if I can learn both (wink).</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=128&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2009/09/30/standard-deviation-and-degrees-of-freedom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>

		<media:content url="http://upload.wikimedia.org/math/6/1/6/616b3bfb2e10653483fa05b3ecab46ef.png" medium="image" />

		<media:content url="http://upload.wikimedia.org/math/8/5/3/853c79575bd7e5a9fdbc480844b76337.png" medium="image" />
	</item>
		<item>
		<title>Session persistence and OneConnect on the BigIP LTM</title>
		<link>http://mohitsuley.wordpress.com/2009/07/23/session-persistence-and-oneconnect-on-the-bigip-ltm/</link>
		<comments>http://mohitsuley.wordpress.com/2009/07/23/session-persistence-and-oneconnect-on-the-bigip-ltm/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 06:38:29 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[networks]]></category>
		<category><![CDATA[F5]]></category>
		<category><![CDATA[ltm]]></category>
		<category><![CDATA[persistence]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=120</guid>
		<description><![CDATA[It is standard practice to use the Insert Cookie mechanism to enable persistence on a virtual server on a BigIP LTM. However, that can be an expensive task for the load-balancer; inserting cookies takes CPU. Another way is to use an existing cookie that already marks your session and use cookie hashing. One example is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=120&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It is standard practice to use the Insert Cookie mechanism to enable persistence on a virtual server on a BigIP LTM. However, that can be an expensive task for the load-balancer; inserting cookies takes CPU. Another way is to use an existing cookie that already marks your session and use cookie hashing. One example is the JSESSIONID cookie set by application servers such as Tomcat.</p>
<p>All you need to do is:</p>
<p>1. Go to Profiles -&gt; Persistence -&gt; Create New&#8230;<br />
2. Using the cookie profile as the base, create one and mark it as Custom<br />
3. Change the type to Cookie Hash and put in the cookie name<br />
4. You can put in values for offset and length (for example, 1 and 32)<br />
5. Go to Virtual Servers -&gt; Your Virtual Server<br />
6. Make sure client profile is HTTP<br />
7. Under the Resources tab change the default persistence mechanism to the one you just created. </p>
<p>Viola! </p>
<p>But, you&#8217;ll soon notice it doesn&#8217;t really work as expected, especially when your clients are behind a proxy; why? If the source address of the client requests are the same and there&#8217;s already a TCP connection running, the LTM will forward that request there without even looking at the cookie. This is done to help performance. However, since you naturally need to accommodate proxies and such connections, make sure the HTTP Profile on your virtual server is OneConnect. That will make sure each of your requests get scanned and forwarded based on the cookie value and not the source IP address. </p>
<p>This is well-documented in the manual, but doesn&#8217;t seem to appear when I google/bing around. And for trigger-happy folks like me who don&#8217;t RTFM and start experimenting, this just might save 5 or 10 minutes. </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=120&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2009/07/23/session-persistence-and-oneconnect-on-the-bigip-ltm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>TCP/IP Drinking Game</title>
		<link>http://mohitsuley.wordpress.com/2009/04/14/tcpip-drinking-game/</link>
		<comments>http://mohitsuley.wordpress.com/2009/04/14/tcpip-drinking-game/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 18:52:26 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[networks]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=116</guid>
		<description><![CDATA[After a long hiatus from my activity here, I have decided on two things:
1. Blog entries can be short
2. They need to be more frequent &#8211; for my own sanity as well.
I plan to read and take cues from the TCP/IP Drinking Game and learn the nuances of the protocol a bit more. There are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=116&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After a long hiatus from my activity here, I have decided on two things:</p>
<p>1. Blog entries can be short</p>
<p>2. They need to be more frequent &#8211; for my own sanity as well.</p>
<p>I plan to read and take cues from the <a title="The TCP/IP Drinking Game" href="http://valerieaurora.org/tcpip.html" target="_blank">TCP/IP Drinking Game</a> and learn the nuances of the protocol a bit more. There are some interesting things I learnt which I will write about, later.</p>
<p>That&#8217;s it for now. Ciao!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=116&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2009/04/14/tcpip-drinking-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>disown and nohup</title>
		<link>http://mohitsuley.wordpress.com/2008/08/21/disown-and-nohup/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/21/disown-and-nohup/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 22:09:52 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=110</guid>
		<description><![CDATA[This is the first time I started a file transfer, and on hindsight, struck my head and said &#8220;Wish I&#8217;d started this with nohup or screen&#8230;&#8221;; I could have left home on time with this laptop tagging along with me. 
What I didn&#8217;t know *then* (now I know) that there&#8217;s a beautiful bash built-in called [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=110&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is the first time I started a file transfer, and on hindsight, struck my head and said &#8220;Wish I&#8217;d started this with nohup or screen&#8230;&#8221;; I could have left home on time with this laptop tagging along with me. </p>
<p>What I didn&#8217;t know *then* (now I know) that there&#8217;s a beautiful bash built-in called <code>disown</code> which can attch any/all running jobs to the init process. Yay! </p>
<p><code><br />
[root@linux-test data]# scp RHEL4-U5-i386-AS-disc4.iso suleym@192.168.1.1:/appl/RHEL-AS4/<br />
suleym@192.168.1.1's password:<br />
RHEL4-U5-i386-AS-disc4.iso                                                                                                    0% 1016KB   1.0MB/s   06:21 ETA<br />
[1]+  Stopped                 scp RHEL4-U5-i386-AS-disc4.iso suleym@192.168.1.1:/appl/RHEL-AS4/<br />
[root@linux-test data]# bg<br />
[1]+ scp RHEL4-U5-i386-AS-disc4.iso suleym@3.122.220.169:/appl/RHEL-AS4/ &amp;<br />
[root@linux-test data]# disown -h<br />
</code></p>
<p>More about disown <a href="http://wiki.linuxquestions.org/wiki/Disown">here</a> and in <code>man bash</code>. </p>
<p>Writing this post for the sake of not reverse-engineering searches on Google, and so that people see <code>disown </code>*related* to <code>nohup</code>. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/110/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/110/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=110&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/21/disown-and-nohup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>Semaphore problems on Apache</title>
		<link>http://mohitsuley.wordpress.com/2008/08/16/semaphore-problems-on-apache/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/16/semaphore-problems-on-apache/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 02:08:12 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[semaphores]]></category>
		<category><![CDATA[siteminder]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=105</guid>
		<description><![CDATA[I came across a simple but intriguing problem &#8211; apachectl restart  will work and restart apache processes, and in my case restart the CA/Netegrity Siteminder agent as well. However, the server didn&#8217;t respond, and neither were there any messages on the error log. SM logs said the agent initialized successfully. 
When I remove mod_sm.so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=105&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I came across a simple but intriguing problem &#8211; <code>apachectl restart </code> will work and restart apache processes, and in my case restart the CA/Netegrity Siteminder agent as well. However, the server didn&#8217;t respond, and neither were there any messages on the error log. SM logs said the agent initialized successfully. </p>
<p>When I remove <code>mod_sm.so</code> and restart apache (after removing environment variables related to SM), everything worked just fine. I naturally assumed that the problem was with this module that I just removed. </p>
<p>It turned out that the problem was with this particular <code>semaphore</code> which didn&#8217;t release since about the last 24 hours, and was somehow linked to the siteminder agent module. After I did an <code>ipcrm -s ID</code>, everything was working fine as before. </p>
<p>I always thought semaphores/shared memory segments not freeing up will result in apache not restarting successfully. This is the first time apache didn&#8217;t complain on a restart, no logs displayed any errors, &#8216;removing&#8217; a module rectified the error, and putting it back actually made the issue recur! </p>
<p>Need to learn more about semaphore allocation in linux. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/105/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/105/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=105&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/16/semaphore-problems-on-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>Tuning a JVM for Berkeley DB Java Edition</title>
		<link>http://mohitsuley.wordpress.com/2008/08/08/tuning-a-jvm-for-berkeley-db-java-edition/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/08/tuning-a-jvm-for-berkeley-db-java-edition/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 21:30:12 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bdb]]></category>
		<category><![CDATA[berkeleydb]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[jvm-tuning]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=98</guid>
		<description><![CDATA[For those who not have heard about Berkeley DB (called BDB): it is a transactional storage engine with basic key/value pairs, very agile and highly performance-oriented, with no SQL-like engine. Compared to it&#8217;s native version, the Java Edition has quite a few differences and is useful when it is to be integrated with a basic [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=98&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For those who not have heard about <a href="http://en.wikipedia.org/wiki/Berkeley_DB">Berkeley DB</a> (called BDB): it is a transactional storage engine with basic key/value pairs, very agile and highly performance-oriented, with no SQL-like engine. Compared to it&#8217;s native version, the <a href="http://www.oracle.com/technology/products/berkeley-db/index.html">Java Edition</a> has quite a few differences and is useful when it is to be integrated with a basic Java application.</p>
<p>The aim of the database is to be available in RAM all the time as much as possible, so that all query responses are fast. Based on this, here&#8217;s my take on tuning the JVM that hosts the BDB:</p>
<ul>
<li>JVM heap size should be around the same size as the data store</li>
<li>Use the Concurrent Mark/Sweep GC algorithm to have low-pause GC times</li>
<li>Since most of the objects are going to be living &#8216;forever&#8217;, it&#8217;ll make sense to have a huge <em>tenured </em>generation</li>
<li>If the DB size can vary, refrain from giving Xmx and Xms the same values. Give a huge difference so that the JVM can manage it as your data grows</li>
</ul>
<p>This is what CATALINA_OPTS might look like (includes a lot of debug flags as well):<br />
<code><br />
CATALINA_OPTS="-server -Xms1024m -Xmx4096m  -XX:+UseMembar -XX:+PrintGCDetails -<br />
XX:+PrintGCApplicationStoppedTime -XX:NewRatio=4 -XX:+UseConcMarkSweepGC -verbos<br />
e:gc -Xloggc:/appl/tomcat/logs/gcdata.txt"<br />
</code></p>
<p><code>-XX+UseMemBar</code> is there to accomodate for the high IO waits I had been seeing &#8211; I think there&#8217;s a problem in linux with the JDK using <a href="http://en.wikipedia.org/wiki/Memory_barrier">memory barriers</a>. I read about the bug <a href="http://article.gmane.org/gmane.comp.cms.sakai.devel/18109">here</a>.</p>
<p>BDB Java Edition is <em>not </em>a replacement for a traditional database, but is a means to have almost immediate results for things like look-up data, subscriptions and most frequently-used information. There are quite a number of on-line resources available to help you set it up and use it &#8211; native or Java, whichever your flavor is.</p>
<p><a href="http://en.wikipedia.org/wiki/Memcached">memcached </a>is another such tool that is useful when improving performance for an application-database connection.  More on it in another post some other time.</p>
<p>Cheers!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=98&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/08/tuning-a-jvm-for-berkeley-db-java-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>Making SSI work on a JSP response</title>
		<link>http://mohitsuley.wordpress.com/2008/08/07/making-ssi-work-on-a-jsp-response/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/07/making-ssi-work-on-a-jsp-response/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 01:15:24 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mod_filter]]></category>
		<category><![CDATA[mod_include]]></category>
		<category><![CDATA[ssi]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=85</guid>
		<description><![CDATA[If you need to parse SSI from a JSP response, there are two simple ways to do it:
1. Use the SSIServlet and handle it within tomcat
2. If you have a separate web server like Apache in front of tomcat, and you want that web server to do it, the plot thickens.
If you ask, &#8216;why, when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=85&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you need to parse SSI from a JSP response, there are two simple ways to do it:</p>
<p>1. Use the <code>SSIServlet</code> and handle it within tomcat<br />
2. If you have a separate web server like Apache in front of tomcat, and you want that web server to do it, the plot thickens.</p>
<p>If you ask, &#8216;<em>why, when you are already using Java? You can do all that you can do with SSI in a JSP, right?</em>&#8216;, you might be surprised. Let&#8217;s just say the reason is out-of-scope for this post.</p>
<p>So, you have a three-tier architecture with web servers spread across the world and app/DB servers local to certain data-centers. Naturally, you might want to &#8216;assimilate&#8217; content on the web servers (closest to local users based on 3DNS/similar) where it&#8217;s already present instead of shuttling bytes back-and-forth between the web and app layers. That&#8217;s the reason. And did I say earlier it was out of scope? My bad.</p>
<p>The way you would do it is set up Apache on a specific Location to grab for, put an <code>AddOutputFilterByType</code> statement with the MIME type as <code>text/x-server-parsed-html</code> and finally, on the JSP itself, you will set the MIME type using <code>setContentHeader</code> for the response.</p>
<p>Your <code>Location</code> section might look like this:<br />
<code><br />
&lt;Location /application/ssiparser &gt;<br />
        Options +Includes<br />
        AddOutputFilterByType INCLUDES;DEFLATE text/x-server-parsed-html<br />
&lt;/Location&gt;<br />
</code><br />
In an ideal scenario, everything should have been hunky-dory, but life isn&#8217;t so simple. At least it didn&#8217;t happen so easily for me.</p>
<p>What I had done earlier was, in order to make certain performance improvements,   added a <code>CompressionFilter</code> on tomcat to gzip all responses from it so that the app-web performance improves as well. This meant that once the response reached Apache it would already be gzipped and SSI parsing would not be possible. Mind you, this is Apache 2.0.x and not 2.2.x where you can actually set up <a href="http://httpd.apache.org/docs/2.2/mod/mod_filter.html#filterdeclare">FilterDeclare</a> and such.</p>
<p>There are two ways to get around this problem:</p>
<p>1. Get the <code>CompressionFilter</code> to exclude the <code>Location</code> you have on for SSI, and then pass on <code>INCLUDES;DEFLATE</code> to <code>AddOutputFilterByType</code>.<br />
2. Or, unset the <code>Accept-Encoding</code> header on the request first so that it doesn&#8217;t take gzip and the <code>CompressionFilter</code> doesn&#8217;t compress it at all. If I try to deflate it again now, it doesn&#8217;t happen.</p>
<p>The problem with (2) is that you end up sending decompressed data across. Option (1) would be the right way to go.</p>
<p>(1) will entail a change on the web.xml for your application. </p>
<p>(2) will look like this:<br />
<code><br />
&lt;Location /application/ssiparser &gt;<br />
        Options +Includes<br />
        RequestHeader unset Accept-Encoding<br />
        RequestHeader set Accept-Encoding deflate<br />
        AddOutputFilterByType INCLUDES;DEFLATE text/x-server-parsed-html<br />
&lt;/Location&gt;<br />
<code></p>
<p>The JSP will start with:<br />
<code><br />
&lt;%<br />
response.setHeader(&quot;Content-Type&quot;,&quot;text/x-server-parsed-html&quot;);<br />
%&gt;<br />
&lt;!--#include virtual=&quot;/static/content/news.html&quot;--&gt;<br />
&lt;!--#include virtual=&quot;/static/content/weather.html&quot;--&gt;<br />
&lt;!--#include virtual=&quot;/static/content/media.html&quot;--&gt;<br />
</code></p>
<p>Most folks do not upgrade Apache as they do with other kinds of software, just because it's so damn stable and fulfills your requirements very well. However, I feel if you need to work with filters and play around with them, 2.2 will be the way to go.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/85/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/85/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=85&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/07/making-ssi-work-on-a-jsp-response/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>OpenDeploy rollback across a WAN</title>
		<link>http://mohitsuley.wordpress.com/2008/08/06/opendeploy-rollback-across-a-wan/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/06/opendeploy-rollback-across-a-wan/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 21:04:04 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[keepalive]]></category>
		<category><![CDATA[opendeploy]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=79</guid>
		<description><![CDATA[While working on Interwoven OpenDeploy I came across the following problem:
Large deployments or file-pushes spanning a WAN or a continent used to sometimes time-out or roll back. The problem was noted where there was a significant difference of size between file lists.
This is what happens:

OD starts n threads based on the n lists of files [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=79&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>While working on Interwoven <a href="http://www.interwoven.com/components/page.jsp?topic=PRODUCT::OPENDEPLOY">OpenDeploy</a> I came across the following problem:</p>
<p>Large deployments or file-pushes spanning a WAN or a continent used to sometimes time-out or roll back. The problem was noted where there was a significant difference of size between file lists.</p>
<p><strong>This is what happens:</strong></p>
<ol>
<li>OD starts n threads based on the n lists of files to be deployed.</li>
<li>Thread 1 finishes and the remaining n-1 threads continue file transfer.</li>
<li>After exactly 5 minutes, thread 1 times out (shows a TCP packet with RST flag set on tcpdump) and after all threads finish, the deployment fails and rolls back the transaction.</li>
</ol>
<p><strong>Root cause: </strong><br />
Some network device on the way times out TCP idle sessions more than 300 seconds and sends an RST flag, dropping the connection essentially. When this happens, OpenDeploy considers the transaction corrupt and rolls it back.</p>
<p><strong>Fix</strong></p>
<ol>
<li>Get the firewall to extend the timeout to a more reasonable time (perhaps similar to the default tcp_keepalive_time of 7200 seconds?)  &#8211; not practically possible if a number of teams are involved.</li>
<li>Change tcp_keepalive_time to ~200 seconds</li>
<li>If the keepalive change does not help alone, try http://libkeepalive.sourceforge.net . Works like a charm!</li>
</ol>
<p>Generally speaking, and not being &#8216;opendeploy-centric&#8217;, I did learn the importance of keepalive packets and how the default value of 7200 seconds might not be practical when an application talks to servers across network borders.</p>
<p><em>Thanks to my colleague Prajal Sutaria for working on this!</em> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/79/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/79/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=79&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/06/opendeploy-rollback-across-a-wan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>Caching problems with SAML</title>
		<link>http://mohitsuley.wordpress.com/2008/08/01/caching-problems-with-saml/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/01/caching-problems-with-saml/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 16:18:05 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[saml]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=61</guid>
		<description><![CDATA[Anyone who has worked with SAML knows very well how effective and simple it is to achieve federated services with your own authentication mechanism. What needs to be remembered, though, is that end-users might very well be behind firewalls. And with that come proxies; and those proxies open up the Pandora&#8217;s box aka cache. 
Proxies [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=61&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Anyone who has worked with <a href="http://en.wikipedia.org/wiki/SAML">SAML</a> knows very well how effective and simple it is to achieve federated services with your own authentication mechanism. What needs to be remembered, though, is that end-users might very well be behind firewalls. And with that come proxies; and those proxies open up the Pandora&#8217;s box aka cache. </p>
<p>Proxies can cache POST response from the authentication user agent and make user1 see a page which says &#8216;Welcome user2&#8242;. Do a forced-refresh (Ctrl-F5, Cmd-R) on the browser, and you can see your own ID again. </p>
<p>Fixes:<br />
1. Ensure proxies don&#8217;t cache any content for your authentication domain.<br />
2. Pass a &#8216;random&#8217; value like the timestamp using Javascript to the URL (to make it unqiue)<br />
3. Force the content-provider&#8217;s web server, and the user agent web server to set Cache-Control to max-age=0 and proxy-revalidate.<br />
4. Make sure you&#8217;re sending an invalidation string in the packet as well. </p>
<p>Clearing proxies in a company with about ~100 proxy servers might not be the right choice. The onus should lie on the development and the sysadmin team to make sure important pages are non-cacheable. <code>Never trust proxy servers</code> is the motto here. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/61/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/61/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=61&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/01/caching-problems-with-saml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
		<item>
		<title>Pinging hostnames from /etc/hosts</title>
		<link>http://mohitsuley.wordpress.com/2008/08/01/pinging-hostnames-from-etchosts/</link>
		<comments>http://mohitsuley.wordpress.com/2008/08/01/pinging-hostnames-from-etchosts/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 04:26:12 +0000</pubDate>
		<dc:creator>mohitsuley</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://mohitsuley.wordpress.com/?p=57</guid>
		<description><![CDATA[Problem Statement: Ability to ping a user-defined hostname with a valid IP address
Solution: Simple, put it in the /etc/hosts file and you&#8217;re done. 
You still can&#8217;t do it; did you check nsswitch.conf? This is what should be there: hosts:          files dns .
So, with the right /etc/nsswitch.conf [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=57&subd=mohitsuley&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Problem Statement</strong>: Ability to ping a user-defined hostname with a valid IP address<br />
<strong>Solution</strong>: Simple, put it in the <code>/etc/hosts</code> file and you&#8217;re done. </p>
<p>You still can&#8217;t do it; did you check <code>nsswitch.conf</code>? This is what should be there: <code>hosts:          files dns</code> .<br />
So, with the right <code>/etc/nsswitch.conf</code> and <code>/etc/hosts</code>, should it work?<br />
 <code><br />
root@treebeard:~# cat /etc/hosts<br />
127.0.0.1	localhost<br />
127.0.1.1	treebeard<br />
192.168.2.2 mithrandir<br />
</code></p>
<p><code><br />
root@treebeard:~# ping mithrandir<br />
PING mithrandir (192.168.2.2) 56(84) bytes of data.<br />
64 bytes from mithrandir (192.168.2.2): icmp_seq=1 ttl=64 time=0.092 ms<br />
64 bytes from mithrandir (192.168.2.2): icmp_seq=2 ttl=64 time=0.067 ms<br />
</code></p>
<p>It works!<br />
But&#8230;<br />
<code><br />
root@treebeard:~#sudo su - mohit<br />
mohit@treebeard:~$ ping mithrandir<br />
ping: unknown host<br />
</code></p>
<p>It seems when I switch to a non-root user, entries in <code>/etc/hosts</code> fail to take effect.<br />
Why? </p>
<p>The problem is with the read attributes on <code>/etc/nsswitch.conf</code>. I hadn&#8217;t noticed that it was world-unreadable.<br />
<code><br />
root@treebeard:~# chmod o+r /etc/nsswitch.conf<br />
root@treebeard:~#sudo su - mohit<br />
mohit@treebeard:~$ ping mithrandir<br />
mohit@treebeard:~$ ping mithrandir<br />
PING mithrandir (192.168.2.2) 56(84) bytes of data.<br />
64 bytes from mithrandir (192.168.2.2): icmp_seq=1 ttl=64 time=0.092 ms<br />
64 bytes from mithrandir (192.168.2.2): icmp_seq=2 ttl=64 time=0.067 ms<br />
</code></p>
<p>Worked, finally. The weird thing is I would have assumed ping to complain that it wasn&#8217;t able to read a file or something, but there was nothing of that sort. This means you can actually force a user to stick to DNS resolution and all daemons and root-owned processes to leverage <code>/etc/hosts</code>. </p>
<p>Bad idea I&#8217;d say. This might be a ticking time-bomb. I faced this problem when configuring two nodes for a 10g RAC cluster. The DB runs as a user, and the DBA had a tough time getting the private interconnect working &#8211; thanks to nsswitch.conf. </p>
<p>Lesson learnt. </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mohitsuley.wordpress.com/57/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mohitsuley.wordpress.com/57/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mohitsuley.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mohitsuley.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mohitsuley.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mohitsuley.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mohitsuley.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mohitsuley.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mohitsuley.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mohitsuley.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mohitsuley.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mohitsuley.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mohitsuley.wordpress.com&blog=4279079&post=57&subd=mohitsuley&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mohitsuley.wordpress.com/2008/08/01/pinging-hostnames-from-etchosts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b45721263f8c0d2972c400626279f72c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mohitsuley</media:title>
		</media:content>
	</item>
	</channel>
</rss>