Question

I have existing site on dev server win2k8 32bit sqlserver 2012 express iis7.5 running umbraco 6.1.6 all works fine. I have ported the site to live server this is win2k12 iis8 sql server 2012. The port involved ftping up files and taking a db backup from dev and restoring on live. The issue is on live when going to media section i get no media. After checking log files and running sql profiler i have identified the query that is causing the issue. The same query on dev runs fine but on live takes 11mins.

The query looks like

SELECT umbracoNode.id, umbracoNode.trashed, umbracoNode.parentID, 
        umbracoNode.nodeUser, umbracoNode.level, umbracoNode.path, umbracoNode.sortOrder, 
        umbracoNode.uniqueID, umbracoNode.text, umbracoNode.nodeObjectType, 
        umbracoNode.createDate, 
        COUNT(parent.parentID) as children, published.versionId as publishedVerison, 
        latest.versionId as newestVersion, contenttype.alias, 
        contenttype.icon, contenttype.thumbnail, 
        property.dataNvarchar as umbracoFile, 
        property.controlId
        FROM umbracoNode umbracoNode
        LEFT JOIN umbracoNode parent ON parent.parentID = umbracoNode.id
        INNER JOIN cmsContent content ON content.nodeId = umbracoNode.id
        LEFT JOIN cmsContentType contenttype ON contenttype.nodeId = content.contentType
        LEFT JOIN (SELECT nodeId, versionId FROM cmsDocument WHERE published = 1 GROUP BY nodeId, versionId) as published
        ON umbracoNode.id = published.nodeId
        LEFT JOIN (SELECT nodeId, versionId FROM cmsDocument WHERE newest = 1 GROUP BY nodeId, versionId) as latest ON umbracoNode.id = latest.nodeId
        LEFT JOIN (SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData INNER JOIN umbracoNode ON cmsPropertyData.contentNodeId = umbracoNode.id 
        INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid 
        INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId 
        WHERE umbracoNode.nodeObjectType = 'B796F64C-1F99-4FFB-B886-4BF4BC011A9C'
        AND [umbracoNode].[parentID] = -1) as property
        ON umbracoNode.id = property.contentNodeId
        WHERE (umbracoNode.nodeObjectType = 'b796f64c-1f99-4ffb-b886-4bf4bc011a9c')
        AND ([umbracoNode].[parentID] = -1)
        GROUP BY umbracoNode.id, umbracoNode.trashed, umbracoNode.parentID, umbracoNode.nodeUser, umbracoNode.level, umbracoNode.path, umbracoNode.sortOrder, umbracoNode.uniqueID, umbracoNode.text, 
        umbracoNode.nodeObjectType, umbracoNode.createDate, published.versionId, latest.versionId, contenttype.alias, contenttype.icon, contenttype.thumbnail, property.dataNvarchar, property.controlId
        ORDER BY umbracoNode.sortOrder

Its same database indexes are present so i cannot see what is going on. Has anyone seen this before? Is it sql server 2012 issue on 64bit w2k12?

Regards

Ismail

Was it helpful?

Solution

Right solved this issue. In my site i updated iis app pool to enable 32 bit and its has not only brought down my memoery usage from 99% to 70% it has fixed the media load problem.

Ismail

OTHER TIPS

I would initially treat this as a database problem rather than an Umbraco problem. It sounds like the Sql Server optimizer could be out line with the structure of data on your live server. So I would run a SQL Profiler while you try to load the media section (http://msdn.microsoft.com/en-us/library/ff650699.aspx) and then look at what is taking too long. For example, if the optimizer has its table structures wrong it will think that some tables are very small and so will do a full table scan on them to bring them into memory - but if they happen to be very big then this table scan will cause a huge lag on a query that works well on a different server. Fixing this can be as simple and non-destructive as dropping & recreating all table indexes.

If your application has a performance problem that you think might be caused by a particularly long-running query, you can use the SQLProfilerTSQL_Duration template to analyze query durations. You can either analyze the queries interactively, or you can save information to an output file and analyze the data offline.

The alternative is that I've seen node structures refuse to render in the back-office when I've extended the back-office but have used classes that didn't serialize properly; as Umbraco tries to serialize stuff back into XML if you have extended the media back-office in a non-serializable way (its not easy!) then that could have caused the page to fail to render. Not sure why this would be different from your other environment though.

I had same issue with not displaying media items before and it was related to my dirty database. If I would clean the recycle bin and if you could not do it on Umbraco UI you need to delete them using following query:

DECLARE @nodeId int

SET @nodeId = 0

SELECT id INTO #nodes FROM umbracoNode WHERE (path like '%-21%' AND id != -21 AND @nodeId = 0) OR (id = @nodeId)

SELECT COUNT(*) FROM #nodes

-- Pulled from Umbraco.Core.Persistence.Repositories.GetDeleteClauses()
DELETE FROM umbracoUser2NodeNotify WHERE nodeId IN (SELECT id FROM #nodes)
DELETE FROM umbracoUser2NodePermission WHERE nodeId IN (SELECT id FROM #nodes)
DELETE FROM umbracoRelation WHERE parentId IN (SELECT id FROM #nodes)
DELETE FROM umbracoRelation WHERE childId IN (SELECT id FROM #nodes)
DELETE FROM cmsTagRelationship WHERE nodeId IN (SELECT id FROM #nodes)
DELETE FROM umbracoDomains WHERE domainRootStructureID IN (SELECT id FROM #nodes)
DELETE FROM cmsDocument WHERE NodeId IN (SELECT id FROM #nodes)
DELETE FROM cmsPropertyData WHERE contentNodeId IN (SELECT id FROM #nodes)
DELETE FROM cmsPreviewXml WHERE nodeId IN (SELECT id FROM #nodes)
DELETE FROM cmsContentVersion WHERE ContentId IN (SELECT id FROM #nodes)
DELETE FROM cmsContentXml WHERE nodeID IN (SELECT id FROM #nodes)
DELETE FROM cmsContent WHERE NodeId IN (SELECT id FROM #nodes)
--ALTER TABLE umbracoNode NOCHECK CONSTRAINT FK_umbracoNode_umbracoNode_id --Hopefully not needed
DELETE FROM umbracoNode WHERE id IN (SELECT id FROM #nodes)
--ALTER TABLE umbracoNode CHECK CONSTRAINT FK_umbracoNode_umbracoNode_id
DROP TABLE #nodes
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top