• Though page caching for the post index is supposedly built-in, generating the post index page is pounding my database. I’m recording upwards of nearly a 1000 DB queries when someone accesses the AZIndex-generated post index page.

    Any idea why the cached page is not being served? Is the page itself supposed to be static until a new post is added or not?

    If that DB hammering continues, I’ll have to disable the plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey edelen. Sorry I didn’t see your question earlier — I’ve been out of town and very busy on other things since I got back.

    There are a couple of things to keep in mind. AZIndex just caches which posts are included in the index and the order in which they are sorted within the index. This allows AZIndex to avoid having to sort and filter the complete index every time a page from the index is displayed. When a post is changed in a way that it affects it’s place in the index (e.g. the title is changed) then the index is flagged as dirty and the AZIndex cache is rebuilt which can be a very database intensive task. So the current caching does help reduce the load on the database by a large amount for big indexes.

    But (and you knew there had to be a ‘but’) what AZIndex does not currently do is cache the contents of the index pages themselves. Therefore, if you have a 100 posts in your index page, AZIndex has to retrieve the information used in the index from each post — e.g. all the titles, subtitles, and descriptions. So the more entries per page you have in your index, the more database accesses there will be.

    But I did try to be smart about it — the SQL query I use does not retrieve the content of the posts — just the metadata and titles, so there should be no risk of megabytes of data being retrieved for each page access. However, I suspect I can do more to alleviate the situation. I know that WPSuperCache does provide hooks into their code to allow other plugins to use their services. I will certainly take a look at see if I can enhance AZIndex so that it can use their caching facilities. I really don’t want to have to build a more complete caching solution from scratch AZIndex.

    One thing you can do in the meantime which will reduce the database accesses per page is to reduce the number of items you display on one page (if possible). If you only have 20 – 30 items per page, I would be surprised if that puts too much of a load on your server.

    I will check back in a couple of days, so feel free to leave a reply here if you want to.

    Mike
    https://englishmike.net

    Thread Starter edelen

    (@edelen)

    Mike,

    Thanks for responding. Yes, I do use WP-Supercache, so a hook would be nice.

    Thank you for your plugin. As I’ve incorporated it into the core of my blog, I can’t really disable it now. Still, any way to cut down on the database hammering would be great.

    Hi — glad you’re using the plugin successfully ??

    I am just putting the finishing touches to a couple of new features — an option to include child categories and the ability to exclude items with certain categories and tags from an index — and then I will take a look at full page caching. I still have no idea if I can hook WPSuperCache yet, but it’s next on my list to look into.

    Mike

    I just looked into AZIndex’s behavior when WP Super Cache is enabled. To my (pleasant) surprise, index pages are already cached correctly. When you enable WP Super Cache either half-on or full on, then even a multi-page index is cached correctly (i.e. all the pages in the index are cached separately).

    Now, they only go into the regular cache (WP-Cache) not into the super-duper Super-Cache bucket (not sure why yet), but the AZIndex plugin code is not hit at all when those pages are accessed again proving that the cache is working. So if you have caching enabled, you should not be seeing any database access once the pages are in the cache.

    Please let me know if that is not happening for you. The WP-Super-Cache settings page has a counter for the number of pages in each cache, so it should fairly easy to check if the index pages are going into the cache correctly. Once in the cache, the database access should stop on reload of the index page.

    There is one issue I do need to fix. I have code which checks to see if the index might have changed in some way (when a new post is added or an existing one is modified). That currently does not get triggered if the index page is in the cache, so I need to hook into the cache code to ensure that changed will invalidate the cache.

    Mike

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: AZIndex] Not caching the generated page?’ is closed to new replies.