question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

List View performance degradation

See original GitHub issue

If we rapidly add lots of content under the same node the list view starts to slow down to the point where some pages will not load and an SQL timeout error will be thrown.

Umbraco version 8

I am seeing this issue on Umbraco version: 8.2.1 and 8.3.0 (didn’t test any other version). Both Cloud and On Premise have this issue.

Reproduction

Bug summary

List View slows down once we start to push lots of data under the same node. I’ talking about 500+ items (which is technically not a lot of data). Each page starts to load a bit slower.

  • 1st page - 180ms
  • 5th page - 245ms
  • 10th page - 321ms
  • 30th page - 1200ms

It looks like a linear progression.

Sometimes the issue resolves itself and load times start becoming the same for each of the page - 300ms. If I load more data it will start “lagging” again.

I’ve used an SQL Profiler and it seems that the query which actually retrieves data slows down depending on which page we retrieve. If I try to run the query separately it works fast (doesn’t go into seconds - only milliseconds). It feels like there is something parallel going on when we request a page of the list to load which slows down this specific query.

This is an example of the query:

exec sp_executesql N'SELECT [umbracoDocument].[nodeId] AS [NodeId], [umbracoDocument].[published] AS [Published], [umbracoDocument].[edited] AS [Edited] , [umbracoContent].[nodeId] AS [ContentDto__NodeId], 
[umbracoContent].[contentTypeId] AS [ContentDto__ContentTypeId] , [umbracoNode].[id] AS [ContentDto__NodeDto__NodeId], [umbracoNode].[uniqueId] AS [ContentDto__NodeDto__UniqueId], [umbracoNode].[parentId] AS 
[ContentDto__NodeDto__ParentId], [umbracoNode].[level] AS [ContentDto__NodeDto__Level], [umbracoNode].[path] AS [ContentDto__NodeDto__Path], [umbracoNode].[sortOrder] AS [ContentDto__NodeDto__SortOrder], 
[umbracoNode].[trashed] AS [ContentDto__NodeDto__Trashed], [umbracoNode].[nodeUser] AS [ContentDto__NodeDto__UserId], [umbracoNode].[text] AS [ContentDto__NodeDto__Text], [umbracoNode].[nodeObjectType] AS 
[ContentDto__NodeDto__NodeObjectType], [umbracoNode].[createDate] AS [ContentDto__NodeDto__CreateDate] , [umbracoDocumentVersion].[id] AS [DocumentVersionDto__Id], [umbracoDocumentVersion].[templateId] AS 
[DocumentVersionDto__TemplateId], [umbracoDocumentVersion].[published] AS [DocumentVersionDto__Published] , [umbracoContentVersion].[id] AS [DocumentVersionDto__ContentVersionDto__Id], 
[umbracoContentVersion].[nodeId] AS [DocumentVersionDto__ContentVersionDto__NodeId], [umbracoContentVersion].[versionDate] AS [DocumentVersionDto__ContentVersionDto__VersionDate], [umbracoContentVersion].[userId] 
AS [DocumentVersionDto__ContentVersionDto__UserId], [umbracoContentVersion].[current] AS [DocumentVersionDto__ContentVersionDto__Current], [umbracoContentVersion].[text] AS [DocumentVersionDto__ContentVersionDto__Text] , [pdv].[id] AS [PublishedVersionDto__Id], [pdv].[templateId] AS [PublishedVersionDto__TemplateId], [pdv].[published] AS [PublishedVersionDto__Published] , [pcv].[id] AS [PublishedVersionDto__ContentVersionDto__Id], [pcv].[nodeId] AS [PublishedVersionDto__ContentVersionDto__NodeId], [pcv].[versionDate] AS [PublishedVersionDto__ContentVersionDto__VersionDate], [pcv].[userId] AS [PublishedVersionDto__ContentVersionDto__UserId], [pcv].[current] AS [PublishedVersionDto__ContentVersionDto__Current], [pcv].[text] AS [PublishedVersionDto__ContentVersionDto__Text] , COALESCE([ccv].[name],[umbracoNode].[text]) AS variantName FROM [umbracoDocument] INNER JOIN [umbracoContent] ON [umbracoDocument].[nodeId] = [umbracoContent].[nodeId] INNER JOIN [umbracoNode] ON [umbracoContent].[nodeId] = [umbracoNode].[id] INNER JOIN [umbracoContentVersion] ON ([umbracoDocument].[nodeId] = [umbracoContentVersion].[nodeId]) INNER JOIN [umbracoDocumentVersion] ON ([umbracoContentVersion].[id] = [umbracoDocumentVersion].[id]) LEFT JOIN [umbracoContentVersion] [pcv] INNER JOIN [umbracoDocumentVersion] [pdv] ON (([pcv].[id] = [pdv].[id]) AND [pdv].[published] = @0) ON ([umbracoDocument].[nodeId] = [pcv].[nodeId]) LEFT JOIN [umbracoContentVersionCultureVariation] [ccv] INNER JOIN [umbracoLanguage] [lang] ON (([ccv].[languageId] = [lang].[id]) AND ([lang].[languageISOCode] = @1)) ON ([umbracoContentVersion].[id] = [ccv].[versionId]) WHERE (([umbracoNode].[nodeObjectType] = @2)) AND ([umbracoContentVersion].[current] = @3) AND (([umbracoNode].[parentId] = @4)) ORDER BY [DocumentVersionDto__ContentVersionDto__VersionDate] DESC , [ContentDto__NodeDto__NodeId]
OFFSET @5 ROWS FETCH NEXT @6 ROWS ONLY',N'@0 int,@1 nvarchar(4000),@2 uniqueidentifier,@3 int,@4 int,@5 bigint,@6 bigint',@0=1,@1=N'en-US',@2='C66BA18E-EAF3-4CFF-8A22-41B16D66A972',@3=1,@4=1053,@5=11400,@6=100

