How to to decrease the resource usage

Hi,
Yesterday I got my Semi-dedicated (SDX) server blocked my zenphoto scripts.
The reason why was (according to them) ...
running various CPU intensive php scripts which are causing very high load on the server and due to which server is going under very high load. Please have a look at the follow details about your php scripts running in parallel.
%CPU 104 - /opt/cpanel/ea-php56/root/usr/bin/php-cgi /home/xxxxxxx/public_html/gallery/index.php
After many discussion, they told me ... to check and optimize the code to decrease the resource usage
I never experienced that kind of problem before.
Is there a way to do that in the zenphoto script ?
I am running the latest version of the script.
It was probably a one shot event that triggered the server to block the php script, but they were not smart enough to unblock it later on to see if the problem is gone!
Thanks for your input

Comments

  • acrylian Administrator, Developer

    Sorry for your trouble. You probably have too many and too large images to process. Or maybe a traffic peak for some reasons? That is the only thing that can eat up resources.

    Measure are therefore:

    • Don't upload to big photos. Dimensions NOT file size. Take a look here: http://www.zenphoto.org/news/problems-with-albums-and-images/
    • Pre-cache images using the cacheManager plugin. However it will only work if the theme used uses default image sizes or registeres them properly. Official themes do that.
    • Disable random album thumbnails for albums (setting on each album) to set fixed one. This disables random rotating on each page load which frequently might result in uncached images that need processing.
    • User the static html cache plugin to limit processing.
    • If all doesn't help, get a faster server……

    More on how caching works:
    http://www.zenphoto.org/news/caching/

  • normcdn Member
    edited November 2017

    It is probably the case ... a traffic peak.
    BTW I am the only one using the scripts meaning all phots are mine. There are no users registered. So I control everything I upload like ...
    1. all my photos are 600x450 pixels max.
    2. I always use the cachemanager plugin after each uploads.
    3. Recently, I changed the random thumbnail to use fixed one, but I may be have some albums left random. I will check them eventually.
    I have been using zenphoto on this server for years without any problems. It is mostly a one shot peak, but these people at JaguarPC blocked the php scripts immediately and I had to fight to get it back online.
    I saw something interesting in my phpbb forum admin module about load settings. Here is the description ...
    [If the system’s 1-minute load average exceeds this value the board will automatically go offline. A value of 1.0 equals ~100% utilisation of one processor. This only functions on UNIX based servers and where this information is accessible. The value here resets itself to 0 if phpBB was unable to get the load limit]
    I never used it, but it looks interesting. Will it work on Linux ?
    Do you know if I can do that in zenphoto ? That would be great to prevent overloading CPU automatically and restored it when it goes down.
    Thanks

  • acrylian Administrator, Developer

    That looks good so far. I would recommend to use the static_html_cache plugin as well as that limits the php processing as well.

    I know we had in the past trouble with traffic peaks caused by primarily spam attemp traffic. Maybe that was what was happening. I can only assume to keep an eye on this.

    I fear I cannot really answer the question about that server internal function as I don't setup my own servers. But you can certainly try that. More than not working can't happen I guess. You're host may be able to help and assist in their own interest.

    Besides, Zenphoto certainly works on Linux based servers, our own site does.

  • I will activate the static html cache plugin in all my gallery.
    Is there a chance in the future you will be able to add that kind of module in zenphoto ? (go offline during high peak demand).
    Many thanks!

  • acrylian Administrator, Developer
    edited November 2017

    I fear I don't think so. I am not even sure this is something Zenphoto itself can do via PHP. This might be something you need to do a level lower on the server itself.

  • I found that watermarking bogged the uploader and caused server errors. Well, I had been having upload server errors and turning off the automatic watermarking, has solved my issue (OK today, but will inform if that changes)

  • acrylian Administrator, Developer

    Without the actual error message we cannot really say anything but I assume memory errors? THose are likely on "smaller" servers since processing watermarks on large images can be memory intensive.

Sign In or Register to comment.