WebFaction
Community site: login faq

Hi, I'm over my memory limit with Webfaction and trying to lower it. Apache is using a lot of memory and I'm trying to lower the amount of memory usage.

I have three Apache instances serving three websites with mod_wsgi. I have a cron set up to try to start the servers every 15 minutes (in case they crash or are killed by Webfaction). Here are the settings I'm using:

StartServers 1
MinSpareServers 1
MaxSpareServers 5
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 5000
KeepAliveTimeout 2

Still one of the instances (that gets the most traffic) is taking up about 45MB and the other ones are also hogging a lot of memory. What else can I do to cut down on the memory used by Apache?

Right now I have <VirtualHost *>. I tried changing this to my actual IP address (I heard this helped) but when I did this and visited the homepage, it just displayed a directory with all of the files in my account.

What else can I do? Could I combine all the Apache instances into one, would that help? Why does memory usage grow over time? I'm also not sure how to check which modules I'm using, and how to remove them, besides recompile Apache from scratch.

asked 24 May '11, 13:06

kevinburke
2711115
accept rate: 0%

edited 24 May '11, 13:09


We have some tips for reducing Django's memory usage here: Reducing Memory Consumption - those tips can be applied to any mod_wsgi application.

I've had a quick look at your site configuration, and from what I've seen you would definitely benefit from setting/reducing your WSGIDaemonProcess 'processes' setting, and by using static apps to serve your static media.

Combining all of your apps under a single Apache instance would probably reduce your memory usage. You can use the Apache config shown in this older forum post as an example of how to configure your VirtualHosts: Howto: Hosting multiple django sites with one apache instance

Increased memory usage over time is usually a sign of a memory leak in your application - finding the leak requires testing and debugging.

Regarding Apache modules, you can see which modules are in use by looking at the LoadModule directives in your Apache config. If you're loading a particular module that you do not need, you can either remove or comment out the LoadModule directive and then restart Apache.

permanent link

answered 24 May '11, 17:45

seanf
12.2k42136
accept rate: 37%

How would you have a static app and a wsgi app running side-by-side?

(24 May '11, 19:45) kevinburke

Simple: when you set up your site in the control panel, add the WSGI app on your root URL path "/" and the static app on whatever URL path you're using to serve your static media.

(24 May '11, 19:49) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×226
×57
×12

question asked: 24 May '11, 13:06

question was seen: 6,253 times

last updated: 24 May '11, 19:49

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM