users@glassfish.java.net

Performance degradation versus JBoss

From: <glassfish_at_javadesktop.org>
Date: Fri, 21 Dec 2007 00:26:29 PST

I am trying to performance-test my application and I'm running into a problem. I am running a standalone client creating several hundred entities. Initially, performance is fine, but after time, it slowly degrades. Increasing the loglevel shows that I'm only doing simple inserts into the DB (MySQL). I ran my test on JBoss and saw no performance issue. Can anyone offer some help to make sure I haven't misconfigured anything?

Inserts for 100 entities on Glassfish: 100ms initialy, degrades to 1500ms per insert
Inserts for 100 entities on JBoss (4.2.2GA): 50ms average from start to finish.

I've tried to disable the toplink essentials entity cache, considering I'm only doing inserts, but there was no noticeable performance increase. Also, when running on 1000 entities, I see insert times of 5 seconds after when approaching the 1000'th entity. Something is obviously misconfigured;

[b] settings: [/b]
GF version: V2, B58g, Linux 2.6.23.9, Sun java 1.6.0_03, MySql 5.0.4.5

[b]Test method:[/b]
@Test void perfTest() throws Exception{

    EntityManagerFactory emf = Persistence.createEntityManager("sample");
    EntityManager manager = emf.createEntityManager();
    UserTransaction utx = manager.getTransaction();
    for (int i = 0; i < 100; i++){
      long start = System.currentTimeMillis();
      utx.begin();
      MyEntity en = new MyEntity();
      en.setDescription("foo");
      manager.persist(en);
      utx.commit();
      System.out.println("Elapsed: " + System.currentTimeMillis() - start);
    }
}

[b]persistence.xml[/b]
<persistence>
<persistence-unit name="sample" transaction-type="RESOURCE_LOCAL">
<class>com.simple.entity.MyEntity</class>
<properties>
<property name="toplink.logging.level.sql" value="INFO"/>
<property name="toplink.target-database" value="oracle.toplink.essentials.platform.database.MySQL4Platform"/>
<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="toplink.jdbc.url" value="jdbc:mysq://localhost/testdb"/>
<property name="toplink.cache.type.default" value="NONE"/>
<property name="toplink.jdbc.user" value="mysqluser"/>
<property name="toplink.jdbc.password" value="xxxxxx"/>
<property name="toplink.ddl-generation" value="drop-and-create-tables"/>
</properties>
</persistence-unit>
</persistence>
[Message sent by forum member 'swisstraveler' (swisstraveler)]

http://forums.java.net/jive/thread.jspa?messageID=251095