<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>Solution Hacker &#187; OutOfMemoryException</title>
	<atom:link href="http://www.solutionhacker.com/tag/outofmemoryexception/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.solutionhacker.com</link>
	<description>This blog provides solutions for enterpreneurs!</description>
	<lastBuildDate>Mon, 06 Feb 2012 07:19:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=447</generator>
<!-- podcast_generator="Blubrry PowerPress/2.0.4" -->
	<itunes:summary>This blog provides solutions for enterpreneurs!</itunes:summary>
	<itunes:author>Solution Hacker</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.solutionhacker.com/wp-content/plugins/powerpress/itunes_default.jpg" />
	<itunes:subtitle>This blog provides solutions for enterpreneurs!</itunes:subtitle>
	<image>
		<title>Solution Hacker &#187; OutOfMemoryException</title>
		<url>http://www.solutionhacker.com/wp-content/plugins/powerpress/rss_default.jpg</url>
		<link>http://www.solutionhacker.com</link>
	</image>
		<item>
		<title>How to pick a good web hosting company for Java webapp</title>
		<link>http://www.solutionhacker.com/implement-your-idea/build-your-website/java-hosting/</link>
		<comments>http://www.solutionhacker.com/implement-your-idea/build-your-website/java-hosting/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 09:12:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Site Building]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[Heap size]]></category>
		<category><![CDATA[jsp hosting]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[OutOfMemoryException]]></category>
		<category><![CDATA[PermGen]]></category>
		<category><![CDATA[private jvm]]></category>
		<category><![CDATA[rimuhosting]]></category>
		<category><![CDATA[shared jvm]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[system tuning]]></category>
		<category><![CDATA[tomcat hosting]]></category>
		<category><![CDATA[westhost]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.solutionhacker.com/?p=200</guid>
		<description><![CDATA[<p>I currently use <strong>Dreamhost </strong>for my own company "JustProposed.com" that is powered by typical LAMP solution. It is a great shared hosting solution but it doesn't support website powered by Java. If you have Java website, I suggest you to try a web hosting company that provides you <strong>VPS </strong>(Virtual Private Server) solution. VPS occupies a middle ground between a <strong>dedicated server</strong> and <strong>regular shared hosting</strong>. You get the features  of dedicated hosting in a shared environment. In other words, your virtual server runs on one of host servers. The host server runs a number of virtual servers.&#160; Each virtual server shares the   host server's memory, CPU, Internet connection and other resources. No one    VPS can monopolize resources.&#160; Each VPS gets a guaranteed share of the server   CPU, disk IO and network.</p>
<p><!--more--></p>
<p>Before you pick a good web hosting company for your java webapp, you better get familiar with the system need of your webapp first. There are some interesting topics that you may encounter:</p>
<ol>
    <li><strong>Shared JVM vs Private JVM</strong> - The two biggest problems with shared Java hosting are <strong>memory leaks</strong> and <strong>security</strong>. If someone has a memory leak or code that is a high user of memory in a shared environment, all of the people sharing that JVM suffer the same memory problems.&#160; Apart from that, it is not secure. Therefore, you don't want to share the same JVM with other users although it is cheaper. One more disadvantage of Shared JVM is that you cannot <strong>restart </strong>the Tomcat as you wish.</li>
    <li><strong>PermGen space</strong> (default = 64MB) is used for things that do not change (or change often). e.g. Java classes.&#160; So often large, complex apps will need lots of PermGen space. Similarly if you are doing frequent war/ear/jar deployments to running servers like Tomcat or JBoss you may need to issue a server <strong>restart </strong>after a few deploys or increase your PermGen space. To increase the PermGen space use something like: <strong>-XX:MaxPermSize=128m</strong></li>
    <li><strong>Heap size setting</strong> - Java has a couple of settings that help control how much memory it uses:
    <ul>
        <li><strong>-Xms</strong> sets the minimum memory heap size.</li>
        <li><strong>-Xmx </strong>sets the maximum memory heap size. When setting the -Xmx setting you should consider a few things...&#160; -Xmx has to be enough for you to run your app.&#160; If it is set too low then you may get Java <strong>OutOfMemory</strong> exceptions (even when there is sufficient spare memory on the server).</li>
        <li><span id="intelliTxt">We typically specify the same amount of memory for both flags (-Xms and -Xmx) to force the server to use all the allocated memory from startup. This way, the JVM wouldn't need to dynamically change the heap size at runtime, which is a leading cause of JVM instability.</span></li>
        <li><span id="intelliTxt">If you don't specify a memory size in the JVM startup flags, the JVM would limit the heap memory to 64MB (512MB on Linux), no matter how much physical memory you have on the server! </span></li>
        <li><span id="intelliTxt">For <strong>64-bit servers</strong>, make sure that you run a 64-bit JVM on top of a 64-bit operating system to take advantage of all RAM on the server. Otherwise, the JVM would only be able to utilize <strong>2GB or less </strong>of memory space. 64-bit JVMs are typically only available for<strong> JDK 5.0</strong>.</span></li>
        <li>Suggested memory size: PermGen + Max Heap =<strong> 256MB</strong>. Of course, the more you get the better! <img onclick="grin(':smile:');" alt=":smile:" src="../../../../../wp-includes/images/smilies/icon_smile.gif" /></li>
    </ul>
    </li>
    <li><strong>Garbage collection (GC)</strong> - <span id="intelliTxt">With a large heap memory, the garbage collection (GC) operation could become a major performance bottleneck. It could take more than ten seconds for the GC to sweep through a multiple gigabyte heap.</span>
    <ul>
        <li><strong><span id="intelliTxt">Single-threaded vs concurrent GC</span></strong><span id="intelliTxt"> - In JDK 1.3 and earlier, GC is a single threaded operation, which stops all other tasks in the JVM. That not only causes long and unpredictable pauses in the application, but it also results in very poor performance on multi-CPU computers since all other CPUs must wait in idle while one CPU is running at 100% to free up the heap memory space. It is crucial that we select a JDK 1.4+ JVM that supports <strong>parallel </strong>and <strong>concurrent </strong>GC operations. Actually, the concurrent GC implementation in the JDK 1.4 series of JVMs is not very stable. So, we strongly recommend you upgrade to JDK 5.0. </span></li>
        <li><strong><span>Pick a good GC algorithms</span></strong><span> - Parallel GC free up memory faster but longer pause</span>. Concurrent GC has shorter pause but doesn't free up all memory at once.</li>
    </ul>
    </li>
    <li><a href="http://rimuhosting.com/mod_jk2_and_mod_proxy_ajp.jsp">How to have your tomcat be available at port 80</a></li>
    <li><a href="http://www.onjava.com/pub/a/onjava/2006/11/01/scaling-enterprise-java-on-64-bit-multi-core.html">More on Java system tuning on multi-core server</a></li>
</ol>
<p><strong>Below are some of the great VPS options on the Net:</strong></p>
<p><a href="http://rimuhosting.com/index.jsp">RimuHosting.com</a> provides <a href="http://www.xen.org/">Xen</a>-based VPS. <strong>Xen </strong>is the <strong>virtualization </strong>technology that <strong>Amazon </strong>use for <strong>EC2</strong>.</p>
<ul>
    <li>Guaranteed 99.9% uptime</li>
    <li>They target at most, 8 customers per CPU core with 16% usage.</li>
    <li>The host server is 2U Supermicro with 32GB of memory, 8 2.4Ghz Xeon CPU cores and 4TB of disk space.</li>
    <li>You can get 256MB memory and 4GB disk space allocated for about $30.</li>
    <li>Great how to <a href="http://rimuhosting.com/support/howtolist.jsp">wiki </a>page</li>
</ul>
<p><a href="http://rimuhosting.com/index.jsp"> 				 					<span style="background-color: rgb(153, 51, 0);"><img src="http://www.solutionhacker.com/wp-content/uploads/image/rimuhosting.JPG" style="width: 286px; height: 48px;" alt="" /><br />
</span></a></p>
<p><a href="http://www.slicehost.com/why-slicehost/">SliceHost.com</a> also provides Xen-based VPS.</p>
<ul>
    <li>Guaranteed 99.9% uptime</li>
    <li>The host server is in 16GB memory, 64 bits, quad-core CPU with 8+ Ghz. RAID-10 disk storage with Gigabit network.</li>
    <li>You can get 256MB memory, 10GB disk space and 100GB bandwidth for about $20.<a href="http://rimuhosting.com/order/startorder1.jsp?hom=t-vps"><br />
    </a></li>
    <li>No contracts, no setup fees.</li>
    <li>Great how to<a href="http://wiki.slicehost.com/doku.php"> wiki</a>page</li>
</ul>
<p style="text-align: left;"><a href="https://manage.slicehost.com/customers/signup" title="Hosted by SliceHost"><img border="0" alt="" src="http://www.perfectblogger.com/images/2007/09/slicehost.jpg" /></a></p>
<p><a href="http://www.westhost.com">WestHost.com</a> that costs $10 per month.</p>
<ul>
    <li>Guaranteed 99.9% uptime</li>
    <li>Lots of hard drive space but no guaranteed on memory allocation.</li>
</ul>
<div id="Logo"><a title="Home" href="http://www.westhost.com/"><img height="59" width="336" border="0" alt="" src="http://www.westhost.com/images/logo.gif" /></a></div>
<p><a href="http://www.perfectblogger.com/2007/10/why-i-think-slicehost-is-the-best/">http://www.perfectblogger.com/2007/10/why-i-think-slicehost-is-the-best/</a></p>
<h2><span style="font-family: Arial;">How to get SVN service for FREE?</span></h2>
<p>If you are using website is in php, I believe Dreamhost is enough for you. Apart from using Dreamhost as web hosting, I also use it as my SVN repository. I have a project named "<a href="http://www.justproposed.com">Justproposed.com</a>" that I want to work in collaboration with my partners. I want to use SVN that I found very helpful at work. However, I don't want to pay too much to do that. I wonder any of the web hosting company on the Net that provides this service. So, I can pay my regular web hosting fee and get this extra service for <strong>FREE</strong> (It is practically free if the web hosting company you pick gives you tons of disk space). I have searched through different postings and feedbacks and eventually found "<a href="http://www.dreamhost.com/r.cgi?300662">Dreamhost</a>" that gives me exactly what I want.</p>
<p><a href="http://www.dreamhost.com/r.cgi?300662"><img height="44" width="174" src="https://secure.newdream.net/newpanel/logo.png" alt="DreamHost" /></a></p>
<p>If you use "<strong>SOLUTIONHACKER</strong>" as code, you will get your first year FREE as well. Apart from the great service they provide, there are many supporters on the Net to help each other. Here is a good article that shows you how to set up your first SVN repository on Dreamhost. Follow this to get started your project in a cheap way!</p>
<p><a href="http://www.jtbullitt.com/projects/tech/svn-for-website-development">http://www.jtbullitt.com/projects/tech/svn-for-website-development</a></p>]]></description>
			<content:encoded><![CDATA[<p>I currently use <strong>Dreamhost </strong>for my own company &#8220;JustProposed.com&#8221; that is powered by typical LAMP solution. It is a great shared hosting solution but it doesn&#8217;t support website powered by Java. If you have Java website, I suggest you to try a web hosting company that provides you <strong>VPS </strong>(Virtual Private Server) solution. VPS occupies a middle ground between a <strong>dedicated server</strong> and <strong>regular shared hosting</strong>. You get the features  of dedicated hosting in a shared environment. In other words, your virtual server runs on one of host servers. The host server runs a number of virtual servers.&#160; Each virtual server shares the   host server&#8217;s memory, CPU, Internet connection and other resources. No one    VPS can monopolize resources.&#160; Each VPS gets a guaranteed share of the server   CPU, disk IO and network.</p>
<p><span id="more-200"></span></p>
<p>Before you pick a good web hosting company for your java webapp, you better get familiar with the system need of your webapp first. There are some interesting topics that you may encounter:</p>
<ol>
<li><strong>Shared JVM vs Private JVM</strong> &#8211; The two biggest problems with shared Java hosting are <strong>memory leaks</strong> and <strong>security</strong>. If someone has a memory leak or code that is a high user of memory in a shared environment, all of the people sharing that JVM suffer the same memory problems.&#160; Apart from that, it is not secure. Therefore, you don&#8217;t want to share the same JVM with other users although it is cheaper. One more disadvantage of Shared JVM is that you cannot <strong>restart </strong>the Tomcat as you wish.</li>
<li><strong>PermGen space</strong> (default = 64MB) is used for things that do not change (or change often). e.g. Java classes.&#160; So often large, complex apps will need lots of PermGen space. Similarly if you are doing frequent war/ear/jar deployments to running servers like Tomcat or JBoss you may need to issue a server <strong>restart </strong>after a few deploys or increase your PermGen space. To increase the PermGen space use something like: <strong>-XX:MaxPermSize=128m</strong></li>
<li><strong>Heap size setting</strong> &#8211; Java has a couple of settings that help control how much memory it uses:
<ul>
<li><strong>-Xms</strong> sets the minimum memory heap size.</li>
<li><strong>-Xmx </strong>sets the maximum memory heap size. When setting the -Xmx setting you should consider a few things&#8230;&#160; -Xmx has to be enough for you to run your app.&#160; If it is set too low then you may get Java <strong>OutOfMemory</strong> exceptions (even when there is sufficient spare memory on the server).</li>
<li><span id="intelliTxt">We typically specify the same amount of memory for both flags (-Xms and -Xmx) to force the server to use all the allocated memory from startup. This way, the JVM wouldn&#8217;t need to dynamically change the heap size at runtime, which is a leading cause of JVM instability.</span></li>
<li><span id="intelliTxt">If you don&#8217;t specify a memory size in the JVM startup flags, the JVM would limit the heap memory to 64MB (512MB on Linux), no matter how much physical memory you have on the server! </span></li>
<li><span id="intelliTxt">For <strong>64-bit servers</strong>, make sure that you run a 64-bit JVM on top of a 64-bit operating system to take advantage of all RAM on the server. Otherwise, the JVM would only be able to utilize <strong>2GB or less </strong>of memory space. 64-bit JVMs are typically only available for<strong> JDK 5.0</strong>.</span></li>
<li>Suggested memory size: PermGen + Max Heap =<strong> 256MB</strong>. Of course, the more you get the better! <img onclick="grin(':smile:');" alt=":smile:" src="../../../../../wp-includes/images/smilies/icon_smile.gif" /></li>
</ul>
</li>
<li><strong>Garbage collection (GC)</strong> &#8211; <span id="intelliTxt">With a large heap memory, the garbage collection (GC) operation could become a major performance bottleneck. It could take more than ten seconds for the GC to sweep through a multiple gigabyte heap.</span>
<ul>
<li><strong><span id="intelliTxt">Single-threaded vs concurrent GC</span></strong><span id="intelliTxt"> &#8211; In JDK 1.3 and earlier, GC is a single threaded operation, which stops all other tasks in the JVM. That not only causes long and unpredictable pauses in the application, but it also results in very poor performance on multi-CPU computers since all other CPUs must wait in idle while one CPU is running at 100% to free up the heap memory space. It is crucial that we select a JDK 1.4+ JVM that supports <strong>parallel </strong>and <strong>concurrent </strong>GC operations. Actually, the concurrent GC implementation in the JDK 1.4 series of JVMs is not very stable. So, we strongly recommend you upgrade to JDK 5.0. </span></li>
<li><strong><span>Pick a good GC algorithms</span></strong><span> &#8211; Parallel GC free up memory faster but longer pause</span>. Concurrent GC has shorter pause but doesn&#8217;t free up all memory at once.</li>
</ul>
</li>
<li><a href="http://rimuhosting.com/mod_jk2_and_mod_proxy_ajp.jsp">How to have your tomcat be available at port 80</a></li>
<li><a href="http://www.onjava.com/pub/a/onjava/2006/11/01/scaling-enterprise-java-on-64-bit-multi-core.html">More on Java system tuning on multi-core server</a></li>
</ol>
<p><strong>Below are some of the great VPS options on the Net:</strong></p>
<p><a href="http://rimuhosting.com/index.jsp">RimuHosting.com</a> provides <a href="http://www.xen.org/">Xen</a>-based VPS. <strong>Xen </strong>is the <strong>virtualization </strong>technology that <strong>Amazon </strong>use for <strong>EC2</strong>.</p>
<ul>
<li>Guaranteed 99.9% uptime</li>
<li>They target at most, 8 customers per CPU core with 16% usage.</li>
<li>The host server is 2U Supermicro with 32GB of memory, 8 2.4Ghz Xeon CPU cores and 4TB of disk space.</li>
<li>You can get 256MB memory and 4GB disk space allocated for about $30.</li>
<li>Great how to <a href="http://rimuhosting.com/support/howtolist.jsp">wiki </a>page</li>
</ul>
<p><a href="http://rimuhosting.com/index.jsp"> 				 					<span style="background-color: rgb(153, 51, 0);"><img src="http://www.solutionhacker.com/wp-content/uploads/image/rimuhosting.JPG" style="width: 286px; height: 48px;" alt="" /><br />
</span></a></p>
<p><a href="http://www.slicehost.com/why-slicehost/">SliceHost.com</a> also provides Xen-based VPS.</p>
<ul>
<li>Guaranteed 99.9% uptime</li>
<li>The host server is in 16GB memory, 64 bits, quad-core CPU with 8+ Ghz. RAID-10 disk storage with Gigabit network.</li>
<li>You can get 256MB memory, 10GB disk space and 100GB bandwidth for about $20.<a href="http://rimuhosting.com/order/startorder1.jsp?hom=t-vps"><br />
    </a></li>
<li>No contracts, no setup fees.</li>
<li>Great how to<a href="http://wiki.slicehost.com/doku.php"> wiki</a>page</li>
</ul>
<p style="text-align: left;"><a href="https://manage.slicehost.com/customers/signup" title="Hosted by SliceHost"><img border="0" alt="" src="http://www.perfectblogger.com/images/2007/09/slicehost.jpg" /></a></p>
<p><a href="http://www.westhost.com">WestHost.com</a> that costs $10 per month.</p>
<ul>
<li>Guaranteed 99.9% uptime</li>
<li>Lots of hard drive space but no guaranteed on memory allocation.</li>
</ul>
<div id="Logo"><a title="Home" href="http://www.westhost.com/"><img height="59" width="336" border="0" alt="" src="http://www.westhost.com/images/logo.gif" /></a></div>
<p><a href="http://www.perfectblogger.com/2007/10/why-i-think-slicehost-is-the-best/">http://www.perfectblogger.com/2007/10/why-i-think-slicehost-is-the-best/</a></p>
<h2><span style="font-family: Arial;">How to get SVN service for FREE?</span></h2>
<p>If you are using website is in php, I believe Dreamhost is enough for you. Apart from using Dreamhost as web hosting, I also use it as my SVN repository. I have a project named &#8220;<a href="http://www.justproposed.com">Justproposed.com</a>&#8221; that I want to work in collaboration with my partners. I want to use SVN that I found very helpful at work. However, I don&#8217;t want to pay too much to do that. I wonder any of the web hosting company on the Net that provides this service. So, I can pay my regular web hosting fee and get this extra service for <strong>FREE</strong> (It is practically free if the web hosting company you pick gives you tons of disk space). I have searched through different postings and feedbacks and eventually found &#8220;<a href="http://www.dreamhost.com/r.cgi?300662">Dreamhost</a>&#8221; that gives me exactly what I want.</p>
<p><a href="http://www.dreamhost.com/r.cgi?300662"><img height="44" width="174" src="https://secure.newdream.net/newpanel/logo.png" alt="DreamHost" /></a></p>
<p>If you use &#8220;<strong>SOLUTIONHACKER</strong>&#8221; as code, you will get your first year FREE as well. Apart from the great service they provide, there are many supporters on the Net to help each other. Here is a good article that shows you how to set up your first SVN repository on Dreamhost. Follow this to get started your project in a cheap way!</p>
<p><a href="http://www.jtbullitt.com/projects/tech/svn-for-website-development">http://www.jtbullitt.com/projects/tech/svn-for-website-development</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.solutionhacker.com/implement-your-idea/build-your-website/java-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

