dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

Blazor performance issue #22613

Closed 0fca closed 4 years ago

0fca commented 4 years ago

Description

Just create a new project for SSR Blazor app, then deploy it on localhost and proxy it through Apache(the only WWW I have tried).

Configuration

I run it on: Host (useful for support): Version: 3.1.1 Commit: a1388f194c Architecture is: x64, i5 2nd gen CPU.

Regression?

I don't know if there is a regression really.

Data

Couldn't take any dumps or snaphsots, dumping tool for .NET Core doesnt work for now and I deploy it on headless Debian 10. The only data I can provide is the screenshots of timing from Firefox which tries to connect to "/" address of my domain via WAN(so it is not inside of LAN). screenshot There is some time Blocked and a lot of "Waiting" time. It happens any time I close a tab with that site and try to connect it again. The site Repo

Analysis

No idea.

mrpmorris commented 4 years ago

The site is loading in under a second for me on my mobile phone.

0fca commented 4 years ago

For me it sometimes does load it in 1s or so too. However, there has to be some reason why PageSpeed Insights detects for this one app Long Server Response time. https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Finfra.lukas-bownik.net%2F&tab=mobile

And for another site, SSR ASP.NET Core with Razor set up behind exactly the same WWW Proxy on the same server on localhost, it does not detect this issue.

https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fcore.lukas-bownik.net.

mrpmorris commented 4 years ago

That site says my site takes 9 seconds before interactive, but it's actually ready in less than a second.

0fca commented 4 years ago

Well. However, I consider this issue of mine, as a fault of not properly configured Apache. It has ws_tunnel proxy enabled, but I am not sure if I need to proxy some urls in VHost config with wss prefix for Blazor to work properly.

mkArtakMSFT commented 4 years ago

Thanks for contacting us. @BrennanConroy do you have any suggestions?

BrennanConroy commented 4 years ago

You need to use ProxyPass to proxy websockets http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

Although it seems like you have websockets disabled on the server or something because the negotiate response doesn't show websockets?

0fca commented 4 years ago

Well, it uses WebSockets. When I disabled them, the site didn't load at all. And adding those directives I tried, it didnt change anything :/

BrennanConroy commented 4 years ago

You aren't using WebSockets, see your code where you specifically don't enable WebSockets: https://github.com/Arkasian/pika-status/blob/4a7c3e413775daa395875b805ff81ebd1d0cba36/Startup.cs#L66

0fca commented 4 years ago

I meant, that it worked the same for WSS enabled. But when I left WSS enabled as the only Transport and disabled tunneling on Apache, it didnt even connect, and when I enabled mod again it connected. However the same thing is for LP and SSE - times for it to connect are not as good as for the second project I linked even it uses SSE and LP too(some features use LP or SSE, but they doesnt log such dealys in Network tool of Firefox or Chrome). So thus, I dont get what is going on.

BrennanConroy commented 4 years ago

Could you start over please. I don't understand your initial problem and how websockets is involved at all.

0fca commented 4 years ago

The initial problem is not related to WSS or LP or SSE, I just wanted to know if there is any explanation why Google PageSpeed Insights constantly returns such warning, I mean a warning about Server Long Time Response. There are no errors on client side or back-end, it just takes long sometimes for the page to load. And sometimes it connects in 1s.