Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nalysa 48 posts 269 karma points
    Jun 17, 2021 @ 09:41
    Nalysa
    0

    High CPU Usage on NPoco library

    Hi Umbraco,

    We are currently investigating what is going on with our Umbraco 8 application because of the high CPU usage. We tried to do the debugging using Diagnostic tools provided by Microsoft Visual Studio 2019.

    Apparently, we found high CPU usage in the code to get data from Database. One of the examples :

    using (var scope = _scopeProvider.CreateScope())
                {
                    memberCVs = scope.Database.Query<MemberCV>()
                        .Include(x => x.CVTemplate)
                        .IncludeMany(x => x.SharedCVs)
                        .Where(i =>
                            i.MemberId == memberId &&
                            i.EditStatusId != CVEditStatus.TRASH
                        )
                        .ToList();
                    scope.Complete();
                }
    

    And this is the result from Diagnostic tools :

    High cpu usage For your information, we never modified the original Umbraco tables. We did add several tables to the Umbraco database, and did the model mapping like so :

    Model mapping

    Is there anything we did wrong that caused this issue ? Thank you.

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Jun 17, 2021 @ 11:39
    Dan Diplo
    1

    What's the raw SQL query that this is producing?

    One thing I can see that might be suspect is that you have a binary field CVThumbnail being returned in your query - this can be expensive. Only return the fields you actually need.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jun 17, 2021 @ 17:34
    Huw Reddick
    0

    Also try running the raw query in SQL, if it is slow maybe you need some indexes

Please Sign in or register to post replies

Write your reply to:

Draft