We have 18 EpiServer 8 sites deployed to multiple Windows 2012 R2 servers. Recently we noticed that memory usage for some of these sites was very high. Consequently we doubled the RAM from 8GB to 16GB. But we are still seeing what we consider high memory usage from several of the site instances.
Each site is assigned to an individual app pool. Inspecting the Worker Processes, we can see that most of these sites use about .5 GB of memory, which seems reasonable. However, 3 of those sites use around 1 GB of memory, and one is consuming 3.5 GB of memory.
There are no significant code differences between these sites. They were based on a common template, with some markup differences. The most memory-consuming site (3.5 GB) has 63 pages.
For several days we've researched this, and worked with our operations team. We don't know if this type of memory usage is normal for EpiServer sites. Is this what we can expect? How can we best address memory consumption? What types of settings, in IIS, web.config, the CMS, or otherwise, can we tune or check to improve memory use by these sites?
Thanks for your help.
This kind of usage is certainly not normal for a site that has 63 pages. Stating the obvious it sounds like you have a memory leak somewhere. Episerver core APIs use RAM to cache content but this is normally very efficient so memory shouldn't be used like you have described. Some ideas to trace this down:
Probably some poor coding somewhere. I agree with David there.
Checking what is stored in memory will be the easiest way to resolve the issue. Some common mistakes are:
1. Creating large objects in code instead of working with streams.
2. Storing too much in session state
3. Looping through the entire site by using some recursive method and then not caching the result in a good way.
4. Getting lots of large objects from an external data source and not caching that / using paging
David and Daniel, thanks for the advice. Much of what we have was provided by an external vendor, so it wouldn't surprise me that some code needs to be amended.
Today I found this comment for an older version of EpiServer: “A small-to-medium site should run perfectly fine in 300 – 500Mb, a very large one should do well in 1Gb.”
That, plus your advice, provides additional clarity in this matter. We will proceed with the assumption that "poor coding" is impacting these sites. Thanks so much for your help.