Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using tomcat standalone. Nowadays I see tomcat starts to use more memory than I expect. Serving static files from tomcat can be cause of this? Or can serving statics from apache cause better memory use.

Thx Enes

share|improve this question

2 Answers 2

up vote 0 down vote accepted

If you need to share static content (HTML, images, CSS, PDFs, etc...) you can use Apache.
I think that it is more configurable and more robust and a lot faster than Tomcat. You have to know that when you serve 100% static files with Apache, each httpd process will use around 2-3 megs of RAM.

Did you think to use a tiny fast server like thttpd?

share|improve this answer

Yes ! Thanks to mod_jk (http://tomcat.apache.org/connectors-doc/index.html) you can tell to Apache to server some parts of you application that it would for sure serve better. I'm thinking about static content like pictures. Here is a basic setup of the mod_jk connector :

< VirtualHost *>

ServerName your name

DocumentRoot /home/tomcat/

ErrorLog /var/log/apache2/application-error.log
TransferLog /var/log/apache2/app-access.log
LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\""

JkMount /* ajp13_worker
JkUnMount /img ajp13_worker
JkUnMount /css ajp13_worker
JkUnMount /js ajp13_worker

< /VirtualHost>

Notice that thanks to JkUnMount directive you tell to mod_jk to let Apache handle certain part of your application.Moreover, it's always better / simpler to type

yoursite.com than yoursite.com:8080

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.