Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
How to speed up .NET and
SQL Server web apps
Bart Read
Who am I?
• Bart Read, Web, Database, and Mobile Performance Consultant
• Previously worked for Red Gate
• Contacts
• E: b...
General Web Performance
http://www.bartread.com/2
014/06/03/web-
performance-how-fast-does-
website-need-to-be/
Always measure!
(But it’s almost
never the code!)
Production Monitoring
Detailed Diagnostic Tools
Other Handy Ancillary Tools
A word of warning about SSMS
Read Erland Sommarskog’s post, “Slow in the application, fast in SSMS?”:
http://www.sommarsko...
Scenario 1
The Slow Support Centre
Customer Support Centre
(MS Dynamics)
Grant Fritchey’s FREE eBook on
execution plans:
http://www.red-
gate.com/community/books/s
ql-server-execution-plans-ed-2
...
Scenario 2
The Memory Leak in the eCommerce Site
eCommerce Site
(MS Dynamics)
Other technologies:
- NServiceBus
- Endeca
Scenario 3
Locking, Blocking and Deadlocking
Locking, Blocking & Deadlocking
Concurrency
• Object level concurrency
• Row level concurrency
Transaction Isolation Levels
• Read Uncommitted
• Read Committed <- SQL Server default
• Repeatable Read
• Snapshot
• Seri...
Locking pattern
• Reads
• A -> B -> C -> D -> A -> B -> C -> D -> E -> A …
• Etc.
• Writes
• A –> B -> C -> D -> E -> A ->...
Solutions
• DEADLOCK_PRIORITY
• http://msdn.microsoft.com/en-us/library/ms186736.aspx
• SET DEADLOCK_PRIORITY LOW | NORMAL...
Scenario 4
Networking
Stuart Cheshire, “It’s the latency, stupid” (1996): http://www.stuartcheshire.org/rants/latency.html
Fast/Slow Query
Query Frame
Result Set Frame
Virtual NIC Setting To Blame
Client-side Scenarios - General Observations
• Payload
• Chattiness/latency
• CSS transitions and animations
• Code execut...
Star Citadel:
https://arcade.ly/games/starcastle
Other Scenarios
• Indexes
• Missing indexes
• Maintenance
• Statistics
• NTEXT (etc.) preventing online rebuilds
• http://...
Questions?
E: bart@bartread.com
W: www.bartread.com
B: www.bartread.com/blog
T: @bart_read
GH: https://github.com/bartread...
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)
Upcoming SlideShare
Loading in …5
×

DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)

437 views

Published on

Talk on performance tuning .NET and SQL Server web apps, with a focus on middle tier, service, and database issues. This version of the talk does include a short discussion of client side issues, since these are becoming more important, particularly when targeting mobile devices and tablets.

Published in: Software
  • Be the first to comment

  • Be the first to like this

DDD 2016: How to speed up .NET and SQL Server web apps (Reading, UK)

  1. 1. How to speed up .NET and SQL Server web apps Bart Read
  2. 2. Who am I? • Bart Read, Web, Database, and Mobile Performance Consultant • Previously worked for Red Gate • Contacts • E: bart@bartread.com • W: www.bartread.com • B: www.bartread.com/blog • T: @bart_read • GH: https://github.com/bartread
  3. 3. General Web Performance http://www.bartread.com/2 014/06/03/web- performance-how-fast-does- website-need-to-be/
  4. 4. Always measure! (But it’s almost never the code!)
  5. 5. Production Monitoring
  6. 6. Detailed Diagnostic Tools
  7. 7. Other Handy Ancillary Tools
  8. 8. A word of warning about SSMS Read Erland Sommarskog’s post, “Slow in the application, fast in SSMS?”: http://www.sommarskog.se/query-plan-mysteries.html
  9. 9. Scenario 1 The Slow Support Centre
  10. 10. Customer Support Centre (MS Dynamics)
  11. 11. Grant Fritchey’s FREE eBook on execution plans: http://www.red- gate.com/community/books/s ql-server-execution-plans-ed-2 Tool: http://www.supratimas.com/
  12. 12. Scenario 2 The Memory Leak in the eCommerce Site
  13. 13. eCommerce Site (MS Dynamics) Other technologies: - NServiceBus - Endeca
  14. 14. Scenario 3 Locking, Blocking and Deadlocking
  15. 15. Locking, Blocking & Deadlocking
  16. 16. Concurrency • Object level concurrency • Row level concurrency
  17. 17. Transaction Isolation Levels • Read Uncommitted • Read Committed <- SQL Server default • Repeatable Read • Snapshot • Serializable ACID
  18. 18. 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.
  19. 19. 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
  20. 20. Scenario 4 Networking Stuart Cheshire, “It’s the latency, stupid” (1996): http://www.stuartcheshire.org/rants/latency.html
  21. 21. Fast/Slow Query
  22. 22. Query Frame
  23. 23. Result Set Frame
  24. 24. Virtual NIC Setting To Blame
  25. 25. Client-side Scenarios - General Observations • Payload • Chattiness/latency • CSS transitions and animations • Code execution time again becomes an issue • Garbage • High memory usage
  26. 26. Star Citadel: https://arcade.ly/games/starcastle
  27. 27. 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
  28. 28. Questions? E: bart@bartread.com W: www.bartread.com B: www.bartread.com/blog T: @bart_read GH: https://github.com/bartread Red Gate coding challenge: http://www.red-gate.com/our-company/entrypage/coding-challenge

×