设置 Apache 以使用多核

Gri*_*ckz 3 linux multi-core apache-2.2

最近我购买了一台运行 Ubuntu 10.04 和 Apache 的 6 核服务器。您如何设置 apache 以使用所有 6 个内核以及执行此操作的最佳实践是什么?

是否可能,如果可能,是否与以下内容有关(这些不是我的设置)?

<IfModule prefork.c> 
StartServers 10 
MinSpareServers 10 
MaxSpareServers 20 
ServerLimit 1500 
MaxClients 1500 
MaxRequestsPerChild 4000 
</IfModule>

<IfModule worker.c> 
StartServers 2 
MaxClients 150 
MinSpareThreads 25 
MaxSpareThreads 75 
ThreadsPerChild 25 
MaxRequestsPerChild 0 
</IfModule> 
Run Code Online (Sandbox Code Playgroud)

干杯

这是我目前的配置

# 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
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event 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_event_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>
Run Code Online (Sandbox Code Playgroud)

EEA*_*EAA 10

默认情况下,Apache(和任何其他多线程应用程序)将使用所有可用的内核。只要您没有将 Apache 设置为使用的服务器数少于核心数,您就无需采取其他措施。