You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Helmut Eggebert <he...@hotmail.com> on 2005/01/24 18:44:52 UTC

out of memory error with more than a few sites

Hi,

I am getting an out of memory error when I start Tomcat.  I read posts on 
this in the past and followed some instructions to increase by min and max 
memory settings in catalina.sh.  I have 1028 MB on this server and so I 
increased the min to 128 and the max to 768.

The server was working fine when I had a few test sites on it.  I am 
currently using Apache httpd 2.0.52, Tomcat 5.0.28 and mod_jk2 configured 
with workers2.properties and so that tomcat can listen to apache requests.  
Apache httpd serves static files and Tomcat
is set to work on jsp's with the directive:
<LocationMatch "/*.jsp">JkUriSet worker ajp13:localhost:8009</LocationMatch>

The problem showed up when I started migrating some sites over and increased 
the number of hosts significantly.  I created 80 VirtualHosts in httpd.conf 
and 80 hosts in server.xml.  Then I created 80 corresponding directories in 
webapp, each with META-INF and WEB-INF subdirectories.

Even though all these directories and subdirectories are empty, when I start 
up Tomcat, it tries to deploy them all and throws the out of memory error.  
If I remove most of the hosts in server.xml, everything runs fine again.

My goal is to have these sites each with a large number of static pages and 
only a few jps's which are Lucene's search.jsp and results.jsp.  After this 
I want to have these sites each has a portal component using Jetspeed 2.

I know that if Tomcat was not in the picture this server would be able to 
handle many more sites, but is 80 hosts with only a few jsps in each too 
much for Tomcat on an average modern Web server?  How can I optimize this?

Below I have included code snippets of my httpd.conf and server.xml and 
workers2.properties.

Thanks.

#--------------------------
#httpd.conf snippet
#--------------------------

<VirtualHost *:80>
        DocumentRoot /opt/jakarta-tomcat-5.0.28/webapps/sitename
         ServerName sitename.com
         ServerAlias www.sitename.com
         DirectoryIndex index.html index.jsp index.cgi index.php
         CustomLog logs/sitename_access_log combined
         ErrorLog logs/sitename_error_log
                 <LocationMatch "/*.jsp">
                         JkUriSet worker ajp13:localhost:8009
                 </LocationMatch>
         ScriptAlias /WEB-INF/ 
/opt/jakarta-tomcat-5.0.28/webapps/sitename/WEB-INF/
         <Directory "/opt/jakarta-tomcat-5.0.28/webapps/sitename/WEB-INF">
                 AllowOverride None
                 Options None
                 Order allow,deny
                 Allow from all
         </Directory>
         ScriptAlias /META-INF/ 
/opt/jakarta-tomcat-5.0.28/webapps/sitename/META-INF/
         <Directory "/opt/jakarta-tomcat-5.0.28/webapps/sitename/META-INF">
                 AllowOverride None
                 Options None
                 Order allow,deny
                 Allow from all
         </Directory>
         <Directory /opt/jakarta-tomcat-5.0.28/webapps/sitename/logs>
                 AllowOverride AuthConfig
         </Directory>
        ErrorDocument 404 http://www.sitename.com/errorpages/404.html
</VirtualHost>

#--------------------------
#server.xml snippet
#--------------------------

        <Host name="sitename.com" debug="0" appBase="webapps" 
unpackWARs="true">
                <Alias>www.sitename.com</Alias>
                <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs" prefix="sitename." suffix=".log" 
timestamp="true"/>
                <Context path="" docBase="sitename" debug="0" 
reloadable="true"/>
        </Host>

#---------------------------------------
#workers2.properties snippet
#---------------------------------------

[shm]
info=Scoreboard. Requried for reconfiguration and status with multiprocess 
servers.
file=anon

# Defines a load balancer named lb. Use even if you only have one  =machine.
[lb:lb]

# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
#host=localhost
host=127.0.0.1

# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
group=lb

# Uri mapping

# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
group=lb

[status:]
info=Status worker, displays runtime information

[uri:/jkstatus/*]
info=The Tomcat /jkstatus handler
group=status:

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: out of memory error with more than a few sites

Posted by Tim Funk <fu...@joedog.org>.
http://jakarta.apache.org/tomcat/faq/memory.html

I bet your machine has some kernel limits on number of open files that you 
are passing.

-Tim

Helmut Eggebert wrote:

> Hi,
> 
> I am getting an out of memory error when I start Tomcat.   

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org