Base solution for your next web application
Open Closed

High CPU Usage on AbpBinaryObjects Query #8609


User avatar
0
-bitman created

<span class="colour" style="color: rgb(49, 49, 49);">Hello AspNetZero Team,</span>

I have deployed my app to azure and I am seeing a high cpu usage on the query for AbpBinaryObjects.  I assume this is part of the ABP core framework.  I would like to ask what this is doing and how I can prevent it from consuming a lot of cpu in order to bring down my expense?

Please advise.

Thank you.

P.S.  Query Below

(@UpperBound <span class="colour" style="color: rgb(0, 0, 255);">uniqueidentifier</span>,@key_0 <span class="colour" style="color: rgb(0, 0, 255);">uniqueidentifier</span>)<span class="colour" style="color: rgb(0, 0, 255);">SELECT</span>   [Id], [TenantId], <span class="colour" style="color: rgb(0, 0, 255);">CASE</span> <span class="colour" style="color: rgb(0, 0, 255);">WHEN</span> <span class="colour" style="color: rgb(255, 0, 255);">DATALENGTH</span>([Bytes]) <span class="colour" style="color: rgb(119, 136, 153);">>=</span> <span class="colour" style="color: rgb(9, 136, 90);">4116480</span> <span class="colour" style="color: rgb(0, 0, 255);">THEN</span> <span class="colour" style="color: rgb(255, 0, 255);">DATALENGTH</span>(<span class="colour" style="color: rgb(9, 136, 90);">0x2142494E5F46494C45213A</span> <span class="colour" style="color: rgb(119, 136, 153);">+</span> <span class="colour" style="color: rgb(255, 0, 255);">CAST</span> (<span class="colour" style="color: rgb(255, 0, 255);">CAST</span> (<span class="colour" style="color: rgb(255, 0, 255);">newid</span>() <span class="colour" style="color: rgb(0, 0, 255);">AS</span> <span class="colour" style="color: rgb(0, 0, 255);">VARCHAR</span> (<span class="colour" style="color: rgb(9, 136, 90);">100</span>)) <span class="colour" style="color: rgb(0, 0, 255);">AS</span> <span class="colour" style="color: rgb(0, 0, 255);">VARBINARY</span> (<span class="colour" style="color: rgb(9, 136, 90);">100</span>))) <span class="colour" style="color: rgb(0, 0, 255);">ELSE</span> <span class="colour" style="color: rgb(255, 0, 255);">DATALENGTH</span>([Bytes]) <span class="colour" style="color: rgb(0, 0, 255);">END</span>, <span class="colour" style="color: rgb(0, 0, 255);">CASE</span> <span class="colour" style="color: rgb(0, 0, 255);">WHEN</span> <span class="colour" style="color: rgb(255, 0, 255);">DATALENGTH</span>([Bytes]) <span class="colour" style="color: rgb(119, 136, 153);">>=</span> <span class="colour" style="color: rgb(9, 136, 90);">4116480</span> <span class="colour" style="color: rgb(0, 0, 255);">THEN</span> <span class="colour" style="color: rgb(9, 136, 90);">0x2142494E5F46494C45213A</span> <span class="colour" style="color: rgb(119, 136, 153);">+</span> <span class="colour" style="color: rgb(255, 0, 255);">CAST</span> (<span class="colour" style="color: rgb(255, 0, 255);">CAST</span> (<span class="colour" style="color: rgb(255, 0, 255);">newid</span>() <span class="colour" style="color: rgb(0, 0, 255);">AS</span> <span class="colour" style="color: rgb(0, 0, 255);">VARCHAR</span> (<span class="colour" style="color: rgb(9, 136, 90);">100</span>)) <span class="colour" style="color: rgb(0, 0, 255);">AS</span> <span class="colour" style="color: rgb(0, 0, 255);">VARBINARY</span> (<span class="colour" style="color: rgb(9, 136, 90);">100</span>)) <span class="colour" style="color: rgb(0, 0, 255);">ELSE</span> [Bytes] <span class="colour" style="color: rgb(0, 0, 255);">END</span> <span class="colour" style="color: rgb(0, 0, 255);">FROM</span>     [dbo].[AppBinaryObjects] <span class="colour" style="color: rgb(0, 0, 255);">WHERE</span>    [Id] <span class="colour" style="color: rgb(119, 136, 153);"><</span> @UpperBound <span class="colour" style="color: rgb(119, 136, 153);">AND</span> [Id] <span class="colour" style="color: rgb(119, 136, 153);">></span> @key_0


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team
    • What is your product version?
    • What is your product type (Angular or MVC)?
    • What is product framework type (.net framework or .net core)?

    You can try to read the object using synchronous api.

  • User Avatar
    0
    -bitman created

    Thank you for your response Maliming. I am using Angular+.NET Core 7.2. Is the difference in code on the right side in v8.2?

  • User Avatar
    0
    maliming created
    Support Team

    This may be related to the performance issue of SqlClient. https://github.com/dotnet/SqlClient/issues/245

  • User Avatar
    0
    -bitman created

    Thank you Maliming. Will check it out.