Apache Tuning: Is it normal for lots of Apache services to clog memory?

Hi,
I'm not sure if this is normal.

I have a linode of this size:
1 CPU Core
50 GB Storage
2 GB RAM

But my Apache seems to have a LOT of services that are clogging up the memory. Though I have turned KeepAlive Off.

%MEM %CPU RSS VSZ COMMAND
6.7 2.8 136348 469428 /usr/sbin/apache2 -k start
6.6 3.4 134040 467200 /usr/sbin/apache2 -k start
4.8 3.6 98052 431896 /usr/sbin/apache2 -k start
4.7 4.3 95200 501960 /usr/sbin/apache2 -k start
4.5 2.9 92420 502152 /usr/sbin/apache2 -k start
4.5 1.4 91508 431236 /usr/sbin/apache2 -k start
4.4 5.2 89688 428984 /usr/sbin/apache2 -k start
4.4 5.0 90008 429820 /usr/sbin/apache2 -k start
4.4 4.4 89540 428528 /usr/sbin/apache2 -k start
4.3 4.5 87704 498120 /usr/sbin/apache2 -k start
4.3 4.0 87960 427636 /usr/sbin/apache2 -k start
4.2 4.1 85480 425188 /usr/sbin/apache2 -k start
4.2 4.1 85348 425096 /usr/sbin/apache2 -k start
4.2 3.7 85668 425596 /usr/sbin/apache2 -k start
4.0 2.9 81040 420656 /usr/sbin/apache2 -k start
3.9 7.2 79436 419380 /usr/sbin/apache2 -k start

Is this normal?

2 Replies

Do you use mod mpm worker?

@Rhodesia --

This is normal if you use mpm-prefork. If you use mpm-event or mpm-worker, the number of processes will be reduced significantly because each process will service requests using multiple threads. This can be more efficient if you have a large workload and a multi-core CPU.

These processes don't "clog memory". Processes have a unique structure…what you are seeing basically only represents the data part of apache2(8). Code is only loaded once (since code is read-only, it can be shared among multiple processes). Linux, in general, has pretty efficient process-management. My Roku Streaming Stick (about the size of a USB stick), my daughter's Android phone & my Raspberry-Pi-like SBC all run (custom distros of) Linux.

The kernel also has processes. These are enclosed in [] in a ps -ef listing. For example, on my Linode I have:

root        14     2  0 Apr11 ?        00:00:00 [cpuhp/0]
root        15     2  0 Apr11 ?        00:00:00 [cpuhp/1]

which are the "CPU hotplug" processes that facilitate scheduling of threads/processes in a multi-CPU system.

Switching to mpm-event or mpm-worker is easy but it has impacts on how you configure PHP.

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct