ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Cache not working?

June 10, 2011 6:33pm

Subscribe [6]
  • #16 / Jul 06, 2011 3:55pm

    Lisa Wess

    20502 posts

    Hi, Stephen -

    There’s nothing there that indicates it isn’t working, but it was something to double check.

    Can you do something for me?  Create a totally blank template, in it put this:

    {exp:channel:entries limit="5"}
    {title}
    
    {/exp:channel:entries}
    Ran {total_queries} in {elapsed_time}

    Set that template to cache.

    Now, load the template, and take a screenshot of that.

    Refresh it again, and take a second screenshot.  Please post those, clearly indicating the “before” and “after” as we want to see if there’s any difference in a greatly simplified template.

    Thank you!

  • #17 / Jul 06, 2011 5:25pm

    Stephen Rushing

    40 posts

    Here they are.

    I continued to hit refresh a few times after these screenshots. It’s wierd to me that the number of queries varies. It actually went from 29 to 31, then back to 29. The attached screenshots show 29 and 30.

  • #18 / Jul 07, 2011 10:41am

    Sue Crocker

    26054 posts

    Thanks for the report, Stephen.

    Just a quick status update: Kevin escalated this yesterday and I mentioned your results as well. Let’s get some login details. Please check your email in a few minutes.

  • #19 / Jul 08, 2011 10:09pm

    Stephen Rushing

    40 posts

    I’m sure you received the login info I submitted yesterday, but I just wanted to check in. The map load times are the only thing keeping the site from launching, and client is eager, so are we!

  • #20 / Jul 09, 2011 1:43am

    Lisa Wess

    20502 posts

    Hi, Stephen -

    We did receive those details.  Our development will be able to look at this for you come Monday morning.  I do apologize for the delay; in this case, you’ve run into a bit of an odd one and ti’s going to take some extended troubleshooting to find out what is going on.

    Thank you!

  • #21 / Jul 11, 2011 3:39pm

    Robin Sowell

    13255 posts

    Just a heads up- there are two issues, one with page caching and one with it just being too many results w/a complex conditional that has to be parsed.  First issue I have a temp solution in for, but want to get a final solution.  Second issue- probably best to just put a hard limit on it.  Though I’m going to do a quick test w/a simple conditional and see.

    But basically it was taking 30 seconds to parse advanced conditionals because it’s looping through 4,600 of them.  It’s actually pretty fast- but with that many it will bog down.

    Will update once I’ve finished things up!  Thanks for your patience on this one.

  • #22 / Jul 11, 2011 5:07pm

    Robin Sowell

    13255 posts

    OK- page cache is working.  I believe it has been all along.  I can’t delete the files via ftp, but clearing cache in the backend does properly clear them out and new cache files are created properly etc.

    It’s easy to see this if you turn both the Template Debugging and Output profiler on in ‘Admin- System Prefs- Output and Debug’.  Here’s the page in question with and without serving from cache:
     
    Total Execution Time     82.0482
    DATABASE:  ee_uptown   QUERIES: 497


    Total Execution Time     50.6530
    DATABASE:  ee_uptown   QUERIES: 17

    I personally would not rely on cache to get that page time down (even if it was getting it down to an acceptable level).  To get by in a pinch, it may work.  But I’d put optimizing that template high on my priority list once time allows.

    Which gets us to the crux of the problem- a 50 second load time still isn’t anywhere close to acceptable.  The way the templates are structured are just bogging down when you’re pulling back 400+ entries.

    I created a simple template and just put the title on it- rather than pulling in the snippet with the conditionals and such.  Using super search and the same get data my times were:
    Uncached:
    Total Execution Time     6.1567
    QUERIES: 37

    Cached:
    Total Execution Time     0.3009
    QUERIES: 17

    One thing in particular that is grinding things to a halt are the conditionals.  I put in a marker to indicate in the debug the start and end of the ‘prep conditionals’ function.  This is what was generated on a cached load of the map page:
    1.980896) Start Prep Conditionals
    (49.606125) End Prep Conditionals

    With over 400 entries, it ends up looping through 4,600+ advanced conditionals, and that is just going to grind things to a halt.  Caching will have no bearing on the conditionals at all- just to be clear.

    SO- what to do?  If it were me, I would put the tag itself in a different template and embed it.  I’d do that so I could use php parsed on output to handle a lot of the conditionals.  You have to embed because parsing the url as you are- you need php parsed on input in that template.  But embed will let you use php on input to get your GET- pass it to the embed via an embed variable- then use php parsed on input to do a lot of the conditional work.  There’s no need for a plugin and regex to do some of that matching you’re using in your complex conditionals.  Simplify and focus on going as lean as possible- which you can do w/out losing any output.  You’ll just need to shift focus a bit on that particular template and structure things so you can optimize.  That- or put a default limit of around 50 on that, so the loops won’t get so out of hand.

    Does this make sense?  Can you see that page cache is working?  And see what I mean about the structure in general and the conditionals in particular being the main issue bogging things down on that page?  There are a number of ways you could approach that optimization, but I think it’s going to take some structural changed or a page limit to get that particular page loading acceptably.

  • #23 / Jul 13, 2011 9:11am

    Derek Jones

    7561 posts

    Hey Stephen, just checking in to see if Robin’s reply was helpful, and if you need any assistance in making the suggested changes?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases