Apache Http Server:
影响性能的最核心特性:MPM(Multi-Processing Modules,多道处理模块):
进入httpd-2.0.45目录,运行以下代码:
$ ./configure --help|grep mpm
显示如下:
--with-mpm=MPM
Choose the process model for Apache to use.
MPM={beos|worker|prefork|mpmt_os2| perchild|leader|threadpool}
上述操作用来选择要使用的进程模型,即哪种MPM模块。prefork就是Unix平台上缺省的MPM。查看Httpd.conf
Set to true if you want calls to request.getRemoteHost() to perform DNS lookups in order to return the actual host name of the remote client. Set to false to skip the DNS lookup and return the IP address in String form instead (thereby improving performance). By default, DNS lookups are enabled.
Server.xml中的Connector 节点中进行设置:修改server.xml文件中的enableLookups参数值为false
3 调整线程数
Server.xml中的Connector 节点中进行设置如下:
minProcessors 服务器启动时创建的处理请求的线程数
maxProcessors 最大可以创建的处理请求的线程数
maxThreads:这个值表示Tomcat可创建的最大的线程数。 默认为200;If not specified, this attribute is set to 200。
acceptCount :指定当所有可以使用的处理请求的线程数都被使用时,可以放到处理队列中的请求数,超过这个数的请求将不予处理。The default value is 100
connnectionTimeout 网络连接超时,单位:毫秒。设置为0表示永不超时,这样设置有隐患的。通常可设置为30000毫秒。
minSpareThreads Tomcat初始化时创建的线程数。 If not specified, the default of 10 is used.
maxSpareThreads 一旦创建的线程超过这个值,Tomcat就会关闭不再需要的socket线程。 (tomcat5以后已删除)