Advice needed for Optimization/Slow Site

andypage Member
edited December 2020 in General support

Hi,

I wonder if some kind souls can help speed up our site that is very slow.

We have 29,000 albums and 300,000 images.

We are not adding any more images/albums and it is effectively read only.

Opening the homepage is very slow images.spoilertv.com and then when it does just clicking on Next in the pagination then takes forever. Clicking on Admin takes either around 10 minutes or timesout.

Is there anything we can do to try and improve performance?

  • All Albums have a fixed image ie it's not set to first or more recent.
  • We don't have any extra plugins installed. The ones that are are these (cacheManager, deprecated-functions, rewriteTokens, and security-logger)

With the site being read only is there any thing we can turn off/Disable.

Tech Details

Zenphoto Version : 1.5.7

Apache
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP version: 7.3.25

Server version: 5.7.26-29-log - Source distribution

SQL VARS
memory_limit 768M
post_max_size 256M

Graphics support: PHP GD library 2.2.5 supporting: gif, jpg, jpeg, png, wbmp, webp

Comments

  • acrylian Administrator, Developer

    Zenphoto does not create resized images from the original uploaded on uploading but one request on theme itself. Other than other CMS we don't have real fixed sizes predefined as any theme or plugin can request what it needs itself.

    Please read here about how that works: https://www.zenphoto.org/news/caching/

    If the theme used is setup correctly, you can use the cachemanager to pre-cache these images to speed up the loading.

    You slow site may be the result of uploading too many images at the time and perhaps very large images. This all means work for the server to generate on request then.

    Additionally I recommend to use the static_html_cache plugin for caching the actual pages itself.

    In any case you have a really huge site here so you may also reach server limits as Zenphoto can only be as fast and powerful as the server is naturally.

    More is difficult to tell without seeing the site itself.

  • andypage Member
    edited December 2020

    Thanks. I did post a link :)

    images.spoilertv.com

    If you need any more tech/setup details please let me know.

    We're running basic theme and the only plugins we're using are

    cacheManager, deprecated-functions, rewriteTokens, and security-logger

    Additionally our server is a non-shared server

    8 CPUs, 16 GB RAM, 2000 GB SSD

  • acrylian Administrator, Developer

    Sorry, didn't notice the URL as without protocol the forum does not make it one… Sadly it loads forever indeed.

    Since when does this site exist? You didn't add 29,000 albums and 300,000 images in one go, do you? That likely will overload any server…

    How are the albums organised? Hopefully not all huge top level albums as that naturally requires some calucation for pagination and dividing the iamges per page. If better divide these by organising in smaller subalbums if possible. It's all also filesystem based so that all comes to play as Zenphoto also checks for changes on the file system.

  • Sorry , I forgot to put the full link in.

    The site has been going nearly 10 years. We've not uploaded any new photos for 3-4 months.

    The top level of the site has 24 albums per page, and a total of 43 pages in pagination. So just over 1000 top level albums.

    Screenshot
    https://drive.google.com/file/d/1sg7JHdYVtWBrID9_vvYsaAmjuCuO2UNd/view?usp=drivesdk

  • acrylian Administrator, Developer

    Okay, that looks not that huge by itself. Still if there is a huge nested tree that might be the reason. How many images or sub albums in each album?

    Did you precache all images or accidentally delete d the image cache? This also may happen if you start precaching but stop it or it doesn't run through (there are two options to run it legady way and via curl. Which works best depends on the server).

    Again, if it runs since 10 years. Can you say when it started to be slow? It might also be that your database requires some cleanup after 10 years. That is something outside of Zenphoto and can be done directly via phpmyadmin for example (caution backup first before doing something like this!)

  • Thanks acrylian.

    1) Most top level albums will go 2 Deep in terms of sub-albums. Most follow this structure

    Show Name (top level) ->Season No -> Episode Number

    So a typically show will have on average 4 seasons and each season up to 20 episodes. Each episode will contain between 5 and 50 photos.

    2) I did delete the image cache about 6 months ago when we needed to move to a new server. I'll take a look at maybe restarting the pre-cache again.

    3) As for when it's hard to say. It's slowly been getting worse. I do every 6 months run sql scripts to delete any orphaned images and/or albums from the DB and then run a OPTIMIZE TABLE on the cleaned DBs. The DBS should all be fairly optimized.

    Here is a screenshot from phpmyadmin and the table sizes etc

    https://drive.google.com/file/d/1EDElEICeL3Q5vJJqAqnYAkSjT7Hp-vPd/view?usp=drivesdk

  • acrylian Administrator, Developer

    That sounds well organised

    2) I did delete the image cache about 6 months ago when we needed to move to a new server. I'll take a look at maybe restarting the pre-cache again.

    I think this may be the culprit. Zenphoto now has to re-create any thumb and other sized images. And since you have a huge gallery that is a lot even for the album thumbs itself. Image processing is the most server heavy process. I would suggest to pre-cache again. It may be a lot and will take many hours on your site for sure.

  • Thanks for all the great help/advice, much appreciated.

    The pre-cache process is now underway :)

    https://drive.google.com/file/d/1IlzdmA8js9hJ9UCj60nE2inYJ-Q9AdOP/view?usp=drivesdk

    I'll report back when it completes :smiley:

  • acrylian Administrator, Developer

    Looking forward to it. Also try using the static_html_cache plugin so the pages itself are also cached. That should later on also help speeding up.

  • Awesome, will try that as well.

  • Hi Acrylian.

    I've had some success but wanted to run something past you.

    I'm going via the admin panel and then to cache manager
    ie
    zp-core/zp-extensions/cacheManager/cacheImages.php

    And clicking on the cache images.

    This then whirls away for a while and eventually shows a "Caching Done" message

    Screenshot
    https://drive.google.com/file/d/1XawLM-PI-5GWX0f1VVj5AUmTSkLpcF_I/view?usp=drivesdk

    However It seems the numbers are very low.

    So I ran it again and a similar thing happened. I've been repeating this about 20 times and the numbers see to be fairly consistent.

    Caching done!
    Images processed: 4862/364768
    Albums processed: 4361/33953
    Processing time: 28.5 minutes

    Images processed: 2131/364770
    Albums processed: 1946/34079
    Processing time: 11.52 minutes

    Caching done!
    Images processed: 1532/364970
    Albums processed: 4361/35089
    Processing time: 21.32 minutes

    Caching done!
    Images processed: 1459/364975
    Albums processed: 4361/35097
    Processing time: 21.35 minutes

    Am I doing this right? As when I scroll down a "Caching Done!" message page I am still seeing broken images etc

    Screenshot
    https://drive.google.com/file/d/19SYsvYajElDxGS74Wokaoi9EWEbq12_V/view?usp=drivesdk

    The forum is however speeding up a little to the point where it's not waiting 10 mins before loading a page now.

  • acrylian Administrator, Developer

    You used the legacy way of precaching which does not always manages to get all images in one go. Especialy with so many images you have. Just 11-21 min are by no means enough. You did the right way of running this several times so it will catch those still missing. The precaching basically just does what normally happens on the theme. It also discovers albums not yet in the database freshly. There still might be subalbums missing. You probably have some errors or so in the debug log.

    Also try the newer cURL precaching way on the plugin options to see if this works better for you. As mentioned it does not work properly on some servers for unknown reasons. But on those it does it works more reliably. But be aware it will take many hours for sure and the very huge number of images may still cause it not to do all.

  • Ah that's brilliant. Thanks. Makes perfect sense now.

    I'll give that a try.

  • andypage Member
    edited December 2020

    Sorry Acrylian.

    One quick follow-up question.

    What is the "all sizes for admin" check box in the cache manager screen?

    Screenshot
    https://drive.google.com/file/d/1vgijrN7L5_PEomdq4kZOiJPu72qP75jq/view?usp=drivesdk

    Is it the the thumbnails displayed on the admin dashboard for albums etc

  • acrylian Administrator, Developer
    edited December 2020

    Is it the the thumbnails displayed on the admin dashboard for albums etc

    Yep, that's it.

Sign In or Register to comment.