Excessive memory usage by iis application pool using umbraco

We have an instance of umbraco 4.11 with approximately 400 nodes running on iis 7.5, .net 4, windows 2008 r2. on the first visit, it consumes about 500 mb of bar and moves up to about 900 mb. Since the site will be deployed on shared hosting, this will cause us a huge problem.

I tried tracking custom memory leak codes and found nothing. I also ran Windbg on an application pool memory dump to find the following report:

--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal Free 461 7fb`9ab99000 ( 7.983 Tb) 99.79% <unknown> 1201 4`4ec32000 ( 17.231 Gb) 98.00% 0.21% Image 2604 0`1123e000 ( 274.242 Mb) 1.52% 0.00% Heap 74 0`037c2000 ( 55.758 Mb) 0.31% 0.00% Stack 172 0`01c00000 ( 28.000 Mb) 0.16% 0.00% Other 9 0`001b2000 ( 1.695 Mb) 0.01% 0.00% TEB 57 0`00072000 ( 456.000 kb) 0.00% 0.00% PEB 1 0`00001000 ( 4.000 kb) 0.00% 0.00% --- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal MEM_PRIVATE 628 4`50cda000 ( 17.263 Gb) 98.18% 0.21% MEM_IMAGE 3453 0`135fc000 ( 309.984 Mb) 1.72% 0.00% MEM_MAPPED 37 0`01181000 ( 17.504 Mb) 0.10% 0.00% --- State Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal MEM_FREE 461 7fb`9ab99000 ( 7.983 Tb) 99.79% MEM_RESERVE 985 4`226fb000 ( 16.538 Gb) 94.06% 0.20% MEM_COMMIT 3133 0`42d5c000 ( 1.044 Gb) 5.94% 0.01% --- Protect Summary (for commit) - RgnCount ----------- Total Size -------- %ofBusy %ofTotal PAGE_READWRITE 881 0`2edd3000 ( 749.824 Mb) 4.16% 0.01% PAGE_EXECUTE_READ 406 0`0f016000 ( 240.086 Mb) 1.33% 0.00% PAGE_READONLY 1157 0`02c1a000 ( 44.102 Mb) 0.24% 0.00% PAGE_WRITECOPY 422 0`01cde000 ( 28.867 Mb) 0.16% 0.00% PAGE_EXECUTE_READWRITE 121 0`00328000 ( 3.156 Mb) 0.02% 0.00% PAGE_EXECUTE_WRITECOPY 89 0`0026e000 ( 2.430 Mb) 0.01% 0.00% PAGE_READWRITE|PAGE_GUARD 57 0`000e5000 ( 916.000 kb) 0.00% 0.00% --- Largest Region by Usage ----------- Base Address -------- Region Size ---------- Free 5`3f530000 7f9`54ca0000 ( 7.974 Tb) <unknown> 2`835b4000 0`7bf7c000 ( 1.937 Gb) Image 7fe`e79da000 0`01338000 ( 19.219 Mb) Heap 0`0c5e0000 0`00961000 ( 9.379 Mb) Stack 0`00960000 0`0007b000 ( 492.000 kb) Other 0`006b0000 0`00181000 ( 1.504 Mb) TEB 7ff`ffe90000 0`00002000 ( 8.000 kb) PEB 7ff`fffdb000 0`00001000 ( 4.000 kb) 

other messages about managed parts of the memory are omitted because they do not show anything unusual. The dump shows that the region or unmanaged part consumes most of the memory, which is a sign of win32 api calls or something else that I don’t know about. What I need to know is the normal use of this memory? if not, what reasons and corrections can be applied to it? I would be grateful for the help in eliminating this problem! 0

+6
source share
3 answers

As Eric Gerlitz notes in his answer, a lot of things are happening under the hood of the Umbraco installation. In a nutshell, 400 nodes should not cause too many problems as they are published as XML and then cached. In addition, the standard Umbraco installation is not a hungry resource, so there is something else in the game, and probably quite thoroughly. Therefore, check the following:

How do you access node content? The most basic mistake you can make is to use the Umbraco API to access node content when you don't need it. For read-only scripts where you only need published data (for example, displaying content on a published website), you should use methods that request published data in an XML cache. In 4.11.x, it will be umbraco.NodeFactory.Node , INode or DynamicNode using the DynamicNodeContext model DynamicNodeContext to the macro. You should avoid using Document , Content , etc. objects since they make calls to the database.

How do you access media? . Starting from 4.8, all media stored in the CMS are indexed in the same way as nodes. In 4.7, you should use new Media(id) to retrieve the file in the library. This gets into the database and is therefore very expensive on request. You should use new DynamicMedia(id) as this extracts file information from the index and is very fast and makes a significant difference.

Do you cache macros? Careful use of this feature can help en masse. Even XML cache calls have a trace, and things like rendering basic site navigation can be quite expensive. I tend to cache complex navigation macros like these that are repeated throughout the site. Yes, there will still be a strike at the first request, but subsequently it will not. However, if you have limited resources, do not use macro-cached nuts. Be selective and consider which pages get the most traffic and which have more complex node bypass requests.

What data do you save in your document types? You don’t really need to check this out, but it’s worth checking out, especially if you realize that your site is growing in size. If you use a multi-node picker, do you store XML or CSV? CSV is significantly smaller because it only stores node identifiers. XML storage is useful for structured data and for access to using XSLT, but redundant if you only pull out the identifier of the media or content nodes. Do you also have additional fields that are not used? They will be published in XML and can save you resources as XML grows. Additional fields also mean more trips to the database when nodes are saved and published. So it’s better.

Do you save data that should not be? There is a tendency to make everything CMS-editable. LinkedIn URL, Twitter ID, company phone number, payment gateway callback pages, etc. But in reality, such things do not change very often, if at all. They can be safely assigned to keys in the AppSettings module of the web.config file. And then access through the static class "ConfigConstants", which makes the keys read-only. This saves a bit of space in the XML cache and makes it easy to load save and publish pages. It also means that you do not need to query the XML cache for data.

Do you have an intermediate request method and / or extension? This is by no means necessary, but I like to have extension methods that prevent reuse of code through the user interface. This means that I can always be sure that when I request a multimedia element, the boolean property, root node, etc. I use the same code every time. At this point, I can also do a little caching. Therefore, if I have a "Site Settings" node, I can cache its properties in a custom lightweight object, so I did not need to request a "Site Settings" node, and then its properties every time I needed to access the data on the site such as address, phone number, URL, etc.

Hope this helps a bit.

+10
source

400 nodes need caching, and there are also many activities that your test does not cover. We had another discussion on this issue, see Umbraco Memory Optimization

Also, which database did you set up? Some local db or sql servers?

0
source

Just like a few areas we have worked on in the past:

  • Does the site use imagegen? If so, is this the latest version?
  • Does the site use any planned import / export? anything that directly calls the database?
  • When is the backup task in the database / site files performed?
0
source

Source: https://habr.com/ru/post/950944/


All Articles