WebFaction
Community site: login faq
0
1

I have several small Django apps on webfaction, and I want more, but what I have already eats too much memory. I have already tried spawning, but it ended up using even more memory.

I see each application creating about 7 instances of Apache. Can I - and if so, should I - and if so, how do I decrease that number? Would it help reducing memory usage? What would be a reasonable minimum of processes per app? Sacrificing performance is not a problem - the most "popular" of the sites has ~10 visitors a day, so as long as it at lest barely works, it could do the job (right?)

Or if I am on the wrong track, are there some other ways?

asked 02 Aug '11, 06:36

nuigurumi
381610
accept rate: 0%

Just out of curiosity, how many apps and what is their memory usage?

(10 Aug '11, 22:49) bwooceli

You should be able to reduce the number of processes to 1 or 2 then. For threads, you can probably leave that at 1 as well. These are things that you will have to play with to make sure it doesn't impact your sites severely, but with only ~10 visits per day you should be fine. You can also play around with other values as shown here http://httpd.apache.org/docs/2.0/mod/worker.html

Just make sure to make a backup of your httpd.conf file before you start making changes so that you can either refer back to it or restore if needed.

permanent link

answered 02 Aug '11, 10:23

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

So I navigated to /home/nuigurumi/webapps/mywebapp/apache2/conf and edited httpd.conf:

ServerLimit 1 ThreadLimit 2 StartServers 1 MaxSpareThreads 1 MinSpareThreads 1 MaxClients 2 ThreadsPerChild 2

re-started apache. The command: ps -u nuigurumi -o rss,etime,pid,command still shows 7 instances of /home/nuigurumi/webapps/mywebapp/apache2/bin/httpd.worker What am I doing wrong?

(02 Aug '11, 10:53) nuigurumi

You should have a line in your httpd.conf that looks like the following:

WSGIDaemonProcess mydomain processes=2 python-path=/home/username/webapps/app:/home/username/webapps/app/lib/python2.6 threads=10

You need to change the processes= and threads= entries here.

(02 Aug '11, 11:06) bmeyer71 ♦♦

OK, it had some effect, although with processes=1 threads=1 it creates what looks like 3 processes, but maybe that's how it's supposed to work. So those "ServerLimit" and the rest don't do anything in this case?

(02 Aug '11, 11:19) nuigurumi

I have a couple older Django apps, and they don't have that line in httpd.conf -- do I add it or change the usage in another way?

(02 Aug '11, 11:33) Berislav Lopac

Adding

WSGIPythonOptimize 2

also decreases memory usage a little

(02 Aug '11, 11:53) nuigurumi
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:

×909
×225
×55

question asked: 02 Aug '11, 06:36

question was seen: 5,882 times

last updated: 10 Aug '11, 22:49

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 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