Disclaimer: really not trying to be the devil's advocate here, but it's really unclear to me why with uwsgi I can't see any memory leak (and it's not set to restart itself on high memory usage) with over 2millions requests.
You are confirming that configuring correctly htop you see only 2 apache processes and the rest are all threads ? How is it that they show different PIDs ?
Disclaimer2: No expert on apache here, but I've seen my fair share and I can assume I can read properly the docs (
http://httpd.apache.org/docs/2.2/mod/worker.html).
You values means:
Start with 2 processes (StartServer), 25 threads each (ThreadsPerChild).
When there are less than 25 threads available (MinSpareThreads), spawn processes until at least 25 threads on total are free.
Reap a process when there are 75 threads doing nothing (MaxSpareThreads).
You can serve concurrently at most 150 clients (MaxClient), so you can end up with 150/25 processes (6) in normal statuses.
Apache should never recycle processes because of the MaxRequestsPerChild 0 directive.
It's unclear to me that the following behaviour (seems the one happening to you):
"""
if only one thread is terminating on one process serving a response, you may have more than one "terminating processes" (up to 150 (MaxClients)).
"""
is avoided setting just MaxRequestsPerChild = 0 (like in your config) or setting also MaxSpareThreads = MaxClients.
Anyway, you don't have in place the ServerLimit directive that cuts off the maximum number of processes spawned by apache (you should set it to a value going from 6 to whatever you want, but just to try I'd set MaxSpareThreads to 150 and if the same behaviour happens, I'd set ServerLimit to 6)