Open Closed

With Abp 8.1.0 InsertMany became very slow #7028


User avatar
0
roberto.fiocchi created
  • ABP Framework version: v8.1.0
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Steps to reproduce the issue:
  1. Create a solution with Abp 8.1.0.rc.4
  2. Add Entity “Book” with Id int, Code String 10 Required , Title String 100 Required
  3. Open BookManager.cs add the following code in CreateAsync (only for test)
#region test InsertMany
var myBooks = new List< Book >();
for (var i = 0; i < 12000; i++)
{
	myBooks.Add(new Book(i.ToString(),$"Title-{i}"));
}
    
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();

await _bookRepository.InsertManyAsync(myBooks, true);

stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Console.WriteLine(ts); 
#endregion
  1. Lunch in Debug
  2. Via Swagger Post a new Book
  3. Track the time from console log o via breakpoint. On my Pc is 00:00:05.7310325
  4. After that upgrade to Abp 8.1.0
  5. Lunch in Debug
  6. Via Swagger Post a new Book
  7. Track the time from console log o via breakpoint. On my Pc is 00:05:05.4026061

It takes 60 times longer !!!

We use InsertMany in import jobs and execution times have now gone from a few seconds to many minutes and those that used to take a few minutes now take hours.

We cannot upgrade to 8.1.0 stable because it would block the application in production.

From the release logs there is no evidence of changes in this area.

What has changed?


10 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you please share the test project with me? I will check it. thanks. shiwei.liang@volosoft.com

  • User Avatar
    0
    roberto.fiocchi created

    HI, sent you the email with the test projects

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Thanks, I will check asap

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can confirm this problem, we will fixed in the next patch version. your ticket was refunded.

    This is a temporary solution:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(AbpEfCoreNavigationHelper))]
    public class MyAbpEfCoreNavigationHelper : AbpEfCoreNavigationHelper
    {
        public override void ChangeTracker_Tracked(ChangeTracker changeTracker, object? sender, EntityTrackedEventArgs e)
        {
            
        }
    
        public override void ChangeTracker_StateChanged(ChangeTracker changeTracker, object? sender, EntityStateChangedEventArgs e)
        {
            
        }
    }
    
    Configure<AbpEntityChangeOptions>(options =>
    {
        options.PublishEntityUpdatedEventWhenNavigationChanges = false;
    });
    
  • User Avatar
    0
    roberto.fiocchi created

    Does this fix disable change tracking for all entities? We have AggregateRoot type entities such as Order with List of OrderItem, does this fix have any impact on this? I believe that if I implemented it, I would break other parts of our application.

    Can you explain the workaround better?

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We fixed this problem with https://github.com/abpframework/abp/pull/19538

    You can create an AbpEfCoreNavigationHelper based on the PR's code, then inject and use it in DbContext.

  • User Avatar
    0
    roberto.fiocchi created

    Will the fix be released in version 8.1-patch or versione 8.2-preview? Which is the estimated release date of the 8.1-patch?

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The next release will be 8.1.1.

    I think it will be released within 2 weeks.

    You can override it now.

    Thanks

  • User Avatar
    0
    roberto.fiocchi created

    Thank you, but it is not our practice to perform temporary workarounds when the fix is released soon.

    We are waiting for the fix.

    Best regards

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. 8.1.1 will be coming soon.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09