Episerver dev meetup: Performance in Episerver Solutions, Tommi Raunio, Solita
Transcript of Episerver dev meetup: Performance in Episerver Solutions, Tommi Raunio, Solita
PERFORMANCE IN
EPISERVER
SOLUTIONS
Tommi Raunio
Software Architect
Twitter: @TommiRaunio
ME?
› Tommi Raunio
› Software architect
› Working with .NET since 2006
› In Solita since 02/2014
› Twitter: @TommiRaunio
AGENDA
1. What’s performance and why talk about it
2. Constructing performing Episerver websites
WHAT & WHY
PERFORMANCE?
› Two types
› Vertical
• Load speed
• The speed which invidual user experiences
› Horizontal
• Number of requests the site can handle
• Makes the site absorb more stuff
PERFORMANCE MATTERS!
› Performance equals money
• More efficent software equals less hosting costs
• E-commerce sites start losing purchases if the site doesn’t perform
› Developer satisfaction
HOW?
THREE SECRET INGREDIENTS TO
PERFORMANCE
1. Design & Architecture
2. Implement
3. Measure
PART 1. ARCHITECTURE
DISTANCE MATTERS
Episerver DB / SQL Server
Episerver front server / IISExternalsystems
Query cache
Browser caching
ContentOutputCache
Object (Contentrepository)Cache
File caching
Custom made caching
CUSTOM CACHING
› Caching is a shortcut to data
› Use caching as a shortcut for long running operations
› Do cache (for example)
• Long JSON strings (Web API / Razor)
• Results from external systems
› Don’t cache
• ContentRepository Get / GetChildren
WHEN CACHING…
› Use CacheManager
› Invalidate
› Remember the logged in user. Don’t cache content when logged in
› Don’t over-engineer
ARCHITECT FOR READS
Write optimizeddatabase
Episerver front server / IISExternalsystems
Read optimizeddatabase
Redis / Episerver Find / ElasticsearchEpiserver databaseSQL Server
Sync
PART 2. IMPLEMENT
IMPLEMENTATION & MISC.
› Keep your datasets to minimum
• When reading from DB
• When sending data to browser
› Avoid unnecessary reads from database
› Watch that lazy Ienumerable
› Construct a device aware image system
› Minimize the number of JS libraries
› Bundling & minification
PART 3. MEASURE
PREFIX
› Light weight performance analyzer
› Good for general performance analysis
› Result filtering is done for you
• Tracks only the most important methods
› During development as a second screen
› Free!
JMETER
› Performance testing tool
› Good for generating load
› Good for stress testing your site (in dev)
› Combine with dotTrace to reveal code ”hot spots”
DOTTRACE
› .NET code profiler
› By Jetbrains
› My personal go-to tool regarding performance problems
› Very detailed analysis on where the time is spent in code
WEB ANALYSIS
› PageSpeed Insights
› Webpagetest.org
› Both tools (sites) do a really good
analysis from browser level
DOTMEMORY
› .NET memory profiler
› Silver bullet for memory leaks
PERFORMANCE MEASUREMENT
OVER TIME
› Displays page performance over time
• Shows possible drops in performance after changes
› Custom tool based on Jenkins + MSTest + Elasticsearch + Kibana
QUESTIONS?