High Memory usage on Kentico 7

Digital Team asked on March 24, 2016 17:42


I have been working now with Kentico for 2 months and since them i'm facing strange memory issues where I cannot sort out. I've been reading about memory problems in Kentico and the only thing that I could figure out is that Kentico consumes +1GB when used a lot and that ~400Mb minimum to work properly.

The thing is that the my websites are not that traffic-heavy, even if I'm the only user, after a couple of hours navigating though the kentico website, I reach easily the 1Gb of memory usage of the application, Actually, I can see how memory consumption increases drastically for each time I click on a new URL increasing in 10Mb per each click.

My question is: is this normal?

There is a bit of custom WebParts, Pages & templates but as far as I checked, there is nothing strange. The only thing I can see is that the webparts are connecting to database without closing the connection after retrieving data using the CMS.ConnectionHelper.GetConnection() tool.

I also checked caching options, but when I clean object and files caching it releases not more than 50Mb.

What makes kentico so memory dependant? Is there any tool, or something who I can debug the memory usage in Kentico? Something where I can determine if there is a custom code? I already tried a few options in Kentico system configuration without success.

I already have tried using SQL profiler to see if there are queries who take to long or try to get huge amounts of data or if there are too many open connections. But there isn't really anything strange...

Also good to mention that putting multiple sites on a single kentico instance don't reduce too much the memory consumption, I thought that maybe by sharing resources it could be reduced but I was wrong.

I appreciate any help I can get. My next step is adding more RAM to my server.

Recent Answers

Trevor Fayas answered on March 24, 2016 18:27

Kentico can be a bit of a memory user, but here are some things that increase it.

  1. Caching: This is more than just page caching, it includes server side file caching, query caching and other similar items. I would check all of those cache settings and trim them down.
  2. # of Users, the more users, the more it has to store for session data.
  3. Session data, check any custom code, are you storing any large objects in the session?


Usually kentico takes up about 250-500mb on a small site (website only). I assume the database is in another location, correct? If you are including the database with the site, you will want at minimum 1gb for the database and 500mb for the site, but more is always better.

1 votesVote for this answer Mark as a Correct answer

emma zelewsky answered on March 24, 2016 20:50

There are a host of debugging tools that could help you find the problem. But be sure to turn off debugging on your production site because that can really slow down things.

We've seen memory spikes when a couple of CMS processes compete for the SQL Server, and that could be the issue you're seeing. If that's the case, then adding RAM won't be of much help.

A few other things to check for clues--

  • Event logs, especially errors
  • Settings-->System -- check CMS-wide cache settings as Trevor noted.
  • Settings-->System -- files, storing them in the file system will reduce the load on the DB. Files can be stored in both the file system and DB, and requests are handled by the file system first, then the DB.
  • Scheduled tasks -- turn off unneeded tasks; check the frequency of system tasks that could help, especially clear unused memory and idle session.
  • Analytics -- not sure about v7, but the built-in analytics in an earlier version we ran really slowed down page loads.
  • Viewstate -- this is more of a tweak but turning off viewstate (for docs, not items related to user info) can shrink page size considerably and reduce server load.

Good luck!

1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 24, 2016 21:02

To add to the already great answers from Trevor and Emma, I'd state the way Kentico is setup by default it will work very well and not use a lot of memory or grow exponentially like you're explaining. Instances in which I've seen high memory usage is where there is a lot of custom development NOT using the Kentico API or not using it correctly.

So if you are saying you have a lot of custom code and you're using the CMS.ConnectionHelper.GetConnection() method, then I'm willing to bet none of that custom code is utilizing any of the OOTB API tools. Typically when a developer is using GetConnection() it's because they don't know how to take advantage of the API and simply call a SQL query.

The GetConnection() method should automatically close the connection, so no worries about that. What's more concerning is for each page load this code is being run and none of it is being cached. So without seeing the code itself I'm willing to bet you have a lot of bad code causing your memory issues.

As Emma stated turn on debugging and check out what is going on there as well.

2 votesVote for this answer Mark as a Correct answer

David te Kloese answered on March 24, 2016 23:17


Most is already mentioned above, but just to give you another tool. Try have a look at KInspector recently made available as open source. Created by people working at Kentico.

It's a tool that helps you keep your Kentico website in good shape by analyzing it and giving you performance, health, and security hints.



1 votesVote for this answer Mark as a Correct answer

Digital Team answered on March 29, 2016 16:56

Thanks for all the answers.

  • Catching: I have reduced the catching options to the minimum time and size, but still there is not huge difference.

  • User session data: I used a code to get the size of it and it seems that there is no more than 100Byte information per session. Nothing than a few ID strings.

  • Event logs: After checking event logs, I realized that there is a asset that is called by the browser "akkurat.woff". This font type is called always from the CSS but it returns a 404 error. I will fix it as it returns a 404 error each time somebody calls a page but could this really affect the memory usage?

  • Database: I have my database in another Server that hosts all my Kentico databases, and it is on the memory limit too. As Emma mentioned, if there is really a big memory peak because of this then I would be worried. Certainly the websites are fast so i'm not sure if this can be the issue.

  • Files on system: The option was unchecked, I have enabled it to see what will happen. I will get back if this helped.

  • Analytics: completely disabled.

  • Custom code: As Brenden says, the use of CMS API tools is minimal in the custom WebParts, but correct me if i'm wrong: I would be worried about the performance but less about the memory usage as it doesn't cache anything. And here the issues is about memory.

I will also try to use Kinspector, it says that it is not recommended to use on production so i'm not sure if I shall use it.


0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.