0

Why do we see multiple PID's related to same application/owner for http like this below. What does this mean?.

 $ ps -ef | grep httpd | grep -v grep
 apache    9619 20181  0 07:08 ?        00:00:03 /usr/sbin/httpd
 apache   10092 20181  0 Jan24 ?        00:00:07 /usr/sbin/httpd
 apache   13086 20181  0 06:09 ?        00:00:00 /usr/sbin/httpd
 apache   13717 20181  0 Jan25 ?        00:00:01 /usr/sbin/httpd
 apache   14730 20181  0 07:13 ?        00:00:01 /usr/sbin/httpd
 apache   16359 20181  0 09:54 ?        00:00:00 /usr/sbin/httpd
 root     20181     1  0  2011 ?        00:00:01 /usr/sbin/httpd
 apache   21450 20181  0 09:55 ?        00:00:00 /usr/sbin/httpd
voretaq7
  • 79,879
  • 17
  • 130
  • 214

4 Answers4

2

Each httpd PID represent a server process which is running in order to handle the incoming request. The default NO of server process to be run in background can be controlled by the following directives in the httpd conf file (similarly in other applications).

# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>
DerfK
  • 19,493
  • 2
  • 38
  • 54
Cloudmeteor
  • 449
  • 2
  • 7
0

This is the way the Apache web server works. Basically, the master process starts as root, opens the appropriate ports based on the configuration file, and then duplicate/forks the number of listeners/servers as you configured them. These servers run as the configured user (apache in this case) and basically handle one HTTP transaction. So the larger the number of configured servers, the more requests that you can handle concurrently.

So the meaning to answer your question, is that it looks like you have an Apache website(s) running.

mdpc
  • 11,856
  • 28
  • 53
  • 67
0

This is normal; Apache, like many other applications, will run multiple copies of itself. In this case, full processes (with their own PID's), though in other configurations it could be multiple threads.

StartServers, MinSpareServers, MaxSpareServers, etc are the configuration directives of note.

Jeff Warnica
  • 474
  • 2
  • 8
0

The numbers in the second column are the PPIDS (parent PIDs) which indicate that most of your http processes are children (due to exec/fork/...) of the original process (in this case 20181 which was originally started as root).

As the other answers already point out this is one option to implement multi-processing to leverage multiple CPUs for parallel processing. This is influenced by the selection of the "mpm" worker model in your Apache configuration.

Theuni
  • 958
  • 5
  • 15