[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HHH-6614) Bad performance: audited entity updates (lots of them) with no EntityManager clear

Adriano Saturno Muniz (JIRA) noreply at atlassian.com
Mon Aug 29 15:28:02 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43385#comment-43385 ] 

Adriano Saturno Muniz edited comment on HHH-6614 at 8/29/11 2:26 PM:
---------------------------------------------------------------------

Some corrections...

For 100,000 editions:
6h (without clear)
3min (with clear)

For 1,000,000 editions:
too slow to test (without clear)
30min (with clear)

      was (Author: drsaturno):
    Typing error, after changing the block it takes 3 minutes, not 30. Sorry.
  
> Bad performance: audited entity updates (lots of them) with no EntityManager clear
> ----------------------------------------------------------------------------------
>
>                 Key: HHH-6614
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6614
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.6.6
>         Environment: Hibernate 3.6.6, Oracle
>            Reporter: Adriano Saturno Muniz
>         Attachments: src.zip
>
>
> I was testing Envers performance.
>  
> I created an audited entity Mailmen, with a many-to-many relationship with another audited entyty, Address.
>  
> Mailmen has a simple field called register. (and an Address collection, but lets simplify the code)
>  
> I just created a new instance of Mailmen and edited it 100.000 times:
>  
> configurationOverrides = new HashMap<String, String>();
> emf = Persistence.createEntityManagerFactory("jpa", configurationOverrides);
> entityManager = emf.createEntityManager();
>  
> int MAX_EDITIONS = 1000000;
> carteiroDefault = new Mailman();
> carteiroDefault.setRegister(64737);
> entityManager.persist(carteiroDefault);
>   
> for(int i = 1; i <= MAX_EDITIONS; i++) { 
>           entityManager.getTransaction().begin();
>           carteiroDefault.setRegister(i);
>           entityManager.getTransaction().commit();
> }
>  
> It tooks about 6 hours to run this code.
>  
> It gets better or worse depending on MAX_EDITIONS, in a non linear way. Bad.
>  
> But, if I change the for block to this:
>  
>      entityManager.getTransaction().begin();
>      entityManager.find(Mailman.class, carteiroDefault.getId()).setRegister(i);
>      entityManager.getTransaction().commit();
>      entityManager.clear();
>  
> It tooks 30 minutes.
>  
> It gets better or worse depending on MAX_EDITIONS, in a linear way. Much better.
>  
> There's no bad performance without Envers in this scenario.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list