I notice Apache is running multiple processes on my LAMP server (ubuntu 10.10). I'm just running a Wordpress site with MySQL as a database. It seems like www-data is running apache2 more than it should (using too much memory too), am I correct:
ID Owner Size Command
31200 www-data 251236 kB /usr/sbin/apache2 -k start
20678 www-data 250948 kB /usr/sbin/apache2 -k start
25781 www-data 248888 kB /usr/sbin/apache2 -k start
31045 www-data 248844 kB /usr/sbin/apache2 -k start
19926 www-data 246480 kB /usr/sbin/apache2 -k start
20749 www-data 239380 kB /usr/sbin/apache2 -k start
32616 www-data 238632 kB /usr/sbin/apache2 -k start
8846 mysql 238128 kB /usr/sbin/mysqld
24178 www-data 234228 kB /usr/sbin/apache2 -k start
32618 www-data 232344 kB /usr/sbin/apache2 -k start
32615 www-data 232204 kB /usr/sbin/apache2 -k start
19805 root 208156 kB /usr/sbin/apache2 -k start
Apache is running multiple processes to have them ready when a client request comes in. Spawning a server process is slow, so it's best to have one waiting for a client.
For memory usage, you should take into the account RES size (as displayed by top), which is the amount of physical memory used by the task.
Why do you think you have too many apache2 processes using too much memory? What do you expect? Why do you expect so?
As the answer by Pawel explains, apache uses a process per request model with a process pool (or thread per request with mpm_worker).
You might be able to reduce the memory usage by using a web server based on non-blocking IO, such as nginx. That way the server doesn't need to dedicate a process/thread per connection.
Apache will run as many processes as you configure it to. The configuration differs if you are using the prefork or worker multi-processing modules.