Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

AbpServiceProxies GetAll very large and very slow on all page loads #11862


User avatar
0
Astech created

We have the following file loading on every page load. It is incredibly large and causing long delays. Can anyone shine a light on why this is needed, why it is so large and what we can do to rectify the situation please? Thank you. (Image alt text: /AbpServiceProxies/GetAll - 59MB)


7 Answer(s)
  • User Avatar
    0
    Astech created

    It seems that alot of the js and css files we have are not being cached at all and have no-cache, no-store on them:

    How do we resolve this please?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    You can create a copy of https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Mvc/Proxying/AbpServiceProxiesController.cs with a different name and use it in your app.

    By the way, 59MB seems very high, could you try minifying it first via query parameters ?

  • User Avatar
    0
    Astech created

    Hi ismcagdas, thanks for your reply.

    It is 55mb when minified which is still crazy to be loading on every page load.

    I can create a custom controller but how will this help with caching/load times?

    Thanks Scott

  • User Avatar
    0
    Astech created

    We have resolved the issue by generating the file only once on application start. Saving it in the wwwroot and referencing that instead. This is allowing the file to be cached:

        public void GenerateScripts()
        {
            var output = GetAll(new ApiProxyGenerationModel() { Minify = true, Type = "jquery" });
            string fullFileLocation = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Common\Scripts", "AbpServiceProxies.min.js");
            using (FileStream fs = new System.IO.FileStream(fullFileLocation, FileMode.Create))
            {
                StreamWriter writer = new StreamWriter(fs);
                writer.Write(_javaScriptMinifier.Minify(output.Content));
                writer.Close();
            }
    

    Thank you to **apchenjun **for his solution on this thread: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/5379

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Thank you for sharing the solution here as well.

  • User Avatar
    0
    Astech created

    Is there anything else we can do about the size of this file? It just seems to be a list of all our app services. The solution I have provided above allows it to be cached, however, it is still a very large file to be loading on initial load.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @Astech

    Currently, there is no optimization point but if you can create an issue on https://github.com/aspnetzero/aspnet-zero-core, we can try to enhance this feature.