You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Milosz Tylenda (JIRA)" <ji...@apache.org> on 2009/07/01 19:59:47 UTC

[jira] Created: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Test suite speed-up outside SingleEMFTestCase
---------------------------------------------

                 Key: OPENJPA-1153
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
             Project: OpenJPA
          Issue Type: Test
    Affects Versions: 1.2.1, 1.1.0
            Reporter: Milosz Tylenda
            Assignee: Milosz Tylenda
            Priority: Minor


>From the developer list [1]:

We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.

The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:

- Derby: 20 secs
- MySQL: 12 secs
- PostgreSQL: 46 secs

Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.

My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 

[1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Xiaoqin Feng (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794871#action_12794871 ] 

Xiaoqin Feng commented on OPENJPA-1153:
---------------------------------------

I am on vacation from 12/20/2009  to 12/26/2009.

If you have any question on deployment and JEE bugs, please contact Saurabh Arora or my manager Maruthi Nuthikattu.

For emergency, contact me at 925-209-5517.


> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>             Fix For: 1.3.0, 2.0.0-M4
>
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755000#action_12755000 ] 

Donald Woods commented on OPENJPA-1153:
---------------------------------------

Changes look OK so far, as there were no regressions found with the nightly automated builds/junits on Derby, DB2, MSSQL, MySql or Oracle.


> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755013#action_12755013 ] 

Pinaki Poddar commented on OPENJPA-1153:
----------------------------------------

Thanks Milosz for raising this issue. The current usage of SingleEMFTestCase is a misnomer -- we essentially create a new EMF on every test method of every test. In Criteria tests we had used a different scheme where a single EMF instance is used for all test cases that are using the same set of domain entities. The performance speed up with this strategy is remarkable. 
Further improvement is possible with a smarter scheme that can determine whether to reuse or create EMF based on the domain entities used by a test. Currently without that automatic decision, we just partitioned the Criteria tests into 3-4 buckets -- where all the tests in a bucket tests work with the same set of domain entities. 

> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764450#action_12764450 ] 

Milosz Tylenda commented on OPENJPA-1153:
-----------------------------------------

With the changes so far, I can see a ca. 4-minute speed-up when running the test suite in my environment.


> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milosz Tylenda resolved OPENJPA-1153.
-------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.0.0)
                   2.0.0-M4

> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>             Fix For: 1.3.0, 2.0.0-M4
>
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1153:
----------------------------------

    Fix Version/s: 2.0.0

setting Fix version, as code has been checked into trunk.

> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milosz Tylenda updated OPENJPA-1153:
------------------------------------

    Fix Version/s: 1.3.0

> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>             Fix For: 1.3.0, 2.0.0
>
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1153) Test suite speed-up outside SingleEMFTestCase

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754678#action_12754678 ] 

Milosz Tylenda commented on OPENJPA-1153:
-----------------------------------------

I have added setUp(Object... props) to AbstractTestCase one can use to specify entities used by the test. I have made 6 tests inheriting from BaseKernelTest use this new method, will update more if don't hear about problems.

I have also removed some unused casts from the tests.


> Test suite speed-up outside SingleEMFTestCase
> ---------------------------------------------
>
>                 Key: OPENJPA-1153
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1153
>             Project: OpenJPA
>          Issue Type: Test
>    Affects Versions: 1.1.0, 1.2.1
>            Reporter: Milosz Tylenda
>            Assignee: Milosz Tylenda
>            Priority: Minor
>
> From the developer list [1]:
> We have groups of tests which do not inherit from SingleEMFTestCase and use common persistence.xml files to do their setUp()s. Each persistence.xml contains all entities used by the group. An individual test uses its group's persistence.xml to set itself up although the test usually uses one or two entities. Not surprisingly getting database metadata and issuing DELETE TABLE statements often takes much more time than the actual test itself.
> The most notable example is a group of tests located in openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/. Their openjpa-persistence-jdbc/src/test/resources/org/apache/openjpa/persistence/kernel/common/apps/META-INF/persistence.xml contains almost 100 entities. I measured how long does it take to run TestDateQueries which uses only one entity but sets itself up with that persistence xml. I ran the test suite with -Dtest=TestDateQueries and the necessary tables were already in the database:
> - Derby: 20 secs
> - MySQL: 12 secs
> - PostgreSQL: 46 secs
> Then I modified the persistence.xml to include only the entity used by the test. The timings for all databases dropped to around 4 seconds.
> My idea is to modify these tests (at least the ones taking the most time) and their superclass(-es) to not use persistence.xml but specify used entities as setUp() parameters, similarly to what SingleEMFTestCase. It looks like we would save at least a few minutes on a test suite run. 
> [1] http://n2.nabble.com/Test-suite-speed-up-outside-SingleEMFTestCase-td3169383.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.