论坛首页 Java版 Spring

spring+hibernate+struts2的性能问题,啊!!!!!!!!!!!!!

浏览 601 次
该帖已经被评为隐藏帖
作者 正文
时间:2007-07-07

我的框架使用spring+hibernate+struts2架构,服务器采用tomcat6,针对spring和struts2这块没有什么特殊的设置,hibernate这块的连接池采用了c3p0,详细设置如下:
datasource.type=mssql
datasource.driverClassName=net.sourceforge.jtds.jdbc.Driver
datasource.url=jdbc:jtds:sqlserver://localhost:1433/db
datasource.username=db
datasource.password=db

datasource.maxActive=10
datasource.maxIdle=2
datasource.maxWait=120000
datasource.whenExhaustedAction=1
datasource.testOnBorrow=true
datasource.testOnReturn=false

c3p0.acquireIncrement=3
c3p0.initialPoolSize=3
c3p0.idleConnectionTestPeriod=900
c3p0.minPoolSize=2
c3p0.maxPoolSize=50
c3p0.maxStatements=100
c3p0.numHelperThreads=10
c3p0.maxIdleTime=600

hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.jdbc.batch_size=25
hibernate.jdbc.fetch_size=50
hibernate.show_sql=false

不知上述配置有何问题,我的程序总是出现假死现象,即点击任何链接无任何反应,CPU使用也正常。我必须重启tomcat。基本上几分钟出现一次!

robbin大哥这是怎么回事啊!
   
时间:2007-07-07
没有任何说明,让人家怎么帮你,

一点智慧没有的问题。

可能是数据库或同步锁了,
   
0 请登录后投票
时间:2007-07-07
C3P0使用不当,会造成数据库链接池耗尽,我们在项目中遇到过这种情况。
你将链接池换成dbcp的试试看
   
0 请登录后投票
时间:2007-07-07
Godlikeme 写道
没有任何说明,让人家怎么帮你,

一点智慧没有的问题。

可能是数据库或同步锁了,



如果我要是知道哪有问题我就不用问了!
标准的访问数据写法如:
try {
getHibernateTemplate().saveOrUpdate(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
try {
String queryString = "from UserRole";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
哪会造成数据库或同步锁。
   
0 请登录后投票
时间:2007-07-07
引用
robbin大哥这是怎么回事啊!

违反JE提问精神哦,切记切记。
   
0 请登录后投票
时间:2007-07-07
druze 写道
C3P0使用不当,会造成数据库链接池耗尽,我们在项目中遇到过这种情况。
你将链接池换成dbcp的试试看

使用dbcp是最后的办法,我现在想找出问题究竟是否出在c3p0身上?
   
0 请登录后投票
时间:2007-07-07
rainlife 写道
引用
robbin大哥这是怎么回事啊!

违反JE提问精神哦,切记切记。

我在其他的论坛问了个遍了,也没有能解决,知道robbin对hibernate有深研究,所以指名robbin帮忙,如有违规,下次注意!
   
0 请登录后投票
论坛首页 Java版 Spring

跳转论坛:
JavaEye推荐