WebFaction
Community site: login faq
0
1

I have a Django (v1.4) webapp (using at least one 3rd party library), using a separate app to serve static files (following the instructions here)

I'm confused as to why executing $ ps -u myusername -o rss,etime,pid,command gives this:

User - Memory - Elapsed Time - Pid - Command:
--------------------------------------------
myusername - 1MB - 2:52:37 - 6321 - /home/myusername/webapps/myapp/apache2/bin/httpd.worker -f /home/myusername/webapps/myapp/apache2/conf/httpd.conf -k start
myusername - 84MB - 2:52:37 - 6322 - /home/myusername/webapps/myapp/apache2/bin/httpd.worker -f /home/myusername/webapps/myapp/apache2/conf/httpd.conf -k start
myusername - 91MB - 2:52:37 - 6323 - /home/myusername/webapps/myapp/apache2/bin/httpd.worker -f /home/myusername/webapps/myapp/apache2/conf/httpd.conf -k start
myusername - 6MB - 2:52:37 - 6324 - /home/myusername/webapps/myapp/apache2/bin/httpd.worker -f /home/myusername/webapps/myapp/apache2/conf/httpd.conf -k start
... # trimmed

Is that normal? Or did I mess up?

Thanks in advance.

asked 06 Apr '12, 03:45

john2x
324
accept rate: 0%


This is normal, Apache runs a master process for handling requests and slave processes for mod_wsgi which actually process the input and return the output.

So, you have one master process, while 3 mod_wsgi processes.

permanent link

answered 06 Apr '12, 04:17

neeravk
1.5k3412
accept rate: 41%

edited 06 Apr '12, 04:17

Is there any way I can reduce the number of processes to avoid using so much memory? I have similar situation with @john2x, a django app with 4 processes, two of which use ~55MB each (and the other two 5MB each). Should I edit httpd.conf file to use fewer processes?

(28 Apr '12, 18:04) zafm

Yes, you can reduce the number of processes and threads that are started. This is in your /home/username/webapps/appname/apache2/conf/httpd.conf file.

(28 Apr '12, 18:36) bmeyer71 ♦♦

In this file I see several configurations:

MaxSpareThreads 3

MinSpareThreads 1

ThreadsPerChild 5

WSGIDaemonProcess myDjangoApp processes=2 threads=12 python-path=/home/myUserName/webapps/myDjangoApp:/home/myUserName/webapps/myDjangoApp/lib/python2.6

Which one should I change?

(28 Apr '12, 18:48) zafm

Change the ones on the WSGIDaemonProcess line.

(28 Apr '12, 18:51) bmeyer71 ♦♦

Thanks a lot, I updated it processes=1 threads=1 and now it has only one process with 55MB (the 2 small ones are still there but no problem with them).

(28 Apr '12, 19:07) zafm
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
×20

question asked: 06 Apr '12, 03:45

question was seen: 2,735 times

last updated: 28 Apr '12, 19:07

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
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