So I had to open a case yesterday (Case #376623) because many of the views I have written are timing out. Through the process of elimination I was able to determine that it was the Last 50 Events component as the issue. As soon as I remove that from the views the pages load with very little delay.
I had my DBA take a look at the health of our DB with a tool they use and they found one query was causing considerable blocking on the database. The query in question is calling the events table (query included below for reference). He also was able to pull a report showing the wait time this particular query is causing on my system and the results were disturbing. The query shows wait times of close to 15 hours (per day). I'm no SQL expert so I'm not sure why a query that should simply be pulling a TOP 50 could be killing our performance.
I have submitted diagnostics to support and waiting for information. If they come back and tell me disk IO (which is a known problem on my system until we upgrade) I might lose it. Upgrading to NPM 10.3.1 took our average disk queue length down to 3 from over 7 which is better but still not ideal. We are hoping to move to our new SQL server in the next month.
(QUERY CAUSING THE BLOCKING)
(@maxRecords int,@fromDate datetime,@toDate datetime)
SELECT TOP (@maxRecords) NetObjectType,
NetObjectID,
NetObjectID2,
EventID,
Acknowledged,
EventTime,
Events.EventType as EventType,
Message,
ISNULL(EventTypes.BackColor, 0) as BackColor,
Nodes.NodeID as LinkNodeID
FROM Events
LEFT JOIN Nodes
ON Events.NetworkNode = Nodes.NodeID
LEFT JOIN EventTypes
ON Events.EventType = EventTypes.EventType
WHERE Acknowledged='false'
AND EventTime >= @fromDate
AND EventTime <= @toDate
ORDER BY EventID DESC