Difference between httpd processes open by the apache user and admin user

chronic

Verified User
Joined
Dec 14, 2006
Messages
96
Hello, I have a question that maybe someone might be stupid, what is the main difference between httpd processes open by the apache user and those open by the user admin?

Why do I have so many processes for both admin and apache?

I only have one domain on the server assigned to the admin user and a testing subdomain of the same primary domain.

Thanks in advance.

Code:
apache    6134  2.4  1.7 2354088 142116 ?      Sl   17:30   0:00 /usr/sbin/httpd
admin     6135  2.2  1.9 2371196 159148 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6140  2.5  1.8 2460216 150932 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6143  2.5  1.9 2371164 158912 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6155  2.0  2.0 2479284 170268 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6160  1.7  1.7 2357548 145004 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6164  2.3  1.6 2446788 137996 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6176  1.6  1.6 2441936 132804 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6182  1.4  1.5 2342344 129740 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6183  1.6  1.5 2342840 130032 ?      Rl   17:30   0:00 /usr/sbin/httpd
admin     6184  1.7  1.5 2343020 130188 ?      Rl   17:30   0:00 /usr/sbin/httpd
apache    6185  0.2  1.3 2325592 110264 ?      Sl   17:30   0:00 /usr/sbin/httpd
apache    6198  0.4  1.3 2325712 110320 ?      Sl   17:30   0:00 /usr/sbin/httpd
apache    6200  0.2  1.3 2325712 110312 ?      Sl   17:30   0:00 /usr/sbin/httpd
apache    6201  0.2  1.3 2325712 110312 ?      Sl   17:30   0:00 /usr/sbin/httpd
apache    6204  0.3  1.3 2325712 110312 ?      Sl   17:30   0:00 /usr/sbin/httpd
apache    6205  0.3  1.3 2325712 110312 ?      Sl   17:30   0:00 /usr/sbin/httpd
admin     6206  2.0  1.4 2332964 120432 ?      Rl   17:30   0:00 /usr/sbin/httpd
apache    6207  0.3  1.3 2325576 110000 ?      Sl   17:30   0:00 /usr/sbin/httpd
apache    6212  0.5  1.3 2325900 110556 ?      Sl   17:31   0:00 /usr/sbin/httpd
apache    6213  0.5  0.0      0     0 ?        Z    17:31   0:00 [httpd] <defunct>
apache    6214  0.0  1.3 2324768 107852 ?      Sl   17:31   0:00 /usr/sbin/httpd
apache    6215  0.0  1.3 2324768 107852 ?      Sl   17:31   0:00 /usr/sbin/httpd
admin     6216  1.0  1.3 2326856 113088 ?      Rl   17:31   0:00 /usr/sbin/httpd
apache    6222  0.0  1.3 2324768 107852 ?      Sl   17:31   0:00 /usr/sbin/httpd
apache    6224  0.0  1.3 2324768 107852 ?      Sl   17:31   0:00 /usr/sbin/httpd
apache    6227  0.0  1.3 2324768 107852 ?      Sl   17:31   0:00 /usr/sbin/httpd
 
Hello,

There is nothing wrong to see them all. I believe you want to know what is behind them, for this you should read server-status page. You can use the guide: https://help.directadmin.com/item.php?id=91 for it. Just add ?refresh=10 so that it reloads every 10 seconds and see what IPs and what pages are accessed the most.
 
Thank you Zeiter, I checked and I saw that many requests come from:

Code:
::1	http/1.1	server.mydomain.com:80	OPTIONS * HTTP/1.0

and the others come from outside, for example:

Code:
172.xxx.xxx.xxx	http/1.1	www.mydomain.com:80 GET /blog/wp-admin/admin-ajax.php?action=essb_counts&nonce=f3

Which of these two types of request is usually assigned to user apache and which to admin?

Also what do all these requests cover? could it be some cli script launched locally with cron?

Code:
::1	http/1.1	server.mydomain.com:80	OPTIONS * HTTP/1.0

Now I know that I do not have to worry, but I would like to understand something more to better interpret the logs

I hope I was clear with my questions.

Thank you.
 
Thanks zEitEr, for the information and the links you gave me.

Yes is correct i use Apache+mod_php+mod_ruid2. Do you think that today it is better to use php-fpm in terms of performance and security?
 
No, I don't think so.

Why do we need offroad jeeps when Ferrari is the fastest car?!

Why do we need mod_php, fastcgi when we have PHP-FPM then...? :D
 
Nowadays php-fpm is the recommended solution. Apache+mod_php is running in prefork mode and it should not be used. And yes, mod_php is now slower too (it was superior in speed in the past and most articles that praise it are from years ago).

