The fork model of Apache and the method of judging the worker mode _linux

Source: Internet
Author: User
Tags constant

This article to give you to the students to judge the working mode of Apache is prefork mode or worker mode, test methods we just use HTTP to operate.

Apache's common working mode is prefork and worker mode. Run command httpd-l or apache2-l, if the output contains prefork.c, that is the prefork mode, if the result contains worker.c, that is the worker model.

Once we know the pattern, we can edit it in Apache confextrahttpd-mpm.conf.

# # Server-pool Management (MPM specific) # # Pidfile:the file in which the ' Server should record its process # Identi
Fication number when it starts. 
# # # That's the default pidfile for most MPMs. # <ifmodule!mpm_netware_module> pidfile ' logs/httpd.pid '
</IfModule> # The Accept serialization lock file must is STORED on A local DISK. # <ifmodule!mpm_winnt_module> <ifmodule!mpm_netware_module> lockfile "Logs/accept.lock" </IfModule > </IfModule> # Only one of the below sections'll be relevant on your # installed httpd.
Use ' apachectl-l ' to find out the # active MPM.  # # Prefork MPM # 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 num ber of server processes allowed to start # Maxrequestsperchild:maximum number of requests a server process serves &LT;IFMOdule mpm_prefork_module> startservers 5 minspareservers 5 maxspareservers Ten MaxClients Requestsperchild 0 </IfModule> # worker MPM # startservers:initial number of server processes to start # Maxclien Ts:maximum number of simultaneous client connections # minsparethreads:minimum number of worker threads which are-kept s  Pare # maxsparethreads:maximum number of worker threads which are kept spare # threadsperchild:constant number of worker Threads in each server process # Maxrequestsperchild:maximum number of requests a server process serves <ifmodule MPM _worker_module> startservers 2 maxclients minsparethreads maxsparethreads
LD Maxrequestsperchild 0 </IfModule> # BeOS MPM # startthreads:how Many threads do we initially spawn?  # Maxclients:max Number of threads we can have (1 thread = 1 client) # Maxrequestsperthread:maximum number of requests Each thread would process &Lt;ifmodule mpm_beos_module> startthreads maxclients maxrequestsperthread 10000

; # NetWare MPM # threadstacksize:stack size allocated for each worker thread # Startthreads:number of worker threads Laun Ched at server startup # minsparethreads:minimum number of idle threads, to handle request spikes # Maxsparethreads:maxi Mum number of idle threads # maxthreads:maximum number of worker threads alive at the same time # Maxrequestsperchild:ma Ximum number of requests a thread serves. It is # recommended that the default value of 0 was set for this # directive on NetWare.             
This would allow the thread to # continue to service requests indefinitely. <ifmodule mpm_netware_module> threadstacksize 65536 startthreads-minsparethreads Hreads MaxThreads 1000 maxrequestsperchild 0 maxmemfree </IfModule> # os/2 MPM # Star Tservers:numberof server processes to maintain # Minsparethreads:minimum number of idle threads/process, # to handle request  Spikes # maxsparethreads:maximum Number of idle threads per process # Maxrequestsperchild:maximum number of connections    Per Server process <ifmodule mpm_mpmt_os2_module> startservers 2 minsparethreads 5 maxsparethreads Maxrequestsperchild 0 </IfModule> # WinNT MPM # threadsperchild:constant number of worker threads in the SE
  RVer Process # Maxrequestsperchild:maximum number of requests a server process serves <ifmodule mpm_winnt_module>

 Threadsperchild Maxrequestsperchild 0 </IfModule>

If we are a Windows system, we typically use the back Winnt MPM to operate.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.