5 Hidden Performance Problems for ASP.NET

Preview:

Citation preview

ASP.NET Performanc

eMatt Watson

Founder & CEO

Tip #1Hidden

Exceptions!

Avoid silly exceptions

Use TryParse methods

Break on First Chance Exceptions

When not Breaking…

Subscribe to first chance exceptions

Viewing the output

Improve page load times

Exceptions best practices

• Avoid them at all costs

• Find hidden exceptions with Prefix

• Track all first chance exceptions to hunt them down

• Aggregate all exceptions in production

Tip #2Serialization

Web requestsSerialize Request

Send Request

Receive Response Headers

Download Response

Deserialize Response

Breaking down a WCF request client side

Breaking down a WCF request server side

REST call client side

REST call server side

Reading incoming data

Comparing different usages

Web request & serialization tips• Understand payload size

• Customize JSON serializers

• Consider manually reading incoming data

Tip #3SSL

Overhead

SSL Overhead on Windows

IIS Architecture

SSL Tips• Offload SSL to load balancer or hardware if possible• Netscaler, F5, etc

• Use Azure Application Gateway for SSL offloading

• AWS use ELB with SSL

Tip #4Garbage collection

Garbage collection pauses

Monitoring GC Time

Monitoring GC Time

Garbage Collection Tips• Avoid the large object heap

• Use streams where you can

• Avoid large strings

• Server vs workstation GC mode <gcServer>

• Monitor GC performance counters

Tip #5Real SQL

Performance

What does App Insights say?

SQL Connection Statistics

SQL Performance Tips• SQL server performance != real world performance

• Your SQL performance reports are probably all wrong!

• Use your logging or Prefix to understand real world performance

Questions?

Recommended