I’ve also tried rebuilding some indexes (the most fragmented ones). That seemed to have helped improve performance however the underlying issue of page retrieval speed still persisted.

Steps to reproduce

Create 2 document types (parent and child) and enable the list view on the parent. Use any way of inserting lots of data into the list

  • for loop in the API using IContentService
  • run a JS loop in browser and use umbraco/backoffice/UmbracoApi/Content/PostSave Add at least 500 items (preferably 2000 items). Try navigating the list while opening the network tab and recording times to finish GetChildren calls. Go to first page, middle page, last page.

JS code to insert many items into the list (needs to be updated with correct values and can be run from any backoffice page):

function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

for (var i = 0; i < 500; i++)
{
	var uuid = uuidv4();
	var data = new FormData();
	data.append('contentItem', `{"id":0,"contentTypeAlias":"item","parentId":1136,"action":"publishNew","variants":[{"name":"${uuid}","properties":[{"id":0,"alias":"text","value":"${uuid}"}],"culture":null,"publish":true,"save":true,"releaseDate":null,"expireDate":null}],"expireDate":null,"releaseDate":null,"templateAlias":null}`);
	
	var result = await fetch('https://mvc-asa-solutionlab-net.s1.umbraco.io/umbraco/backoffice/UmbracoApi/Content/PostSave', { method: 'post', body: data } );
	console.log(`Adding '${i}' item. Status: '${result.status}'`);
}

Expected result

Each page have a similar load time as the SQL Query should differ only by offset.

Actual result

The first page loads fast. Middle page loads a lot slower (depends on the number of pages) Last page load really slow or doesn’t load at all (throws SQL Timeout exception)


This item has been added to our backlog AB#4023

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
asmailovcommented, Dec 12, 2019

This will most likely be an index we’ll be adding. You can do this now to see how this affects your list view performance and please let me know if this resolves the issue for you

CREATE NONCLUSTERED INDEX [IX_umbracoContentVersion_NodeId] ON [dbo].[umbracoContentVersion]
(
	[nodeId] ASC,
	[current] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

There’s some other optimizations were doing too but this hopefully should be the main culprit

Thanks! The index exponentially speeds up the load times! 👍

1reaction
Shazwazzacommented, Dec 11, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve List View Performance
To make sure that performance doesn't degrade over time, develop a strategy and governance process on how to manage your Salesforce org's list...
Read more >
Improve List View Speed and Performance
Learn tips and best practices to improve performance for your List Views. List View Performance Here are our top 5 best practices: 1....
Read more >
List view performance issue possible root causes
The issue is that certain list views load in seconds for most of the users, but for some other users those views load...
Read more >
list view performance issue with some fields editable in the ...
Hi Bhushan,. Making a list view editable will indeed slow down performance quite a bit. A solution might be to move the editable...
Read more >
ListView Performance - Xamarin
Limit the use of the Cell. ForceUpdateSize method. If overused, it will degrade performance.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found