2 Replies Latest reply on Jan 14, 2013 2:38 PM by Adam Warski

    major performance hit

    john.horner Newbie

      I'm in the process of evaluating Envers for our project.  I'm very impressed with the functionality, but my experiments are showing a significant performance degradation.  I'm trying to find out if this is because I'm doing something wrong, or if there is something I can do to improve the situation.

       

      I ran a series of tests that performed a sequence of inserts and update.  I'm using small runs (1K to 10K transactions).  Our object model is moderately complicated, but is not beastly.  The total number of entites is small (~40). I am not  doing any audit queries at all.  I'm just comparing DB ops with and without auditing turned on. I have not added any indexes to any of the Envers tables.  My DB is Postgres.  My hibernate config includes the following:

       




      <property name="org.hibernate.envers.audit_strategy" value=" org.hibernate.envers.strategy.ValidityAuditStrategy" />



      <property name="org.hibernate.envers.global_with_modified_flag" value="true" />



      <property name="org.hibernate.envers.track_entities_changed_in_revision" value="true" />

       

       

      I'm seeing about a 75% degradation in performance when I turn on auditing.  Based on what I read in the doc this really surprised me.  Is this typical? Any particular guidance on indexes for audit tables?  What other factors should I look at to figure out why this is so bad?

       

      Thanks,
      John

        • 1. Re: major performance hit
          john.horner Newbie

          Not sure why my config didn't display - here it is

           

          <property name="org.hibernate.envers.audit_strategy" value=" org.hibernate.envers.strategy.ValidityAuditStrategy" />

          <property name="org.hibernate.envers.global_with_modified_flag" value="true" />

          <property name="org.hibernate.envers.track_entities_changed_in_revision" value="true" />

          • 2. Re: major performance hit
            Adam Warski Master

            Did you try without track_entities_changed_in_revision or without global_with_modified_flag?

            How big are your transactions? Is it a single-operation-per-transaction?

             

            Generally for each modified entity in a transaction, there's an insert; when using ValidityAuditStrategy, there's an insert and an update; and for each transcation there's one insert to the RevisionEntity.

             

            Adam