本文章来给各位同学介绍判断apache的工作模式是prefork模式还是worker模式,测试方法我们只要使用http来操作。
apache常用的工作模式有prefork和worker模式。运行命令httpd -l 或者apache2 -l ,输出的结果中如果含有prefork.c,那就是prefork模式,如果结果中含有worker.c,那就是worker模式。
知道模式之后我们可以在apache的confextrahttpd-mpm.conf 进行编辑了
# # server-pool management (mpm specific) # # # pidfile: the file in which the server should record its process # identification number when it starts. # # note that this is the default pidfile for most mpms. # <ifmodule !mpm_netware_module> pidfile "logs/httpd.pid" </ifmodule> # # the accept serialization lock file must be 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 will 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 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> # worker mpm # startservers: initial number of server processes to start # maxclients: maximum number of simultaneous client connections # minsparethreads: minimum number of worker threads which are kept spare # 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 150 minsparethreads 25 maxsparethreads 75 threadsperchild 25 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 will process <ifmodule mpm_beos_module> startthreads 10 maxclients 50 maxrequestsperthread 10000 </ifmodule> # netware mpm # threadstacksize: stack size allocated for each worker thread # startthreads: number of worker threads launched at server startup # minsparethreads: minimum number of idle threads, to handle request spikes # maxsparethreads: maximum number of idle threads # maxthreads: maximum number of worker threads alive at the same time # maxrequestsperchild: maximum number of requests a thread serves. it is # recommended that the default value of 0 be set for this # directive on netware. this will allow the thread to # continue to service requests indefinitely. <ifmodule mpm_netware_module> threadstacksize 65536 startthreads 250 minsparethreads 25 maxsparethreads 250 maxthreads 1000 maxrequestsperchild 0 maxmemfree 100 </ifmodule> # os/2 mpm # startservers: number of server processes to maintain # minsparethreads: minimum number of idle threads per 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 10 maxrequestsperchild 0 </ifmodule> # winnt mpm # threadsperchild: constant number of worker threads in the server process # maxrequestsperchild: maximum number of requests a server process serves <ifmodule mpm_winnt_module> threadsperchild 150 maxrequestsperchild 0 </ifmodule>
我们如果是windows系统一般是使用最后面的winnt mpm来操作了。
如对本文有疑问, 点击进行留言回复!!
centos 7 安装卸载apache(httpd)服务的详细步骤
网友评论