Slow processing times when not logged in

Hi, found another weird issue, when I am logged in as an admin, the pages are now processed 10x faster in comparison when I am not logged in (and the pages are not cached).

Any ideas, whats causing the slow performance when viewing the (uncached) pages without a logged in user? Can it be connected with the options table somehow?

Comments

  • acrylian Administrator, Developer
    edited December 2025

    Any ideas, whats causing the slow performance when viewing the (uncached) pages without a logged in user? Can it be connected with the options table somehow?

    Well, the full admin gets to see everything without any rights check to items while the normal users does. Of course if the options tables is (still) wrong that has an impact.

    Of course it is not possible to exactly tell what it might be. In 1.6. some inheritance checks of parent/child items have been reworked that were not done properly. Please read the release post about all changes.

  • The performance impact is really huge between admin logged in and a normal page view by a non-logged in user (if the page is not cached), like 10x, 2-3 seconds vs. 0.2 seconds. Wonder what might cause such a big slowdown, it happens on all pages, also very basic ones, like zenpage pages, or even the 404 page is slow, so doubt it's connected with the options table or rights check.

  • acrylian Administrator, Developer

    I really can't say, I am not encountering this on sites I manage. You could very well have other tables with similar issues. Or it is something different. Review you logs for anything that may be related.

  • I finally found the reason for the slow loading times after a long investigation into the matter,

    the main cause is the zp_loggedin function (in functions/functions.php) where an unnecessary database operation takes place every time the function is called, to check whether the administrators table is empty or not ($_zp_db->isEmptyTable('administrators')). This check is not really necessary in my opinion and is performed hundreds of times per page.

    I also use getNumNews and getLatestNews in my theme, which are rather slow operations and also calling zp_loggedin. I have now cached the results of these operations to further improve the performance.

  • acrylian Administrator, Developer
    edited December 2025

    Thanks, zp_loggedin() is called lots of times naturally. I will investigate on that next year. Looks indeed like that is called unnecessary. There was of course a specific reason for that check but in fact I don't exactly remember it anymore why so frequently (or when it was added). In any case the db object should do this check only once and internally cache the result.

Sign In or Register to comment.