openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] OpenJPA > Beginners Performance Guide
Date Wed, 18 Aug 2010 15:35:02 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/5/_/styles/combined.css?spaceKey=openjpa&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/openjpa/Beginners+Performance+Guide">Beginners
Performance Guide</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~curtisr7@gmail.com">Rick
Curtis</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Work in progress<br />
    </div>
        <br/>
                         <h4>Changes (5)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Enhancement  <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">OpenJPA
uses byte-code weaving technologies to enhance user created Entity class objects at build
time or dynamically at run time. This allows us to efficiently handle these objects. OpenJPA
also has a feature that will auto-generate new subclasses or proxy objects that front the
user&#39;s Entity objects at run time, but that feature is not recommended for use. There
are numerous functional issues reported and it doesn&#39;t perform nearly as well. If
you ever see the following message you are using the non-recommended subclassing approach
to enhancement. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">OpenJPA
uses byte-code weaving technologies to enhance user created Entity class objects at build
time or dynamically at run time. This allows us to efficiently handle these objects.  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Follow
these instructions on how to properly enhance your Entities. <br>*[Entity Enhancement|openjpa:Entity
Enhancement]. <br> <br>OpenJPA also has a feature that will auto-generate new
subclasses or proxy objects that front the user&#39;s Entity objects at run time, but
*this feature is not recommended for use*. There are numerous functional issues reported and
it doesn&#39;t perform nearly as well. If you ever see the following message you are using
the non-recommended subclassing approach to enhancement. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >bq. 3328  pu_name INFO   \[main\]
openjpa.Enhance - Creating subclass for <span class="diff-changed-words">&quot;<span
class="diff-added-chars"style="background-color: #dfd;">\</span>[<span class="diff-added-chars"style="background-color:
#dfd;"> </span>class</span> org.apache.openjpa.entity.E1 , class <span class="diff-changed-words">org.apache.openjpa.entity.E2<span
class="diff-added-chars"style="background-color: #dfd;"> \</span>]&quot;.</span>
This means that your application will be less efficient and will consume more memory than
it would if you ran the OpenJPA enhancer. Additionally, lazy loading will not be available
for one-to-one and many-to-one persistent attributes in types using field access; they will
be loaded eagerly instead. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>It is recommended to set the following property to ensure that you don&#39;t
use this enhancement approach. <br> <br>{code:xml} <br>&lt;properties&gt;
 <br>    &lt;property name=&quot;openjpa.RuntimeUnenhancedClasses&quot;