Here are two quotes from the official Apache documentation:

In the case of Unix, the decision as to which MPM is installed is based on two questions:

1. Does the system support threads?

2. Does the system support thread-safe polling (Specifically, the kqueue and epoll functions)?

If the answer to both questions is 'yes', the default MPM is event.

If The answer to #1 is 'yes', but the answer to #2 is 'no', the default will be worker.

If the answer to both questions is 'no', then the default MPM will be prefork.

In practical terms, this means that the default will almost always be event, as all modern operating systems support these two features.

HTTP/2 is supported in all multi-processing modules that come with httpd. However, if you use the prefork mpm, there will be severe restrictions.

In prefork mod_http2 will only process one request at at time per connection. But clients, such as browsers, will send many requests at the same time. If one of these takes long to process (or is a long polling one), the other requests will stall.

mod_http2 will not work around this limit by default. The reason is that prefork is today only chosen, if you run processing engines that re not prepared for multi-threading, e.g. will crash with more than one request.

If your setup can handle it, configuring event mpm is nowadays the best one (if supported on your platform).

Since we now use HTTP/2, Event mode is required. Mod_php is working only in prefork mode. Therefore it's time to move to PHP-FPM and Apache running in EVENT MPM.
 
Thank you for your opinion wattie, but now I am still undecided about which way to take :D
 
NGINX front-end sitting in front of Apache, and you don't need to worry much on apache's mode. Or not?
 
NGINX front-end sitting in front of Apache, and you don't need to worry much on apache's mode. Or not?

Well, that's actually tricky. The main idea behind Nginx+Apache is coming from the times when Apache was resource hungry because it worked with the prefork mode. Then nginx (and others) came as a lightweight solutions... but they were no good in supporting all features that Apache had. Therefore the reverse proxy idea was invented. It was used for the following case:

1. You have Apache with mod_php and you wish to keep using it that way for some reason (old server, custom setup, etc). You just can't move off Apache easily (for example you rely heavily on .htaccess files which are not supported by other systems).
2. It's slow and does not scale well, so you wish to speed it up and reduce memory usage. So you add Nginx in front of it so it can grab all static files and offload Apache from these request. Therefore lots of work is offloaded from the old memory hungry server to the lightweight one. You get a speedboost here.

Now When you take Apache in Event MPM with PHP-FPM, it actually does the same thing: Apache works to serve static files and it itself is as a reverse proxy to the PHP-FPM compiler. The Apache foundation created that MPM mode exactly to address the above issue. They wanted Apache to stop being resource hungry and they did it by offloading lots of work with the fastcgi technique. So with Event Apache started to be good enough to compete with the other "lightweight" (no longer much lighter) servers and still be the good old compatible with legacy software Apache (add some modules here and there and it's still working the same as the legacy mode) :)

I don't see a good reason for doing Nginx reverse proxy in front of Apache + Event MPM because it will create the following path for dynamic content:

Nginx <=> Apache <=> PHP-FPM

So Why not using directly Nginx with PHP-FPM instead. eg: Nginx <=> PHP-FPM? That way you skip one unnecessarily proxy step.


Nginx+Apache is a legacy setup which was good in the times when Apache did not have Event MPM or it was not stable enough... It's still OK if you have old hostings with tons of custom httpd.confs and they are hard to rewrite to a more modern php setup. But for normal hosting providers, it's no longer the recent best. Managing one more software product is also an additional hassle and an additional failure point.

Speaking about this I must note that I am talking about normal shared hosting servers. Things may be very different when we start talking about cluster setups on huge websites. They are another story.
 
Last edited:
Then i stay with Apache+mod_php+mod_ruid2... :)
That's what I do too. Always works nice, never had any issues, not on updates or anything, easy to config. Our servers are so fast that you wouldn't even know they don't run Nginx.

for example you rely heavily on .htaccess files which are not supported by other systems
I wonder why. How else can a user easily protect or redirect things? The .htaccess files are still widely used, even by Wordpress etc. so it's rather odd imho that some other systems don't use that, removing some nice configuration option from the users.

1. You have Apache with mod_php and you wish to keep using it that way for some reason (old server, custom setup, etc).
Why should this only be used on old servers? And it's not slow either. Both have benefits and downsides, it's just what you want or use more. If mostly depends on if you have a lot of static content or not. So lets say your requirements.
There are more then enough normale shared hosting servers just using mod_php and mod_ruid. Because mod_ruid is fast and safe.
Php-fpm is faster but is also more complex.

It's not that php-fpm is now default or "the future" and mod_ruid is old or for old servers. It really all comes down to your system resources, your requirements and your content.
 
Last edited:
Back
Top