My company has a blazor server application running on .NET 6.0.Currently I am transitioning the application from a Windows Server 2019 running on IIS to an Azure Web App Service.
Everything runs fine. The app in the new environment is basically as performant as the old Windows Server environment, besides one very specific issue:
It takes way more time to load static assets from wwwroot directory than the Windows Server environment.
Just for a comparison, this is the Network tab on google Chrome showing load times for our Login page.
This is on Windows Server hosting:
Windows Server Login page load time
This is on Azure Web App hosting
as you can see, depending on the file, azure takes a good amount of time more than our windows server.
If we go more in depth, we see the all that extra time is spent waiting for the server to respond to the request (TTFB).
I've been all around the internet for some problem alike. I've also been bombarding azure copilot and other LLM tools to see if one of them give me a light of hope, but none seem to be able to help me in this endeavor, only giving me very generic trobleshooting responses.
I have tried to tinker with the configuration of the web app, and it is looking like this:
Stack Settings
Stack - .NET.NET Version - .NET 6 (LTS)
Platform Settings
Platform - 64 bits
FTP Basic Auth Publishin - On
FTP State - FTPS Only
Inbound IP mode - IPv4
HTTP Version - 2.0
HTTP 2.0 Proxy - Off
Web Sockets - On
Always On - On
Session Affinity - On
HTTPS Only - On
Minimum Inbound TLS Version - 1.2
Minimum Inbound TLS Cipher Suite - TLS_RSA_WITH_AES_128_CBC_SHA
End-to-end TLS encryption - On
Debugging
Remote Debugging - Off
Incoming client certificates
Client certificate mode - Ignore
I have tried to ping and traceroute over my application IP and there is no issues here, so I don't believe it has something to do with networking.
The web app and my computer are both in the same region so I don't think I need any CDN or Azure Front Door set up.
I do have application insights, and it shows it takes a long time, but all other metric seems fine and the information it gives me is very inconclusive.
Looking deeper into one of these requests, I can see that is basically the wait time for the resource:
this is the profilling of a GET request to this specific asset: /app-assets/css/bootstrap-extended.css
as you can see, for this particular request, there was a 15 seconds (!!!) wait time.
I don't have a lot of users on this environment. It's only me and another developer for now, so the resources are not used to their maximum.
We use a P1mv3 app service (2 vCores and 16GB of memory), so I don't think we need to scale up for this.
Is there something I am missing here? Why static resources would take so long to download?
I tried to take compression out and it didn't help. I added Local cache and it didn't help.
Does any one have any clue of what else could I try?