Hello,
I met one performance  issue with apache-openjpa-1.0.2.
My environment includes apache-openjpa-1.0.2,db-derby-10.3.2.1-bin,and
apache-tomcat-5.5.26.

Below is the openjpa-related properties defined in the persistnce.xml:
        <property name="openjpa.ConnectionDriverName" value="
org.apache.derby.jdbc.ClientDriver"/>
        <property name="openjpa.ConnectionURL"
value="jdbc:derby://localhost:1527/tsam20-database;create=true"/>
        <property name="openjpa.ConnectionUserName" value="app"/>
        <property name="openjpa.ConnectionPassword" value="app"/>
        <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema"/>
        <property name="openjpa.Log" value="DefaultLevel=WARN,SQL=TRACE"/>

And there is my main testing code:
        EntityManagerFactory factory = (EntityManagerFactory)
servlet_context.getAttribute("FACTORY");
        EntityManager em = null;
        try {
            em = factory.createEntityManager();
            for (int i = 0; i < 1000000; i++) {
                em.getTransaction().begin();
                for (int j = 0; j < 100; j++) {
                    MyMessage m = new MyMessage("Hello Persistence!"+j);
                    em.persist(m);
                }
                System.out.print("#");
                em.getTransaction().commit();
                em.clear();
            }
        } catch (Exception e) {
            if (em != null)
                em.getTransaction().rollback();
            e.printStackTrace();
        } finally {
            em.close();
        }

I noticed if I run openjpa in a j2se env, the performance is very good and
keeps steady for long time.

But If I run openjpa persisting in a tomcat container, the performance
degrades after half an hour and the java process will be totally "fronzen"
after one or two hour.

Does anybody have ideas about this issue? If there's some tips about how to
use openjpa in a j2ee application? Or, I should use a more enterprise-grade
DB server like oracle?

Regards,
Yu Wong

Reply via email to