Hibernate envers architectural questions


#1

We want to change our audit log system, I made a proposal to use Hibernate envers. The thing is that our current audit log is really complex and migrating to envers might be a difficult task.
The CTO and other developers asked me some really interesting questions that I don’t know if I can asnwer myself.

  • How stable is Envers? Is the user base large enough to assume it’s mature/stable?

We have some entities that have more than 300 properties and we want to use modified flags, so:

  • Can we guarantee performance and the overall system load?

  • If the DB storage is to be changed, what problems this can brings?

I’m really looking forward to implement a new audit log based on envers.
Thank you.


#2

How stable is Envers? Is the user base large enough to assume it’s mature/stable?

It’s stable and the user base is significant.

Can we guarantee performance and the overall system load?

For better performance, you should use the ValidityAuditStrategy as explained in this article.

If the DB storage is to be changed, what problems this can brings?

That’s a vague question. If you are talking about renaming columns, I’m not sure if Envers supports that. I think @Naros might provide you a more detailed answer to your question.


#3

As Vlad mentioned, using the ValidityAuditStrategy is extremely useful when performance matters. The primary reason this strategy is better than the DefaultAuditStrategy is because it maintains several additional columns in the audit tables that enable you to take advantage of database table partitioning based on the values in those columns.

Installations that rely on performance make use of this strategy specifically so that recent / pertinent audit data is stored on faster disk partitions while older / less pertinent data is stored on slower disk partitions. This provides two benefits where the actual auditing of the user transaction is faster being on the better partition and audit queries to fetch historical data are faster for recent / pertinent data rather than older / less pertinent.

I agree with Vlad here, this question is extremely vague and thus hard to really answer without more concrete detail on what you’re describing or asking. Rather than speculate on what you’re asking, could you give me a bit more information so I can properly answer your concerns?


#4

Thanks for the answers. Regarding to my third question, if we want to migrate our audit log to envers, What do you think will be the best way to do it? What problems this might bring?

Regards


#5

That’s impossible to tell because we have no idea what you are migrating from.


#6

Ok, thanks Vlad, sorry if my questions were bad, I am just a recent graduate engineer trying to come with a good audit log solution for the company.


#7

You’re welcome. Just create a new branch in your project and give Envers a try there. You’ll see how much difficult it is to do the migration.

Another alternative is to use the Debezium project and capture CDC events and store them in Kafka so you can consume them asynchronously by multiple applications.