Apache的fork模式和worker模式判断方法
程序员文章站
2022-06-08 22:10:00
本文章来给各位同学介绍判断apache的工作模式是prefork模式还是worker模式,测试方法我们只要使用http来操作。
apache常用的工作模式有prefork...
本文章来给各位同学介绍判断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来操作了。
推荐阅读
-
Apache的fork模式和worker模式判断方法
-
Linux下SVN服务器同时支持Apache的http和svnserve独立服务器两种模式且使用相同的访问权限账号
-
Linux初学(CnetOS7 Linux)之切换命令模式和图形模式的方法
-
如何设置FTP的主动模式和被动模式 FileZilla主动和被动模式设置方法
-
Win10飞行模式怎么开启?Win10打开和关闭飞行模式的方法
-
关于Object类中的wait()和notify()方法实现生产者和消费者模式
-
模版方法,策略模式和状态模式之间的区别
-
win7如何进入或退出测试模式 win7系统进入和退出测试模式的方法图文教程
-
Oracle的RBO和CBO详细介绍和优化模式设置方法
-
C# 单例模式和窗体的单例打开方法