abpframework / abp

Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.31k stars 3.32k forks source link

Can abp Blazor be this fast? #13114

Open sturlath opened 1 year ago

sturlath commented 1 year ago

Steves Sanderson Blazor WASM is.. well.. Blazor fast.. can abp.io get this fast please 695423!

Sorry but abo.io’s Blazor is super slow..

hikalkan commented 1 year ago

ABP.IO has not its own Blazor. We are using the same one. Just adding some more libraries, adding authorization and some other real business requirements. Blazor is getting slow when we add these.

ABP's Angular UI, for example, is super fast. Try https://commercial-demo.abp.io/ for example, which is a large application. ABP's Angular UI is using the same backend with the Blazor UI, which is also built with ABP.

I noted that. If I have time I will add ABP to this example to see how ABP is making it slower.

sturlath commented 1 year ago

Yes sorry for this "outburst" of mine 😅 and I know yours is not special version. To note I´m happy with everything abp.io but loading of my Blazor backend is terribly slow (by any standard) what ever I have tried.

So when you see something like this you wonder why mine is taking such a long time.

Then you see that he is using "It’s a combination of static pre-rendering and max trimming settings" and this BlazorWasmPreRendering nuget

I have looked at lists like this Blazor performance best practices and they don´t mention this package for instance.

But now that we can see that WASM can be Blazing fast so why not default file new from abp.io? Can something be done or is the framework just to heavy (doing much more than Steves version)?

hikalkan commented 1 year ago

OK, we will test and work on these. Thanks.

omer-repo commented 1 year ago

Actually, it is wonderful developing Blazor with ABP framework. It makes developing so easy to communicate UI with backend. I see only loading time problem even after caching assemblies.

Loading after caching

I tried to understand why Blazor is slow on loading. There are nearly 5-6 seconds gap between requests from backend. I am not sure it is related to backend side. So I imported source projects of ABP from github (v5.2.2 and v5.3.1) and checked loading times. I couldn't find what triggers openid-configuration so I investigated "application-configuration" request. Even it takes only 90ms to download it from backend it takes 2 seconds to complete initializing module "WebAssemblyCachedApplicationConfigurationClient"

Loading after caching image image image

I checked also InitializeAsync of "WebAssemblyCachedApplicationConfigurationClient", it takes 2 seconds var configurationDto = await ApplicationConfigurationAppService.GetAsync();

As I understand from browser and log files, fetching data from backend is so fast, but processing it in Blazor side is slow. It goes to AbpApplicationConfigurationClientProxy but I couldn't investigate more because I need to import other projects to understand what happens there.

I hope there is not a big issue while initializing modules of Blazor and it can be solved soon.

maliming commented 1 year ago

Thanks @omer-repo I will check it.

sturlath commented 1 year ago

Hi we have figured that most of our problems is related to Blazor compressed dll´s not served to the browser (they get created) so we are trying to add autostart="false" to <script src="_framework/blazor.webassembly.js" ></script> that I think you are adding in BundlingService.cs

Here is a quick video about it.

I created a support ticked for this issue. Shouldn´t the compression be default in the template?

maliming commented 1 year ago

Thanks @sturlath 👍

sturlath commented 1 year ago

We are having problems overriding/removing-and-re-adding the script tag.

Just asking here in case this is something that is not currently possible but could then be introduced into version 6.0? (I can´t go live with users downloading over 100 MB website can I?)

realLiangshiwei commented 1 year ago

I will check it

sturlath commented 1 year ago

@realLiangshiwei did you by any change have time checking this out?

Being able to override this would be great but next best would be to only have to wait for abp 6.0 and not 7.0 (thats the reason for my pestering sorry)

realLiangshiwei commented 1 year ago

@realLiangshiwei did you by any change have time checking this out?

Being able to override this would be great but next best would be to only have to wait for abp 6.0 and not 7.0 (thats the reason for my pestering sorry)

See: https://github.com/abpframework/abp/issues/13771

omer-repo commented 1 year ago

Thanks @omer-repo I will check it.

Hi @maliming , could you get a look the delay issue on loading

maliming commented 1 year ago

hi We will check this asap. Thanks

sturlath commented 1 year ago

@realLiangshiwei Im not sure this is fixed in 6.0 https://github.com/abpframework/abp/issues/13771

When we try to load up a Blazor WASM its still taking long time (and MB’s) to dowload. Are there any other steps to do?

An why isn’t this a default functionality in the file new project template? Who would ever want to serve 100 MB page?

sturlath commented 1 year ago

@realLiangshiwei any feedback on this? Did you manage to try this out yourself and get the download size down?

Are we really doomed to be stuck with 100 MB Blazor backends? Is anybody using it out there?

If I wasn´t so deep into my development I would move from abp.io's version of Blazor but I can´t so I can only ask you to figure this out for us poor souls that choose it to begin with!

So, all feedback appreciated on this one1

hikalkan commented 1 year ago

I removed this from 7.0-preview milestone. It doesn't mean we don't actively tracking it. However, this is not a concrete development that we will complete in a certain date range.

realLiangshiwei commented 1 year ago

Ahead-of-time (AOT) compilation: https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-7.0#ahead-of-time-aot-compilation

sturlath commented 1 year ago

How about this performance increase from Blazorise that abp.io is missing, @hikalkan? Something we can push into 7.0?

realLiangshiwei commented 1 year ago

Hi, @sturlath

See: https://github.com/abpframework/abp/issues/14734

sturlath commented 1 year ago

Thanks @realLiangshiwei yes, I spotted this and asked this question.

sturlath commented 1 year ago

I saw this comment I don´t know if this is something that can be used in abp.io but can hopefully close these loading gaps

You can essentially put all of these inside a link header with preload to speed things up.

sturlath commented 1 year ago

We are now serving our Blazor WASM with static websites and CDN í Azure and that combined with Brotli compression is making huge difference.

But I just wanted to add to @omer-repo about the "timeouts" in the loads.

We can see 5+3 sec in loading where nothing seems to be happening and was wondering what is going on there and if there is any work going on getting that down?

image

sturlath commented 1 year ago

Its not only us wondering about these things https://support.abp.io/QA/Questions/4210/Blazor-WASM-on-Azure-App---awful-loading-times

Can somebody tell us if this is being looked at? And if you have, the results? Is it fixable or will the abp wasm never be usable?

And then if you havent looked at it, why?

dongfo commented 4 months ago

anyone working on it?