Optimizing Performance in Sitecore
Note: Full-sized "CMS Performance Tuning Guide" document containing detailed instructions on how to implement most of the listed in this article items can be found here.
This article contains a list of items that you should investigate if your Sitecore installation is experiencing poor performance. You can also investigate these before putting your Sitecore website into production.
This is not a complete or detailed guide, but rather an outline of the most generic and efficient optimizations that you can perform based on the experience of Sitecore Support team members.
- Ensure that the IIS environment is up-to date
- Windows Server 2008 R2 x64 is highly recommended. It contains a lot of valuable bug fixes and new features compared to Windows Server 2003.
- 64 bit application pool mode is highly recommended. This allows you to allocate more memory to the application.
- 4 or more processor cores are highly recommended.
- For high volume Sitecore solutions (for example, more than 20k item versions), we recommend that a minimum of 4GB of RAM should be available for the w3wp.exe process. This enables Sitecore cache sizes to increase, improves performance, and decreases the load on SQL Server.
- Optimize Sitecore caches.
- Increase and tune the size of the data, items, and prefetch caches. Bigger caches = better performance.
- Always use HTML caching and make almost all the renderings on the site cacheable. Then tune the size of HTML caches.
- Tune the sizes of other caches if they are reaching their threshold.
- Tune or disable initial prefetching. Do not disable the actual prefetch caches — you should only increase their size. This can affect startup times.
For more information about Sitecore caches, see the Cache Configuration Reference article.
- Optimize Sitecore databases
- Make sure that all the connected SQL databases are on the same network. For example, going through the public firewall is a no-go for the database performance.
For information about testing connection speeds, see the Testing Database Performance article.
- Use the database cleanup tool to remove artifact data from the databases. Click Desktop, Sitecore, Control Panel, Database, Clean Up Databases to open the database cleanup tool.
- Cleanup the following tables from the artifact data. It is safe to completely truncate them before publishing your website. All of these tables should be automatically cleaned up on a periodic basis:
- History – cleaned up by Sitecore.Tasks.CleanupHistory agent
- PublishQueue – cleaned up by Sitecore.Tasks.CleanupPublishQueue agent
- EventQueue – cleaned up by Sitecore.Tasks.CleanupEventQueue
- Rebuild all the database indexes and implement maintenance plans:
- Set up the database properties:
- Run DBCC CHECKDB to check for database consistency errors
- Tune the Analytics database.
For more information about improving the performance of the Analytics database, see the OMS Performance Tuning Guide.
- Sitecore Client specific optimizations
- Make sure that content authors never use Full publish — they should only use Smart or Incremental publishing.
- Enable content expiration in IIS. In that case the web browsers won't request all the static files from the server second time until their expiration date is passed. Sitecore Client uses a lot of static files.
- Enable static HTTP content compression in IIS.
- Enable dynamic HTTP content compression in IIS. This speeds up both the Sitecore client and the public web site and is especially beneficial in environments with a low bandwidth.
- Set the ContentEditor.RenderCollapsedSections setting to False. This is a hidden setting that is set to True by default. Changing this setting can help a lot.
- Set the ContentEditor.CheckHasChildrenOnTreeNodes and the ContentEditor.CheckSecurityOnTreeNodes settings to False. Changing these settings doesn’t normally help much, but you should still test whether or not this helps.
- Check long running validators and disable any default validators that you don’t need. They are often the cause of bad performance.
- Do not show Standard Fields in Content Editor.
- Limit the number of items that share the same parent to 100 items per parent.
- Cleanup obsolete versions and ensure they do not grow unrestricted – we do recommend to have no more than 5-10 versions per item in Master database. Use the Version Manager shared source tool for this. http://marketplace.sitecore.net/en/Modules/Version_Manager.aspx
- Check this article: http://sdn.sitecore.net/Scrapbook/Delay%20while%20validating%20digital%20signatures.aspx
- Monitor Sitecore log files for any application restarts. If a new log file is generated, this often means that a restart has occured. Identify the reason for the restart and address it.
- If the log file ends with a "Sitecore shutting down" message – this is a "soft crash" and for some reason the hosting environment has forced the process to recycle (for example, due to some scheduled recycling or some critical file changes).
- If the log file does not end with a "Sitecore shutting down" message – this a “hard crash” due to for example a stack overflow error or some worker thread deadlocks. A good solution could be to collect a process crash dump and analyze it with WinDbg.
- Disable search indexes if you don't use them. Set Indexing.UpdateInterval to 00:00:00.
- Watch out for any scheduled operations that may be running in the background - especially any custom made operations that for example perform a complete rebuilding of the Lucene index.
- Perform load testing and profiling of your solution to find slow running pages and code paths. This is the most efficient way to identify any custom code and configuration issues.
- Load test the solution for example using:
- Profile your solution while stress testing (for example, by using the ANTS Performance profiler) to find bottlenecks in the code that may need to be optimized.
- Valuable for understanding the health and performance of your application health and Windows performance counters:
- % time in GC
- # Induced GC
- # Bytes in all Heaps
- # Total committed bytes
- # Total reserved bytes
- Request Execution Time
- Valuable for understanding Sitecore caching state counters:
Major performance related fixes in the latest Sitecore 6 versions
- 6.1.0 Update-2 – out of memory errors caused by FileWatchers
- 6.1.0 Update-3 – UserProfile and IsUserInRole security caching
- 6.2.0 Initial – SqlServerDataProvider.BlobStreamExists() caching
- 6.2.0 Update-3 – duplicate requests to RolesInRoles provider (ref. 322685)
- 6.2.0 Update-3 – crashes due to cyclic role inheritance (ref. 309080)
- 6.3.0 Initial – publishing performance increased
- 6.3.1 Initial – SQL replication can now be used for Scaling