在Apusic中根据多核环境进行参数优化

原文出自:http://operamasks.blogbus.com/logs/19319973.html

Apusic IO实现中采用NIO Selector,在多核环境下,可以在Apusic服务中添加NumberSelectors参数,提升多核或多CPU的使用效率:

在apusic.conf配置文件的http服务配置片段,加入 NumberSelectors属性,设置其值等于核的数量。

Apusic 4.0.3的配置片段

<SERVICE
    CLASS="com.apusic.servlet.http.WebService"
    >
    <ATTRIBUTE NAME="ServerPort" VALUE="6888"/>
    <ATTRIBUTE NAME="MaxWaitingClients" VALUE="500"/>
    <ATTRIBUTE NAME="WaitingClientTimeout" VALUE="15"/>

    <ATTRIBUTE NAME="NumberSelectors" VALUE="2"/>
    <ATTRIBUTE NAME="KeepAlive" VALUE="true"/>
    <ATTRIBUTE NAME="KeepAliveTimeout" VALUE="75"/>
    <ATTRIBUTE NAME="MaxKeepAliveRequests" VALUE="500"/>
    <ATTRIBUTE NAME="MaxKeepAliveConnections" VALUE="1500"/>
    <ATTRIBUTE NAME="ServletReloadCheckInterval" VALUE="3"/>
    <ATTRIBUTE NAME="TemporaryDirectory" VALUE="scratch"/>
    <ATTRIBUTE NAME="EnableLog" VALUE="True"/>
    <ATTRIBUTE NAME="LogFileName" VALUE="logs/access.log"/>
    <ATTRIBUTE NAME="LogFileLimit" VALUE="1000000"/>
    <ATTRIBUTE NAME="LogFileCount" VALUE="10"/>
</SERVICE>

Apusic 5.0的配置片段:

<SERVICE
    CLASS="com.apusic.web.WebService"
    >
    <ATTRIBUTE NAME="ServerPort" VALUE="6888"/>
    <ATTRIBUTE NAME="MaxWaitingClients" VALUE="500"/>
    <ATTRIBUTE NAME="WaitingClientTimeout" VALUE="5"/>

    <ATTRIBUTE NAME="NumberSelectors" VALUE="2"/>
    <ATTRIBUTE NAME="KeepAlive" VALUE="true"/>
    <ATTRIBUTE NAME="KeepAliveTimeout" VALUE="75"/>
    <ATTRIBUTE NAME="MaxKeepAliveRequests" VALUE="100"/>
    <ATTRIBUTE NAME="MaxKeepAliveConnections" VALUE="300"/>
    <ATTRIBUTE NAME="ServletReloadCheckInterval" VALUE="3"/>
    <ATTRIBUTE NAME="EnableLog" VALUE="True"/>
    <ATTRIBUTE NAME="LogFileName" VALUE="logs/access.log"/>
    <ATTRIBUTE NAME="LogFileLimit" VALUE="1000000"/>
    <ATTRIBUTE NAME="LogFileCount" VALUE="10"/>
</SERVICE>

你可能感兴趣的:(html)