Get the best possible performance from the Developer Program Benefit subscription on Azure. Around R450 of Azure credits per month for free.
- App service - D1 Shared (Free is OK, but only 160MB data a day, so AppInsights will eat that up very quickly. Costs R166, above $$$)
- Database - B Basic (cheap! only R86, good value for money)
- Optimize, optimize, optimize! You only get 30ms/sec CPU time before maxing out allowance
- Avoid scans, prefer seeks
- Statistics will screw you when it can though
- Use MARS
- Forget about
using
around connections! - Saves keystrokes!
- Forget about
- Use Pooling
- Not the default!
- Not using pooling costs 30ms+ connection open durations
- Set Max pooling to 30
- This is the max you will get
- Set connection timeout to 60 (seconds)
- If you care about losing connections
- Use query store (a lot!)
- Defaults suck!
- Use
Top Resource Consumers
, selectAverage
, sort byExecution count
- Use one SQL connection per request, open lazy, close eager
- Open on first use (https://gist.github.com/leppie/342ff55d2a6c0bbef2fd2047bdfb4aaf) (thanks @marcgravell)
- Close on
OnActionExecuted
- EF is not that bad, but use Dapper and SQL views for max performance
- Views make SQL dev easier, and you can easily see query plans and test predicates
- Use batch queries (in Dapper
QueryMultiple
)- A good 2-3ms overhead for every time you call
ExecuteXXX
- A good 2-3ms overhead for every time you call
- Precompile web pages
- No one likes slow starting sites
- Use async (but not really required)
- If you dont mind the latency
- Compile for Release
- But include PDB's for debugging and stacktraces
- Cache what you can when memory limits allow it (need to look at old Azure portal for this)
- SQL will eat you
- Even a short cache of 1 second will prevent SQL from getting bogged down under load
- AppInsights can be helpful (setup a 5 minute, 5 location 'uptime' job)
- keeps app alive ;p
- provides historic data
- dump a bunch of the most used workloads in the there
- Note: Does have bugs! Dont trust async dependencies (microsoft/ApplicationInsights-dotnet-server#106 (comment))
- Keep server reponse times as low as possible, lower the better (ideally < 10ms)
- You can expect a max of 400 requests a second for a non-db page
- If not using async, use .NET 3.5 for an extra free 100+ MB RAM
- Helpful for caching
- Use free Cloud load testing (I generally do 125 users over 2 minutes)