Copied to clipboard

Flag this post as spam?

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


  • Ambert van Unen 54 posts 96 karma points
    Jan 27, 2017 @ 09:11
    Ambert van Unen
    0

    Extreme CPU usage findview

    Hi there,

    we're using Umbraco 7.4.3 for a website we created.

    Its a website where Rooms (for rent) are shown. The homepage consists of a NewestRoom, and ofcourse there is a overviewpage with paging.

    These pages are incredibly slow when visited and we see major CPU spikes on the server at the same time.

    At first we thought it was the TypedMediaAtRoot() function causing a major delay. We disabled that and the website ran smooth as butter (for a day)

    Only this morning the problems were back again, bigger even.

    Am I interpreting this screenshot right? The FindPartialView function is taking major load time? Or could it be a function inside of that partial?

    Screenshot debug

    We're currently quite out of options on this... Tips?

    Minor update, overviewpage finally loaded, showed a slightly different delay..

    Debug overviewpage

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jan 27, 2017 @ 11:10
    Dave Woestenborghs
    0

    Hi Ambert,

    Can you post the code in the view and controller if you are using that. To me it seems like a performance botlleneck in your code.

    Dave

  • Rasmus Eeg 91 posts 457 karma points c-trib
    Jan 27, 2017 @ 11:36
    Rasmus Eeg
    0

    Hi Ambert,

    I'm very interested in the code for the following partial RazorView.Render: ~/Views/Partials/Roo... which takes 8218.8 and is a sub partial of a parent partial.

    Perhaps you can post both?

  • Ambert van Unen 54 posts 96 karma points
    Jan 30, 2017 @ 12:37
    Ambert van Unen
    0

    The probably cause was the following piece of code:

    return _umbracoHelper.TypedMediaAtRoot().
                    First(x => x.DocumentTypeAlias == _mediaTypeAliasFolderRoot).Children.
                    FirstOrDefault(
                        x => x.DocumentTypeAlias == _mediaTypeAliasFolderRoomImages && x.Name.StartsWith(roomId + "_"))
    

    specifically the "TypedMediaAtRoot".

    This would return a specific imagedirectory matching the current room being iterated in the RoomOverviewPage.cshtml When editing the above code to return NULL, the entire site worked smooth as butter..

    RoomOverviewPage.cshtml

    @inherits UmbracoViewPage<Website123kamer.Umbraco.Models.Rooms.SearchRoomResponseModel>
    
    @{
        Layout = "OneColumnLayout.cshtml";
    }
    
    @section Main
    {
        <div class="main-section main-section-1 main-section-type-1-col">
            <div class="main-section-inner">
                <div class="main-section-col">
                    @Html.Partial("RoomOverview", Model)
                    @Html.Partial("BasePageContent", Model) 
                </div> 
            </div>
        </div>
    }
    

    RoomOverview.cshtml

    @inherits UmbracoViewPage<Website123kamer.Umbraco.Models.Rooms.SearchRoomResponseModel>
    
    <div class="rooms">
        <div class="rooms-filters">
            <div class="filters">
                <div class="filters-content">
                    @Html.Partial("~/Views/Partials/Rooms/Roomfilter.cshtml", Model.Cities, new ViewDataDictionary { { "Name", Model.Content.Name } })
                </div>
                <div class="filters-summary">
                    <div class="search-results">
                        @Model.TotalResultCount Kamers gevonden @(!string.IsNullOrEmpty(Model.City) ? " in " + Model.City : "")
                    </div>
                </div>
            </div>
        </div>
        <div class="rooms-overview">
            <div class="items room-overview">
                @if (Model.Rooms != null && Model.Rooms.Any())
                {
                    foreach (var room in Model.Rooms)
                    {
                       /* @Html.Partial("~/Views/Partials/Rooms/RoomView.cshtml", room) */
                    }
                }
            </div>
        </div>
    </div>
    
Please Sign in or register to post replies

Write your reply to:

Draft