【发布时间】:2014-06-16 15:45:25
【问题描述】:
我正在使用 Jmeter(Oracle、Tomcat、Spring)分析我的 Web 应用程序性能。
Number of threads :20
Ramp up: 2
Loop: 500
我只用 Jmeter 模拟一个简单的网站登录。
当我在上面的这些设置中开始时。前 3 分钟它开始非常快(平均响应时间 500 毫秒),但它开始迅速变慢,到 15 分钟,响应时间下降到 5 秒。完成一个请求需要几分钟。
我不确定这是否正常,或者问题是 Tomcat 还是我的 c3po 池设置不正确。
这是我对 c3po 的设置:
<property name="testConnectionOnCheckout" value="false" /> <!-- do not test connection isValid on checkout as it has bad performance result -->
<property name="testConnectionOnCheckin" value="true" /> <!-- test connection isValid on checkin -->
<property name="idleConnectionTestPeriod" value="60" /> <!-- test every 60 seconds -->
<property name="checkoutTimeout" value="5000" /> <!-- The number of milliseconds a client calling getConnection() will wait for a Connection to be checked-in or acquired when the pool is exhausted. -->
<property name="acquireRetryAttempts" value="30" /> <!-- Defines how many times c3p0 will try to acquire a new Connection from the database before giving up. -->
<property name="acquireRetryDelay" value="1000" /> <!-- Milliseconds, time c3p0 will wait between acquire attempts. -->
<property name="breakAfterAcquireFailure" value="true" /> <!-- If true, a pooled DataSource will declare itself broken and be permanently closed if a Connection cannot be obtained from the database after making acquireRetryAttempts to acquire one. -->
<property name="maxIdleTime" value="180" /> <!-- 3 minutes, then die -->
<property name="maxConnectionAge" value="300" /> <!-- 5 minutes, then die -->
<property name="minPoolSize" value="1" />
<property name="initialPoolSize" value="2" />
<property name="maxPoolSize" value="25" />
<property name="acquireIncrement" value="1" /> <!-- ramp up the pool with 1 connection if all others are in use -->
<property name="unreturnedConnectionTimeout" value="360" /> <!-- in seconds (6 minutes), actually this should be necessary if connections are not closed properly and thus are leaked -->
<property name="numHelperThreads" value="10" />
<property name="maxStatementsPerConnection" value="5" />
我还安装了 VisualVm 来监控 Tomcat,但不知道如何分析它,我应该检查内存池还是堆还是 Perm gen..?
任何想法为什么它可能会变慢或如何检查它?
当响应时间开始变慢时,Ps Old gen Memory Pool size graph peaks 可能有任何关系吗? 我的 Cm 连接设置是
-Xmx1024m -XX:MaxPermSize=512M
【问题讨论】:
标签: java performance oracle tomcat jmeter