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]
  • #1 / Jun 10, 2011 6:33pm

    Stephen Rushing

    40 posts

    I am populating a map with a large amount of data, so I’m trying to employ cache. I’ve tried turning on template cache and using cache=“yes” refresh=“60”, but it doesn’t seem to have any effect.

    My expressionengine/cache directory is writable and I see several files in there.


    This URL will take about 2 minutes to load:
    http://uptown.esiteful.com/directory/_map_results?group_1=1|100|2|101|120|78|119|118|117|116|115|114|113|112|111|110|109|108|107|106|105|104|103|102

    If you need to look at the page without the load time, add the num parameters:
    http://uptown.esiteful.com/directory/_map_results?group_1=1|100|2|101|120|78|119|118|117|116|115|114|113|112|111|110|109|108|107|106|105|104|103|102&num=20

    If you need access to the backend or FTP, let me know and I’ll provide it ASAP.

    Thanks,
    Stephen

  • #2 / Jun 12, 2011 3:38pm

    Greg Salt

    3988 posts

    Hi Stephen,

    Can you please show us the code that is being used to generate this data?

    Cheers

    Greg

  • #3 / Jun 13, 2011 1:56pm

    Stephen Rushing

    40 posts

    I’ve attached the _map_results template.

    That’s a bit of a loaded question, considering all that’s involved with plugins, embeds, snippets etc, so let me know if you need access to the backend and FTP.

  • #4 / Jun 14, 2011 5:54pm

    Kevin Smith

    4784 posts

    Hey Stephen–

    Since the output you’re trying to cache is itself output from a third-party add-on, the place to get support for that is the third-party developer, Solspace. You might have a look at the documentation for that add-on, too, since it might provide some insight.

  • #5 / Jun 15, 2011 11:01am

    Stephen Rushing

    40 posts

    To illustrate the lack of caching, I’ve changed the super_search:results tag to a channel:entries tag. I also replaced the snippet tags with the contents of those snippets. It is still taking far too long to load with the cache settings in place.

    New URLs:
    http://uptown.esiteful.com/directory/_map_results2?group_1=1|100|2|101|120|78|119|118|117|116|115|114|113|112|111|110|109|108|107|106|105|104|103|102
    http://uptown.esiteful.com/directory/_map_results?group_1=1|100|2|101|120|78|119|118|117|116|115|114|113|112|111|110|109|108|107|106|105|104|103|102&num=20

    Please also keep in mind that template caching is turned on, as well as the cache attribute on the tags. I know the docs say there’s no additional benefit from using both, but I don’t think I’m seeing a benefit from either.

  • #6 / Jun 16, 2011 3:37pm

    Kevin Smith

    4784 posts

    Hey Stephen–

    The second page loads much quicker for me since it loads a small subset of results, so it may be that pagination is required here. That’s a lot of entries you’re loading up, and all that custom code might mean that caching isn’t possible. But first, let’s be sure your ./system/expressionengine/cache/ directory has 777 permissions.

    Now, let’s check to see if page caching is taking place. Go to the cache directory, and delete the ‘page_cache’ directory if it’s there. Now load up the page that you’re testing. Once it’s finished loading, look in the cache directory to see if page_cache is there. If it is, open it, and open the directories inside it until you find that one of the files is the cached version of your template. If you do find it, then page caching is working. If not, the complexity of this template might mean caching the whole thing isn’t possible.

    Now turn off page caching, and let’s focus on tag caching, and the process is very similar. Make sure the ‘tag_cache’ directory doesn’t exist in your cache directory. Load the page. Check to see if the cache for your tag is in that tag_cache directory.

    Post your results back here.

  • #7 / Jun 21, 2011 10:08am

    Stephen Rushing

    40 posts

    Unfortunately, paging is not an option in this case. We’re displaying the locations on a map by category/category group: http://uptown.esiteful.com/dine/map

    The client started with far less locations, but the Shopping category quickly grew, so that’s the one really causing issues: http://uptown.esiteful.com/shop/map

    I deleted my page_cache and tag_cache directories, refreshed, and can verify that the page_cache and tag cache are creating files.

    Even with using the native channel:entries tag, and page/tag caching enabled, the shop results page is taking nearly a minute to load: http://uptown.esiteful.com/directory/_map_results2?group_1=1|100|2|101|120|78|119|118|117|116|115|114|113|112|111|110|109|108|107|106|105|104|103|102

  • #8 / Jun 22, 2011 1:24pm

    Kevin Smith

    4784 posts

    So it looks like caching is actually working. It sounds to me now like you just need to look at optimizing your template. Have you turned on the output profile and template debugger? Those can give you a lot of clues. I’d highly recommend reading and working through the suggestions in Greg Aker’s blog post Troubleshooting Site Performance Issues.

  • #9 / Jun 22, 2011 9:45pm

    Stephen Rushing

    40 posts

    Thanks for the blog post reference. I’ve managed to bring the load time down under 30 seconds with some of those tips.

    Problem is, it still spikes when I hit it in more than one browser window. That obviously won’t cut it for any amount of traffic.

    I’m a little confused about what the caching is doing. If I can turn it off and notice little-to-no performance increase, what’s happening? There’s still the initial load time of EE’s libraries and components, plus the SQL interaction for the template request, etc, but I would expect it to be as fast as loading a template with nothing but static text. Why/how is it that neither template or tag cache shows a major performance increase, ESPECIALLY without optimizing the tags? With a bulky template full of big queries and “advanced” conditionals, that’s where we should see the largest performance boost from caching, right?

  • #10 / Jun 23, 2011 6:27pm

    Wes Baker

    343 posts

    Stephen,

    I’m wondering if your cache directory has the correct permissions and is writable. Open up the cache directory, which is at system/expressionengine/cache/ unless you’ve changed your system directory. Are there any files in there besides index.html? If not, can you tell me what the permissions of that directory are? If you’re unsure how to check, try this command:

    ls -la system/expressionengine/cache/

    And look on the right side of the output for the period, for example:

    → ls -la system/expressionengine/cache   
    total 16
    drwxrwxrwx   5 wes   staff  170 Apr  5 14:22 .
    drwxr-xr-x  26 wes   staff  884 Apr  6 17:09 ..
    -rw-r--r--   1 wes   staff   13 Apr  5 14:22 .htaccess
    drwxrwxrwx   3 _www  staff  102 Apr  5 11:33 ee_version
    -rw-r--r--   1 wes   staff  114 Apr  5 14:22 index.html

    What I’m interested in is that first item in the row with the period, in this case drwxrwxrwx. If it doesn’t look like that, then your cache folder doesn’t have write permissions, so even though you setup caching in your tag pair, it has no place to put the cached information. To correct the permissions, set the permissions using this command:

    chmod 777 system/expressionengine/cache/

    That should fix the permissions and make it writeable. Does that fix it?

    Wes

  • #11 / Jun 27, 2011 3:01pm

    Stephen Rushing

    40 posts

    Yes, the cache directory is writable, and we’ve already verified that the cache files are being written to it. Here’s the output from the ls.

    [root@mt01 httpdocs]# ls -la ee/expressionengine/cache/
    total 28
    drwxrwxrwx 5 esiteful psacln 4096 Jun 26 06:32 .
    drwxr-xr-x 24 esiteful psacln 4096 Apr 26 09:57 ..
    -rwxrwxrwx 1 esiteful psacln   13 Mar 2 06:29 .htaccess
    drwxrwxrwx 2 apache   apache 4096 Dec 23 2010 ee_version
    -rwxrwxrwx 1 esiteful psacln 114 Dec 23 2010 index.html
    drwxr-xr-x 2 apache   apache 4096 Jun 26 06:32 page_cache
    drwxr-xr-x 2 apache   apache 4096 Jun 26 06:32 tag_cache
    [root@mt01 httpdocs]#
    [root@mt01 httpdocs]#

  • #12 / Jun 28, 2011 8:19pm

    Lisa Wess

    20502 posts

    Hi, Stephen,

    Can you go to Admin > Security and Session Preferences > Output and Debugging, and turn on the Profiler as well as Template debugger?  Visit your slow page, then copy and paste that debug information into a text file and attach here.  That should help us see if there’s something suspect in the template.

    Thank you!

  • #13 / Jul 06, 2011 12:13pm

    Stephen Rushing

    40 posts

    Lisa, sorry for the delay. I must have missed the notification for your post.

    I’ve attached the debug info for the map_results2 template.

  • #14 / Jul 06, 2011 1:57pm

    Kevin Smith

    4784 posts

    Thanks for this, Stephen. I’m escalating this to get an opinion on the caching issue from our dev team. While we’re waiting on a response, could you enable page caching again on this template, verify the page cache is being written to the file-system, and then attach the debug info for the same template. That will let us compare the output from the same template when page cache is both enabled and disabled.

  • #15 / Jul 06, 2011 2:45pm

    Stephen Rushing

    40 posts

    The cache actually was enabled on the template with the last debug info I attached. Is there something in the output that indicates it is not? Maybe that’s something…

    I just cleared the page_cache directory and can verify that it is still writing to the file system.

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

ExpressionEngine News!

#eecms, #events, #releases