最近我购买了运行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>
干杯
这是我目前的configuration
# 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>
Apache(以及其他multithreading应用程序)将默认使用所有可用的内核。 只要你没有将Apache设置为使用比核心服务器less的服务器,就没有其他需要采取的措施。
Apache中运行的是什么? 通常,线程的限制是使用非线程模块或应用程序代码。
默认情况下,在大多数Apache打包版本中都可以使用股票configuration,所以你不需要做任何事情。
Apache如何在多核系统上工作以及如何对其进行configuration受到您使用哪个MPM的很大影响。 最常见的MPM之一是prefork。
Prefork基本上为每个请求提供一个单独的进程。 操作系统可以轻松地将进程分散到全部内核中。
工作者MPM实际上启用了multithreading操作,但与某些不是线程安全的Apache模块(即PHP)不兼容。
看到这个页面核心function和多处理模块 ,并按照链接和阅读有关可用的各种模块。