You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by wang yu <wa...@gmail.com> on 2008/03/14 04:03:05 UTC

apache-openjpa-1.0.2 performance degrade under long-run press testing

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

Re: apache-openjpa-1.0.2 performance degrade under long-run press testing

Posted by Kevin Sutter <kw...@gmail.com>.
Hi,

On Wed, Mar 19, 2008 at 9:23 PM, wang yu <wa...@gmail.com> wrote:

> the problem is resolved.


Can you post how the problem was resolved?  Even if it was a "user error",
others on the list may learn from it.

Thanks,
Kevin


>
> On Fri, Mar 14, 2008 at 11:03 AM, wang yu <wa...@gmail.com> wrote:
>
> > 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
> >
> >
> >
> >
> >
>

Re: apache-openjpa-1.0.2 performance degrade under long-run press testing

Posted by wang yu <wa...@gmail.com>.
the problem is resolved.

On Fri, Mar 14, 2008 at 11:03 AM, wang yu <wa...@gmail.com> wrote:

> 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
>
>
>
>
>

Re: apache-openjpa-1.0.2 performance degrade under long-run press testing

Posted by Kevin Sutter <kw...@gmail.com>.
Thanks, Yu.  That makes sense.  And, the information may help future users
of OpenJPA.

Kevin

On Mon, Mar 24, 2008 at 2:56 AM, wang yu <wa...@gmail.com> wrote:

> Kevin,Can you tell me how to replay a thread in openjpa? I didn't find any
> link to reply a topic on the web page.
>
> For openjap on tomcat issue, since tomcat is not a EE5 compliant
> application server, we need enhance all entity class on the compilation
> time.
> You can add enhancement action into your ant file like below:
>
>     <taskdef name="openjpac"
>         classname="org.apache.openjpa.ant.PCEnhancerTask">
>         <classpath refid="classpath" />
>     </taskdef>
>
>     <target name="enhance" depends="compile">
>         <openjpac>
>             <config
> propertiesFile="${basedir}\WebContent\WEB-INF\classes\META-INF\persistence.xml"/>
>             <classpath>
>                 <pathelement location="${builddir}"/>
>             </classpath>
>             <fileset dir="${builddir}" includes="$**/*.class"/>
>         </openjpac>
>     </target>
>
> On Fri, Mar 14, 2008 at 11:03 AM, wang yu <wa...@gmail.com> wrote:
>
> > 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
> >
> >
> >
> >
> >
>

Re: apache-openjpa-1.0.2 performance degrade under long-run press testing

Posted by wang yu <wa...@gmail.com>.
Kevin,Can you tell me how to replay a thread in openjpa? I didn't find any
link to reply a topic on the web page.

For openjap on tomcat issue, since tomcat is not a EE5 compliant application
server, we need enhance all entity class on the compilation time.
You can add enhancement action into your ant file like below:

    <taskdef name="openjpac"
        classname="org.apache.openjpa.ant.PCEnhancerTask">
        <classpath refid="classpath" />
    </taskdef>

    <target name="enhance" depends="compile">
        <openjpac>
            <config
propertiesFile="${basedir}\WebContent\WEB-INF\classes\META-INF\persistence.xml"/>
            <classpath>
                <pathelement location="${builddir}"/>
            </classpath>
            <fileset dir="${builddir}" includes="$**/*.class"/>
        </openjpac>
    </target>

On Fri, Mar 14, 2008 at 11:03 AM, wang yu <wa...@gmail.com> wrote:

> 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
>
>
>
>
>