-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Performance problem with concurrent access
PostPosted: Tue Feb 17, 2009 9:57 pm 
Newbie

Joined: Tue Apr 03, 2007 4:30 pm
Posts: 5
Dear wizards,

I have th e following problem with Hibernate 3.2 + MySQL 5.0:

I am developing a client-server application where a server needs to serve hundreds of clients simultaneously. The server is based on Spring, Hibernate and MySQL.

I am running some stress tests where I simulate a number of clients that connect to the database and do some basic queries and updates. This works fine for up to 27 clients, but with 30 clients, performance drops to a tenth. It seems like I'm running into some kind of defined concurrency limit, but I just can't figure out where this limit is set.

My MySQL server allows up to 100 simultaneous connections.

My hibernate is configured with c3p0 as follows:

Code:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
        <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1/myapp"/>
        <property name="user" value="myuser"/>
        <property name="password" value=""/>
        <property name="acquireIncrement" value="5" />
       <property name="initialPoolSize" value="50" />
       <property name="maxPoolSize" value="100" />
       <property name="minPoolSize" value="50" />
       <property name="maxIdleTime" value="3600" /> 
                       
   </bean>

   <bean id="sessionFactoryBase" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" abstract="true">
      <property name="dataSource" ref="dataSource" />
        <property name="hibernateProperties">
          <value>
               hibernate.dialect=org.hibernate.dialect.MySQLDialect
               hibernate.show_sql=false
               hibernate.format_sql=true
            </value>
        </property>      
   </bean>


Does anyone have the slightest idea what's going on?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 18, 2009 8:46 am 
Newbie

Joined: Tue Apr 03, 2007 4:30 pm
Posts: 5
I'd like to add one more thing: with 27 clients, the mysql process is consuming some 50% of the CPU. With 30 clients, mysql is using only 1-2%. All of a sudden Java is using nearly 100%!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 18, 2009 8:54 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Could it be that you need to increase the max memory that is allocated to java? I have experienced similar problems before when the memory usage of the java program is very near the upper limit. The time taken to do a task could easily increase by a factor of 10-20 or more. I guess what happens is that the garbage collector uses up most of the cpu time.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 18, 2009 8:58 am 
Newbie

Joined: Tue Apr 03, 2007 4:30 pm
Posts: 5
nordborg wrote:
Could it be that you need to increase the max memory that is allocated to java? I have experienced similar problems before when the memory usage of the java program is very near the upper limit. The time taken to do a task could easily increase by a factor of 10-20 or more. I guess what happens is that the garbage collector uses up most of the cpu time.


Hello,

I tried to increase the maximum heap space to 256 MB with the -Xmx JVM parameter. That made no difference. The application itself is using approximately 40 MB heap.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.