I have a django app running on ec2. It is a micro instance, and I see 62% of my memory is being consumed by an application that has zero users. This seemed quite high to me, so I did:
$ ps aux|grep apache
root 9318 0.0 1.4 204924 9052 ? Ss 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9323 0.1 4.7 234824 28588 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9324 0.1 4.7 235176 28780 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9325 0.1 4.8 235536 29088 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9326 0.1 4.7 234808 28564 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9327 0.1 4.7 234952 28620 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9328 0.1 4.7 235136 28892 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9329 0.1 4.6 234856 28140 ? S 23:01 0:00 /usr/sbin/apache2 -k start
ubuntu 9330 0.1 4.8 235480 29356 ? S 23:01 0:00 /usr/sbin/apache2 -k start
Why are there so many processes here? What are all these processes doing? Is there a way to make this more efficient?
This may depend on the Apache worker you are using, but it is likely that Apache will use a separate process for each incoming connection. In order to serve incoming connections rapidly, it keeps a pool of connection handlers open, which is why there are so many processes.
The level of memory usage will be because, regardless of the number of users, Apache has to keep all/most of your application, Django, Python and any third-party apps you are using in memory to be able to serve the site efficiently.