# apache processes



## Jeff_8420 (May 30, 2010)

Hi All,
i install and configure apache22 and everything work. But in sockstat view to many processes for apache, is this ok?


```
www      httpd      tcp4 6 *:80                
www      httpd      tcp4   *:*             
www      httpd      tcp4 6 *:80              
www      httpd      tcp4   *:*               
www      httpd      tcp4 6 *:80            
www      httpd      tcp4   *:*                 
www      httpd      tcp4 6 *:80           
www      httpd      tcp4   *:*     
www      httpd      tcp4 6 *:80  
www      httpd      tcp4   *:* 
www      httpd      tcp4 6 *:80
www      httpd      tcp4   *:*
```

And also i want to add some module like mod_mem_cache and else. I try to delete apache22 but it only delete apache22 port not all ports installed with apache.


----------



## SirDice (May 30, 2010)

Jeff_8420 said:
			
		

> Hi All,
> i install and configure apache22 and everything work. But in sockstat view to many processes for apache, is this ok?


Yes, that's normal.



> And also i want to add some module like mod_mem_cache and else. I try to delete apache22 but it only delete apache22 port not all ports installed with apache.



`# pkg_delete -rx apache`

See pkg_delete(1)


----------



## Carpetsmoker (May 30, 2010)

> i install and configure apache22 and everything work. But in sockstat view to many processes for apache, is this ok?



Yes, Apache fork(2)s a number of times, each process serves one request, so if you want to serve 4 simultaneous users, then you'll need 4 processes, if you want to serve 16, you'll need 16, etc.

The three most important directives to control the number of forks are: StartServers, MinSpareServers, and MaxSpareServers. See the Apache docs:
http://httpd.apache.org/docs/2.1/mod/prefork.html

Note there are also other ways of handling things, such as threads.


----------



## bsd10 (Oct 12, 2010)

Isn't the point of Apache 2.0 and above to use threads instead of processes for each request to increase performance? Why is the default prefork for Unix?


----------



## Alt (Oct 13, 2010)

bsd10 said:
			
		

> Isn't the point of Apache 2.0 and above to use threads instead of processes for each request to increase performance? Why is the default prefork for Unix?


Not all modules are thread-safe so just turning it on can lead to crash problems http://httpd.apache.org/docs/2.0/developer/thread_safety.html


----------

