[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Configure Apache to use less memory

Posted on 2004-10-27
8
Medium Priority
?
586 Views
Last Modified: 2008-03-03
I'm running a Apache on virtual private server (VPS) that has only 64 MB of RAM. It only needs to serve a few PHP pages per minute. However, Apache quickly uses up all physical ram and fills up swap space, making my web site virtually unusuable. Given that I'm serving so few pages, are there setting I can modify to make Apache use less memory?

Thanks.
0
Comment
Question by:bobwood2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Expert Comment

by:basiclife
ID: 12429866
What OS are you using? I'm guessing linux?
0
 
LVL 5

Expert Comment

by:mrielf
ID: 12431049
Apache is mandatory or not? If not, then there is many alternatives...

One of them is Boa
There is a page about  Boa + PHP:
http://www.menie.org/georges/DragonEngine/boa-php.html

Another choice is thttpd(small, uses very few resources, but limited in php capabilities)
0
 
LVL 2

Assisted Solution

by:brozzis
brozzis earned 1200 total points
ID: 12431466

I'd comment out most of "LoadModule" directives, you should know what you really need.
Disable SSL if not used.
reduce the number of the StartServer Directive
limit the number of max processes

buy some RAM ;-)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 48

Accepted Solution

by:
hernst42 earned 800 total points
ID: 12451088
Try with the following settings in your httpd.conf:

MinSpareServers 1
MaxSpareServers 1
MaxRequestsPerChild 1

That might not help if a lot of acceses are done to your page, but for very less accesses it should work.
0
 

Author Comment

by:bobwood2000
ID: 12454637
I found that all of these modules were currently being loaded by apache. Which don't I need? All I do with my apache server is server up pages that are generated by mod perl, and I really need to conserve ram.

Thanks.


AddModule mod_so.c
AddModule mod_macro.c
LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
LoadModule status_module /usr/lib/apache/1.3/mod_status.so
LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
LoadModule access_module /usr/lib/apache/1.3/mod_access.so
LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so
LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so
LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so
LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so
0
 

Author Comment

by:bobwood2000
ID: 12454692
Yes, I'm using Linux. I did upgrade my RAM to 96 MB, but my server still seems to be going into swap. (MySQL is partially responsible, but Apache is more so.) Don't think I can afford any more ram, cause my hosting company seems to make all their money selling upgrades to ram. (Clever business startegy: Sell cheap VPS, but included so little RAM that your customers must buy upgrades.)

I replaced PHP with Perl, so BOA + PHP won't work. Perhaps BOA supports Perl, too, but I want to stick with Apache in order to ease the transition to a new server once my site (hopefully) becomes poplular.

Thanks for all of the suggestions.
0
 
LVL 2

Assisted Solution

by:brozzis
brozzis earned 1200 total points
ID: 12456253

are you sure you're using mod_perl or you are using perl as cgi ?

you should try to comment out these directives and see if everything works, but
I'd try this:

LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
# LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
# LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
# LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
# LoadModule status_module /usr/lib/apache/1.3/mod_status.so
# LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
# LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
# LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
# LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
# LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
# LoadModule access_module /usr/lib/apache/1.3/mod_access.so
# LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so
# LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so
# LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so
LoadModule perl_module /usr/lib/apache/1.3/mod_perl.so

I guess some logging is necessary on server, mod_perl is necessary and I'm guessing alias is necessary too...

do you really thing Perl is better than PHP ? I've no evidence on this.


0
 

Author Comment

by:bobwood2000
ID: 12457927
I personally like Perl better, because I already know its syntax. It also strikes me as a richer language, though admittedly I don't know much PHP.

Thanks to everyone for the help!
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question