Performance Troubleshooting EPiServer CMS Web Sites
description
Transcript of Performance Troubleshooting EPiServer CMS Web Sites
![Page 1: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/1.jpg)
Performance Troubleshooting EPiServer CMS Web Sites
Steve Celius – EPiServer Geek
![Page 2: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/2.jpg)
2
The Different Approaches to Performance
» This presentation focuses on troubleshooting existing sites with performance problems- Finding the cause and what you can do about it- The tools you need, and the common causes
» Performance is much much more- Clientside (everything not in your aspx) can be 80% of the
download time (when you’re not having server trouble)- I’ll cover this the next time
![Page 3: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/3.jpg)
5
The cost of fixing performance problems
Content Infrastructure CodeLow
Intermediate
HighCost
Thanks to Stuart Tuppert
![Page 4: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/4.jpg)
6
Finding the slow parts of your site
» Analyse IIS Logs- Check time_taken, # requests per hour / min (find the peaks)- Check for errors (404 / 500 status)
» LogParser & Visual Log Parser- Find the most requested pages- Find errors and long running requests- Easier with Visual LogParser
» Use Fiddler
» Performance Monitor- Lots of information on the net- Check cpu, req/s and req. queue
![Page 5: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/5.jpg)
7
Common Performance Problems
![Page 6: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/6.jpg)
8
The Large List Problem
» Large collections of pages will kill performance
» Understanding the cache is important- GetPage / GetChildren gets copies of PageData objects- Memory and CPU intense (lots of allocations and deallocations)
» Dynamic Properties – are they really neccessary?
» Pages with large strings (MainBody) is also a problem
» News archives will slowly kill your site
» Edit mode, expanding the tree loads two levels
![Page 7: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/7.jpg)
9
Key Points
» The devil is in the details- You don’t TRULY know until you have profiled
» Things changes with content- What does not hurt you today might hurt you tomorrow
» Make sure you optimize the important things
![Page 8: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/8.jpg)
10
Fixing it!
» Split up page lists with more then 250 pages into subtrees- Why 250? Practical reasons for editors- Use ”Date Containers” (/News/2007/June/My-news-article)- Moving pages using code is easy
• You don’t even need to recompile (no code behind file neccessary). See ArchiveBuilder.aspx
• If there are many pages, it will take some time
» Cache the list
» Move Dynamic Properties to the Start Page
» This problem has less impact in CMS 5
Easy Fix
![Page 9: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/9.jpg)
11
FindPagesWithCriteria (FPWC)
» The most resource intensive operation in EPiServer
» Very useful, and most sites need it
» It will search the database, returning all pages that match the criterias
» ”With great power comes great responsibility”
![Page 10: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/10.jpg)
12
Fixing it!
» Use log4net to detect FPWC calls- Log all FPWC calls to one file, with page id and search ref
» Limit the use of FPWC- Always think of alternative solutions- Limit the count of returned pages. The database call is not the
problem, working with a large resultset is
» Cache what you can cache- Enter EPiCode Cache Framework...
Medium Fix
![Page 11: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/11.jpg)
13
EPiCode Cache Framework for EPiServer 4
» All sites will have some complex and/or heavy queries (not only FPWC)
» You should recognize them when you write the code
» Prevent these queries to run too often, cache the result
» Designed for low impact on existing code
» Download from:- www.coderesort.com/p/epicode/wiki/CacheFramework
Medium Fix
![Page 12: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/12.jpg)
15
Use output caching
» Configurable, turn on in web.config
» Will cache the html output from your pages
» Can give you extreme performance
» Whole cache is invalidated on page publishing
» Not available for logged in users and POST
» ”VaryBy” – don’t vary by browser if you do not have to
» /3GB in boot.ini (?)
» It won’t fix your problems though
Easy Fix
![Page 13: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/13.jpg)
16
Beware of what you cannot see
» RSS Feeds in particular- Long lists, requested often- Check the IIS log file- Use the cache framework
» Bots, Crawlers and Spiders- They might fill our output cache- Will visit the ”uninteresting” pages, like the sitemap and news
archive. Pages you hope no one visits
![Page 14: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/14.jpg)
17
Scale out
» Buy more hardware
» Load balance on several servers
» Especially if the load is the problem
» Requires cache invalidation and file sync
» Session state (are you using it?)- State Server or SQL Server
Expensive Fix
![Page 15: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/15.jpg)
18
Migrate to EPiServer CMS 5
» You will need to rewrite some of the code
» The Migration Tool helps with data migration- This is another presentation altogether
» See Marek Blotny’s excellent blog post on EPiServer 5 vs. EPiServer 4.61- CMS 5 scales much better
Expensive Fix
![Page 16: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/16.jpg)
19
Important Tools
» Fiddler
» JetBrains DotTrace
» WebLoad / Jmeter / WAPT Load Testing
» log4net
» Trace Diagnostics
» IIS Diagnostics
» ASP.NET Viewstate Helper
» Performance Viewer (Windows)
» LogParser & Visual Log Parser
» IIS Traffic Monitor
![Page 17: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/17.jpg)
20
» Special offer to all EPiServer Developer Summit 2008 attendees
» Extended trial period (10 30 days)
» Offer lasts for 30 days – from now!
» Read more, download evaluation and order on:http://www.jetbrains.com/profiler
» Eval and Coupon code:
15%
b4zLrhD/g23bNieHrY8oV6EIezUiCzad
Discount
![Page 18: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/18.jpg)
21
Misc...
![Page 19: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/19.jpg)
22
Release Mode
» Compile the site in Release Mode (in VS)
» <compilation debug=”false” /> in web.config
» This will give you ~10% performance gain
» ASP.NET will not time out with debug = true- Just as important as the performance gain
» WebResources.axd scripts can be cached
» Site will use less memory
![Page 20: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/20.jpg)
23
Enterprise Gotcha
» Same source code, many different web sites- One place to deploy code- One config file to update
» But...- Config changes will restart all sites
• This is heavy lifting!
- Logging with log4net is a pain• All sites uses same config, with file locking, first site to start ”wins”.
Without locking, log file is a mess
- One change affects all sites, needs recompiling
![Page 21: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/21.jpg)
24
Enterprise Gotcha, contd.
» Use deployment scripts to copy files to all sites- With delays to allow recompilation and startup peaks- This also goes for web.config
![Page 22: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/22.jpg)
25
IIS Settings
» Log more- Review the IIS log settings. Turn on most log settings- Remember ”time-taken”
» Process Recycling – dont rely on it- It will only help on memory or resource leaks, temporarily- More often used on .NET 1.0/1.1 sites than 2.0 and up
» Web Gardens- No, no and no! It can actually hurt performance
![Page 23: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/23.jpg)
27
Minimize Viewstate
» Think Green - Save Bandwidth
www.binaryfortress.com/aspnet-viewstate-helper
![Page 24: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/24.jpg)
28
Links
» Performance Tuning and Optimization of EPiServer CMS (Fredrik Haglund)
» EPiServer 5 vs. EPiServer 4.61 part I - GetPage() (Marek Blotny)
» The challenges of a high traffic site with EPiServer (Adam Najmanowicz)
» Performance Pitfalls in EPiServer (Mats Hellström)
» The Output Cache - When and Why (Daniel van den Tempel)
» Caching Custom Data in EPiServer
» EPiServer Labs
![Page 25: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/25.jpg)
29
Per Request Cache
» Don’t do expensive operations more than once in a request
» Example:- Checking if the current page is in a given structure
» Refactor into utililty methods
» Keep the impact on existing code low
» Store in HttpContext.Current.Items- Request bound, thread safe
Medium Fix
![Page 26: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/26.jpg)
30
IIS Traffic Monitor
» Analyses IIS log files on the fly
» Simple and quick to use
» Uses Log Parser 2.2
Tool
http://niknak.org/software/IIsTrafficMonitor
![Page 27: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/27.jpg)
31
Use Fiddler to see real traffic
» Server performance is important, but don’t neglect the client side performance
» Check the Yahoo Performance Blog (and YSlow)- Percieved performance is also important!
» Make sure the clients cache effiently
![Page 28: Performance Troubleshooting EPiServer CMS Web Sites](https://reader036.fdocuments.us/reader036/viewer/2022062310/56816934550346895de08d0c/html5/thumbnails/28.jpg)
32