加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 设置Apache以使用多个核心

发布时间:2020-12-14 02:32:17 所属栏目:Linux 来源:网络整理
导读:最近我购买了一个运行Ubuntu 10.04和Apache的6核服务器.如何设置apache以使用所有6个内核,最佳做法是什么? 是否可能,如果有可能,它与下面的内容有关(这些不是我的设置)? IfModule prefork.c StartServers 10 MinSpareServers 10 MaxSpareServers 20 Server
最近我购买了一个运行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>

干杯

这是我目前的配置

# 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(以及任何其他多线程应用程序)默认使用所有可用内核.只要您没有将Apache设置为使用比拥有内核更少的服务器,就不需要采取其他操作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读