value=&quot;unsupported&quot;/&gt; <br>&lt;properties&gt; <br>{code}
<br> <br>h2. Connection Pooling <br> <br>As of the 2.1.0 release OpenJPA
bundles [Apache Commons DBCP|http://commons.apache.org/dbcp/] as part of the binary download.
When running in JSE environments a default connection pool will be plugged in with the provided
database configuration properties. Most JEE container environments should provide some level
of connection pooling.  <br> <br>In releases prior to 2.1.0 add DBCP to your classpath
and use the following example to figure out how to configure pooling. <br> <br>{code:xml}
<br>&lt;persistence xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; version=&quot;1.0&quot;&gt;
<br>    &lt;persistence-unit name=&quot;example-derby&quot; transaction-type=&quot;RESOURCE_LOCAL&quot;&gt;
<br>        &lt;properties&gt; <br>            &lt;property name=&quot;openjpa.ConnectionProperties&quot;
 <br>                value=&quot;DriverClassName=org.apache.derby.jdbc.ClientDriver,
<br>                  Url=jdbc:derby://localhost:1527/database,  <br>        
         MaxActive=100,  <br>                  MaxWait=10000,  <br>          
       TestOnBorrow=true,  <br>                  Username=user,  <br>        
         Password=secret&quot;/&gt; <br>            &lt;property name=&quot;openjpa.ConnectionDriverName&quot;
 <br>                value=&quot;org.apache.commons.dbcp.BasicDataSource&quot;/&gt;
<br>        &lt;/properties&gt; <br>    &lt;/persistence-unit&gt;
<br>&lt;/persistence&gt; <br> <br>{code} <br>h2. Caching <br>
<br>{code:xml} <br>&lt;properties&gt;  <br>    &lt;property
name=&quot;openjpa.DataCache&quot; value=&quot;true&quot;/&gt; <br>
   &lt;property name=&quot;openjpa.QueryCache&quot; value=&quot;true&quot;/&gt;
<br>&lt;properties&gt; <br>{code} <br> <br>Insert details
about what those two properties give me. <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        


<h1><a name="BeginnersPerformanceGuide-OpenJPABeginnersPerformanceGuide"></a>OpenJPA
Beginners Performance Guide</h1>

<p>This guide is targeted at new users of OpenJPA that would like to know some of the
important performance tuning properties. Please do not mistake this for an exhaustive tuning
guide. This is just enough information to make a developer dangerous, not lethal.</p>

<h2><a name="BeginnersPerformanceGuide-Enhancement"></a>Enhancement </h2>

<p>OpenJPA uses byte-code weaving technologies to enhance user created Entity class
objects at build time or dynamically at run time. This allows us to efficiently handle these
objects. </p>

<p>Follow these instructions on how to properly enhance your Entities.<br/>
*<a href="/confluence/display/openjpa/Entity+Enhancement" title="Entity Enhancement">Entity
Enhancement</a>.</p>

<p>OpenJPA also has a feature that will auto-generate new subclasses or proxy objects
that front the user's Entity objects at run time, but <b>this feature is not recommended
for use</b>. There are numerous functional issues reported and it doesn't perform nearly
as well. If you ever see the following message you are using the non-recommended subclassing
approach to enhancement.</p>

<blockquote><p>3328  pu_name INFO   [main] openjpa.Enhance - Creating subclass
for "[ class org.apache.openjpa.entity.E1 , class org.apache.openjpa.entity.E2 ]". This means
that your application will be less efficient and will consume more memory than it would if
you ran the OpenJPA enhancer. Additionally, lazy loading will not be available for one-to-one
and many-to-one persistent attributes in types using field access; they will be loaded eagerly
instead.</p></blockquote>

<p>It is recommended to set the following property to ensure that you don't use this
enhancement approach.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;properties&gt;</span> 
    <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.RuntimeUnenhancedClasses"</span>
value=<span class="code-quote">"unsupported"</span>/&gt;</span>
<span class="code-tag">&lt;properties&gt;</span>
</pre>
</div></div>

<h2><a name="BeginnersPerformanceGuide-ConnectionPooling"></a>Connection
Pooling</h2>

<p>As of the 2.1.0 release OpenJPA bundles <a href="http://commons.apache.org/dbcp/"
class="external-link" rel="nofollow">Apache Commons DBCP</a> as part of the binary
download. When running in JSE environments a default connection pool will be plugged in with
the provided database configuration properties. Most JEE container environments should provide
some level of connection pooling. </p>

<p>In releases prior to 2.1.0 add DBCP to your classpath and use the following example
to figure out how to configure pooling.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;persistence xmlns=<span class="code-quote">"http://java.sun.com/xml/ns/persistence"</span>
<span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
version=<span class="code-quote">"1.0"</span>&gt;</span>
    <span class="code-tag">&lt;persistence-unit name=<span class="code-quote">"example-derby"</span>
transaction-type=<span class="code-quote">"RESOURCE_LOCAL"</span>&gt;</span>
        <span class="code-tag">&lt;properties&gt;</span>
            &lt;property name=<span class="code-quote">"openjpa.ConnectionProperties"</span>

                value="DriverClassName=org.apache.derby.jdbc.ClientDriver,
                  Url=jdbc:derby://localhost:1527/database, 
                  MaxActive=100, 
                  MaxWait=10000, 
                  TestOnBorrow=true, 
                  Username=user, 
                  Password=secret"/&gt;
            &lt;property name=<span class="code-quote">"openjpa.ConnectionDriverName"</span>

                value=<span class="code-quote">"org.apache.commons.dbcp.BasicDataSource"</span>/&gt;
        <span class="code-tag">&lt;/properties&gt;</span>
    <span class="code-tag">&lt;/persistence-unit&gt;</span>
<span class="code-tag">&lt;/persistence&gt;</span>

</pre>
</div></div>
<h2><a name="BeginnersPerformanceGuide-Caching"></a>Caching</h2>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;properties&gt;</span> 
    <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.DataCache"</span>
value=<span class="code-quote">"true"</span>/&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"openjpa.QueryCache"</span>
value=<span class="code-quote">"true"</span>/&gt;</span>
<span class="code-tag">&lt;properties&gt;</span>
</pre>
</div></div>

<p>Insert details about what those two properties give me.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/openjpa/Beginners+Performance+Guide">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23335307&revisedVersion=4&originalVersion=3">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/openjpa/Beginners+Performance+Guide?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message