zzzprojects / EntityFramework-Plus

Entity Framework Plus extends your DbContext with must-haves features: Include Filter, Auditing, Caching, Query Future, Batch Delete, Batch Update, and more
https://entityframework-plus.net/
MIT License
2.25k stars 318 forks source link

Entity Framework Plus - Audit Extension - Consuming CPU Percentage High (above 50%) #445

Open manojkumaraut opened 5 years ago

manojkumaraut commented 5 years ago

Team, i am using Entity Framework Plus - Audit Extension for the audit trail feature but facing an issue - as its consuming 50% CPU Percentage High and makes the server slow..any other optimization solution to make them low...Thanks and appreciate your help

JonathanMagnan commented 5 years ago

Hello @manojkumaraut ,

Unfortunately, if you save a lot entities, it will create a lot of AuditEntryProperty as well. The high consuming CPU is probably caused by the SaveChanges method when saving all audit entry properties.

One way to fix it is to save all audit entries and properties using BulkInsert from Entity Framework Extensions. Our commercial library allow to save entities with high performance bulk operations. Is it a solution that might interest you?

Best Regards,

Jonathan