For tomcat benchmark testing

字数:500 |大约阅读时间 1 分钟
标签: benchmark   opensource   Tomcat  

Tomcat Configuration 查看一下可以配置的参数TomCat设置JVM的参数Setting JVM Options for TomcatEdit the /usr/locat/apache-tomcat/bin/catalina.sh file and add the JVM options to the JAVA_OPTS environment variable.JVM Option Value Description-Xmx 4g The maximum Java heap size.-Xms 4g The initial Java heap size.-Xmn 1g The size of young generation.-XX:+UseParallelGC – To use parallel garbage collection for scavenges.-XX:PermSize 50m The initial size of permanent generation.注释:上面两个4g的值,我没试过,我用8GB内存windows的机器1.5GB能启动,超过了Tomcat服务就启动不了了。配置Tomcat Connector AttributesEdit the /usr/locat/apache-tomcat/conf/server.xml file and add the attributes listed in Table 3 to the Connector element.下面是个例子供参考Tomcat Configuration Attribute Value DescriptionThe maximum number of request processing threads to be created by this connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, the default value for this attribute is 40. If an executor is associated with this connector, this attribute is ignored and the connector executes tasks using the executor rather than an internal thread pool.maxThreads 3000The maximum queue length for incoming connection requests when allpossible request processing threads are in use. Any requests received whenthe queue is full are refused. The default value is 10.acceptCount 2000The number of request processing threads that are created when this connectoris first started. The connector also verifies that it has the specified number ofidle processing threads available. This attribute should be set to a value smallerthan that set for maxThreads. The default value is 4.minSpareThreads 500The maximum number of unused request processing threads that are allowedto exist until the thread pool starts stopping the unnecessary threads. Thedefault value is 50.maxSpareThreads 2000Set to “true” if you want calls to request.getRemoteHost() to perform DNSlookups in order to return the actual host name of the remote client. Set toenableLookups false “false” to skip the DNS lookup and return the IP address in String form instead(thereby improving performance). By default, DNS lookups are enabled.上面的值比我实际使用的大,我的200并发测试通过了,硬件配置见前一帖。

DevOps教练在知乎

See Also