SQL in the City, London, 2014: How to speed up .NET and SQL Server web apps
Transcript of SQL in the City, London, 2014: How to speed up .NET and SQL Server web apps
Who am I?• Bart Read, Consultant, Software Engineer• .NET, SQL Server, performance tuning, project management
• Previously worked for Red Gate• Contacts• E: [email protected]• W: www.bartread.com• B: www.bartread.com/blog• T: @bart_read• GH: https://github.com/bartread
General Web Performance
http://www.bartread.com/2014/06/03/web-performance-how-fast-does-website-need-to-be/
Grant Fritchey’s FREE eBook on execution plans:
http://www.red-gate.com/community/books/sql-server-execution-plans-ed-2
Solution (Nasty Hack)
container.Kernel.ReleasePolicy = new NoTrackingReleasePolicy();
(Creating some technical debt for the future.)
Transaction Isolation Levels• Read Uncommitted• Read Committed <- SQL Server default• Repeatable Read• Snapshot• Serializable
ACID
Locking pattern• Reads• A -> B -> C -> D -> A -> B -> C -> D -> E -> A …• Etc.
• Writes• A –> B -> C -> D -> E -> A -> B -> A -> B -> C -> D …• Etc.
Solutions• DEADLOCK_PRIORITY• http://msdn.microsoft.com/en-us/library/ms186736.aspx• SET DEADLOCK_PRIORITY LOW | NORMAL | HIGH
• Read Committed Snapshot Isolation• http://www.brentozar.com/archive/2013/01/implementing-snapshot-or-read-
committed-snapshot-isolation-in-sql-server-a-guide/
• Disciplined ordering of object access• Unit of Work Pattern
• Martin Fowler• http://martinfowler.com/eaaCatalog/unitOfWork.html
Other Scenarios• Indexes• Missing indexes• Maintenance• Statistics• NTEXT (etc.) preventing online rebuilds
• http://www.bartread.com/2014/09/17/convert-all-ntext-columns-to-nvarcharmax-sql-server/
• Stored procedures and cached execution plans• WITH RECOMPILE
Questions?E: [email protected]: www.bartread.comB: www.bartread.com/blogT: @bart_readGH: https://github.com/bartread