For tomcat benchmark testing

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 并发测试通过了,硬件配置见前一帖。

comments powered by Disqus
本博客始于 2007 年
Built with Hugo
主题 StackJimmy 设计