当前位置: 首页 > 编程笔记 >

Apache的fork模式和worker模式判断方法

龙毅
2023-03-14
本文向大家介绍Apache的fork模式和worker模式判断方法,包括了Apache的fork模式和worker模式判断方法的使用技巧和注意事项,需要的朋友参考一下

本文章来给各位同学介绍判断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来操作了。

 类似资料:
  • Example: fork Fork is a method of XClient and you can use it to send a request to all servers that contains this service. If any of servers returns response whithout an error, Fork will return for thi

  • 参与GitHub中的项目开发,最常用和推荐的首选方式是“Fork + Pull”模式。在“Fork + Pull”模式下,项目参与者不必向项目创建者申请提交权限,而是在自己的托管空间下建立项目的派生(Fork)。 如果一个开源项目派生出另外的项目,通常意味着项目的分裂和开发团队的削弱,而GitHub中的项目派生则不会,而且正好相反,GitHub中的项目派生是项目壮大的体现。所有的派生项目都会有链接

  • 本文向大家介绍生成式模型、判别式模型相关面试题,主要包含被问及生成式模型、判别式模型时的应答技巧和注意事项,需要的朋友参考一下 https://github.com/imhuay/Algorithm_Interview_Notes-Chinese/blob/master/A-机器学习/A-机器学习基础.md#生成模型与判别模型 生成式模型(generative model)会对x和y的联合分布p(

  • 问题内容: 在Python脚本中,是否有任何方法可以判断解释器是否处于交互模式?这将很有用,例如,当您运行交互式Python会话并导入模块时,将执行略有不同的代码(例如,关闭日志记录)。 我已经看过判断python是否处于-i模式并在那里尝试了代码,但是,该函数仅在使用- i标志调用了Python的情况下才返回true,而在用于调用交互模式的命令没有参数时则返回true 。 我的意思是这样的: 问

  • 在阅读ReentrantLock的源代码时,我发现它在内部使用了一个同步器来控制锁,该同步器扩展了AbstractQueuedSynchronizer。Doug Lea在本文中提到,AbstractQueuedSynchronizer作为“模板方法模式”,有助于简化子类的编码。 然而,约书亚·布洛赫在《有效的Java》中建议,我们应该“支持组合而不是继承”,因为“与方法调用不同,继承违反了封装”。

  • 回退方法和实际方法应该返回相同的返回类型。 我应该怎么做才能从回退方法返回字符串,并从实际方法返回一些对象?