The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
We commonly get questions about the memory usage of various Sitefinity instances so I decided to share some information about the fundamental forces in play there. I will mostly talk about the memory usage on startup as it is the initial impression and causes a lot of confusion although the behaviour is valid for all .NET applications and usage patterns.
A common question is why do we get X Mb of memory (where X > 500) usage for a simple Sitefinity site on the very first request. The truth is that Sitefinity can allocate around 1 GB on start if the server on which it is running could afford this. It is usually achieved on servers with more than 15GB of free memory. We can also achieve a setup where Sitefinity startup takes as little as 70Mbs on machines with very little available memory and with all Garbage Collector settings set for memory consumption optimizations at the expense of performance (the startup in question was tens of times slower). The amount of memory allocated by Sitefinity is governed by the .NET Garbage Collector and it is responsible for finding the balance between faster execution (less garbage collections) and less memory consumption (more garbage collections). Sitefinity is provoking a lot of memory allocations on start because a lot functionality is executed on start – things we do not normally think of are happening like database model initialization, configurations reads, modules initialization, providers initialization, routes registrations, MVC controllers registrations, caching etc… No memory is leaking in those functionalities in the sense that some memory is allocated and not released after it is no longer needed but a lot memory is temporary allocated which schedules a lot of work for the Garbage Collector. From there on the Garbage Collector implementation decides how much memory to allocate before stopping the execution to clean unused memory.
This combined with the fact that by default the Garbage Collector settings for websites does not give memory back to the operating system once it has allocated a given amount is quite often the reason for larger memory allocations of applications with little traffic.
This also explains a commonly discussed fact that Sitefinity uses a lot less memory when running in a 32 bit application pool (32 bit process). This is simply because the maximum allocatable memory for such processes is much less than what is available for 64 bit applications which creates a higher memory pressure - forcing the Garbage Collector to allocate less memory. This is again sacrificing some performance although the feedback that we are getting suggest that a more aggressive garbage collector and the subsequent less memory usage is preferred from some clients.
The good news is that Microsoft continues to improve the Garbage Collectors implementation and gives new ways to control its behaviour with every major release. You can read the recommended environment settings explaining more about some of ways to control the CG behaviour here: http://www.sitefinity.com/documentation/documentationarticles/recommended-environment-settings-for-sitefinity
Momchil Mitev is currently leading the Sitefinity R&D team at Telerik. He joined the company in 2008 as a web developer helping the internal business systems teams and later moved to the Sitefinity division. Previous responsibilities include leading the DevOps team in Telerik, helping with continuous delivery implementations.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.