We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Odd memory use spike

Developer Preview

Kurt Deutscher's avatar
Kurt Deutscher
827 posts
7 years ago
Kurt Deutscher's avatar Kurt Deutscher

Try this:

template_group/index

In the index file just add:

Hello!

<ul>
 <li>33 Total Queries</li>
 <li>17.89MB of Memory</li>
 <li>0.8790 Seconds to Load</li>
</ul>

Now that you have a benchmark, try adding a channel entries tag to the same temple.

{exp:channel:entries dynamic='no'}

 {title}
 
{/exp:channel:entries}

We’re in 4.0.1-dp2 running on php 7.1 and we’re seeing the memory usage double from about 7.5m to almost 16m on our test pages.

The site has just 6 entries in it. Disabling parameters and everything we can think of doesn’t seem to matter.

The site has zero third-party addons.

From our “Hello!” templte load tab.

0.008617 / 6.9MB Calling Tag:
0.046487 / 15.4MB -> Data Returned

Anyone else seeing this?

       
Kurt Deutscher's avatar
Kurt Deutscher
827 posts
7 years ago
Kurt Deutscher's avatar Kurt Deutscher

Hm… seems that the forms are processing the EE global variables I use in the example, so, without the curly braces:

total_queries memory_usage elapsed_time

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

Do you see any particular high-memory items in the debugging log? For me, a Channel Entries tag with the default limit on an empty template uses about 8M of memory with an execution time of 0.1522 seconds.

       
Kurt Deutscher's avatar
Kurt Deutscher
827 posts
7 years ago
Kurt Deutscher's avatar Kurt Deutscher

Right, the addition of the channel tag in EE 4.1.0 is adding about 8M of memory use to the “hello” template. Compare that with EE v3.5.15 and it’s a significant difference.

EE 3.5.15
0.032313 / 1.8MB Calling Tag:
0.151282 / 2.2MB -> Data Returned

EE 4.0.7
0.027298 / 2.5MB Calling Tag:
0.175896 / 9.8MB -> Data Returned

EE 4.1.0-dp2
0.008396 / 6.9MB Calling Tag:
0.054413 / 15.5MB -> Data Returned

I’m currently building a new version of our default templates we start all our projects with, and am doing a lot of performance testing to see if/how our way of doing things might need to change with EE 4.x.x. At first, I thought that some of our code might be causing the increase in memory use, but after some sleuthing tracked it back to EE’s channel tag.

If the increase in memory use is intentional/acceptable, then no cause for alarm, but if this level of an increase wasn’t intentional/acceptable, and could cause issues on high traffic sites, then I thought it was worth mentioning now so your team could see if there’s a way to bring the memory use back down a bit without sacrificing the new features.

*note, the forum is stripping out the channel tag from the log examples, but that is the tag being called in these examples.

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

Could be a combination of your fieldtypes and dataset maybe? I don’t see any such memory increase with 4.1.0 is my point, and the new features wouldn’t add processing or memory overhead here in a Channel Entries tag with just a title variable. In reality though, no, that amount is insignificant and shouldn’t cause any issues for heavy traffic. Modern PHP apps regularly run in 256M+ environments, and memory management between the web server and PHP is getting very efficient, so an extra 6 at the bottom end is a blip. That you’re seeing a difference on the same environment though with presumably the same content and tag makes me curious.

Check the queries tab of your profiler and look for memory warning lines there, see any?

side note: yeah this forum has a pretty aggressive sanitization, and aside from a few globals, strips anything that looks like a tag that’s not encoded in a code block.

       
Kurt Deutscher's avatar
Kurt Deutscher
827 posts
7 years ago
Kurt Deutscher's avatar Kurt Deutscher

No warnings under the queries tab, just an alert icon under the templates tab when the channel entries tag shows up. Other than that it’s all clean.

I’m not worried about it. We set our PHP to allow 256M too, so I figured we would be fine. It’s just my instincts are that changes like this (be it, code performance, budgets, snowpack on Mt. Hood…) are things to keep an eye on. This might just be the “new normal”.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.