Hibernate version: 3.2.5
Full stack trace of any exception that occurs:
none.
Name and version of the database you are using:
MySQL 4.1.20
The generated SQL (show_sql=true):
none
Debug level Hibernate log excerpt:
none
This is a very strange and annoying problem to me.
I was running a site with Apache + Resin 2.1.17 + JSP(JSTL) , Hibernate 2.1 , C3P0 connection pool , and my custom cache solution (not using any Hibernate 2nd level cache).
My site worked very well. Its loads up to 2000 users online (sessions expire : 30 min) and still ran very smoothly.
But for some reason , I have to use hibernate's second cache , and I felt my site's architecture was too old. So I decided to upgrade my site to
Hibernate 3.2.5 , Resin 3.0.24 , ehcache-1.2.3 , c3p0-0.9.1.2.
Sure , I did re-write some HQL and Queries / Filters to match Hibernate3's spec.
In my local test environment , everything works fine , 2nd level cache (ehcache) works perfectly , no any errors.
But when I deploy my code to the high load site , it started to behave strange. At first (webapp's start) , everything works fine , and users (sessions) count can reach up to 2000 or higher , and the site still runs smoothly . But after a few hours (not sure how many , sometimes 6 , sometimes 8 , and sometimes one or two days later) , the site begins to "
stagnate" , it seems something got "locked".
When the "
stagnation" happens , the site will soon become slow-responsive , and the system finally "locks" , "hangs" , and
no any error messages output" . I have to restart the webapp to "revive" my site.
It is very annoying to me. I don't know where goes wrong , because there is no error message dump , no stdout or stderr message dump. The site just stagnate out there. I use
mytop to look into mysqld's status , everything is fine , just
no any connections from the webapp.
My code didn't change too much , just some dao's rewrite (HQL/Query) to confirm to Hibernate3's spec.
I doubt if this is ehcache (1.2.3)'s problem . Does anybody use ehcache in such a high load site ?
Due to my upgrade incorporated many parts (Resin 2.1.17 -> Resin 3.0.24 , Hibernate 2.1 -> Hibernate 3.2.5 , custom cache -> ehcache 1.2.3 , c3p0-0.8.4.5 -> c3p0-0.9.1.2 ) , I cannot pinpoint which part goes wrong. But I feel ehcache is the most suspicious.
Is there anybody have similar situation like this ?
Or can anybody can tell which part goes wrong ?
Here is my settings :
ehcache.xml
Code:
<defaultCache
maxElementsInMemory="100"
eternal="false"
timeToIdleSeconds="1200"
timeToLiveSeconds="1200"
overflowToDisk="false"/>
...other classes' caches are similar
hibernate.cfg.xml
Code:
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">50</property>
<property name="hibernate.c3p0.acquire_increment">0</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.idle_test_period">300</property>
I tried a lot of c3p0's parameters above , but the problem still exists. So I feel it
may be not c3p0's problem.