docs icon indicating copy to clipboard operation
docs copied to clipboard

the background task degrade performance of file operations

Open future81 opened this issue 8 years ago • 4 comments

I'm trying to make performance critical Asp.net core 2.0 page - and I needed Background logic To prepare some files and memory before user requests - but actually when A user request is being processed and if the background task had been running simultaneously I find that file saving operations takes long time- I checked this by logging times of background and my MVC Action . I don't know why its the case but even if background task is doing nothing just trying to start at (ExecuteAync) at same time result in big slowdown on Request processing that involves writing files - so i need an option to pause background task entirely so no actual calling to it would happen and then resume it after request processing is done


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

future81 avatar May 24 '18 13:05 future81

@CESARDELATORRE Can you comment on the concern above?

BillWagner avatar Jun 27 '18 01:06 BillWagner

Interesting.. I'll point the ASP.NET team to look at it. However, and as we're doing in eShopOnContainers, I'd recommend to implement the IHostedServices in a different project than the ASP.NET Core Web App, if the process you need to do can be targeted remotely. Doing that way not only you wouldn't have that problem, but also you can scale out the web app differently than the background tasks. An now, in .NET Core 2.1 you can even use a IHost (with no ASP.NET Web stack overhead) instead of an IWebHost, as explained in the same link: https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/multi-container-microservice-net-applications/background-tasks-with-ihostedservice

CESARDELATORRE avatar Jun 27 '18 19:06 CESARDELATORRE

About your concrete issue, I talked to the ASP.NET team and we’re not aware of similar issues. We’d need far more details, for example are you hitting disk contention? Is the increase in time when it is starting the HostedService because no requests will be served until after the hosted service returns from start? etc. You’d need to log a bug on hosting with many details at the .NET CORE repo if you think you found a possible bug. Ok?

CESARDELATORRE avatar Jun 27 '18 20:06 CESARDELATORRE

Closing as it appears resolved. If this is not the case, then please reopen. Thanks!

JRAlexander avatar Jul 23 '18 20:07 JRAlexander