Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How can we fix high memory usage on EpiServer 8 sites in Windows Server 2012 R2

Vote:
 

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.

#151894
Aug 09, 2016 22:50
Vote:
 

Hello Ken

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:

  • You can try installing NewRelic to try and get some instrumentation around the application.
  • You can see if any custom code might be causing large object heap issues, see here and here for more info
  • Inspect code for anything that uses cache and ensure the right eviction policies are being set to ensure the cache is not growing needlessly (you can use a tool to enumerate the items in the cache)
  • If you are using in process session state, check how what's being stored in there and that the session timeout is appropriate
  • You can also try and re-create on a dev machine and use something like http://www.prefix.io/ to see whats happening in the application

David

#151942
Aug 10, 2016 17:44
Vote:
 

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 

#151944
Aug 10, 2016 18:43
Vote:
 

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.”

http://world.episerver.com/blogs/Svante-Seleborg/Dates/2011/4/1Gb-ought-to-be-enough-for-anybody/

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.

#151949
Edited, Aug 10, 2016 19:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.