printLatestUpdatedAlbums generate sql error

Hey all,

I was digging through the forum and didn't find related issues.
I'm running about 70k+ images and 1732 albums. Everything works great once all the images cache. Pages loads less than 5 seconds. I wanted to add latest updated albums to index page using the code below but it triggered two issues

<?php printLatestUpdatedAlbums(4, false, false, false, false,false,230,false,false); ?>

one, page load increase from < 5 seconds to 12 seconds ~ higher
two, zenphoto generated mysql error.

Zenphoto error

MySQL Query (Select id, title, folder, thumb FROM 'flava_albums' WHERE 'show'=1) failed.
Error:MySQL server has gone away. it looks like your zenphoto tables haven't been created. you may need to run the setup script.

i ran the setup again but the remedy still exist.

below is the installation information from zen overview page

Zenphoto version 1.2.6 [4335] (Official Build)
Current gallery theme: flavalocal
PHP version: 5.2.6
Graphics support: PHP GD library bundled (2.0.34 compatible)
PHP memory limit: 1024M (Note: Your server might allocate less!)
MySQL version: 5.0.67
Database name: flava
Table prefix: flava_
Spam filter: simple
Captcha generator: zenphoto

What did i miss?

Comments

  • acrylian Administrator, Developer
    The function call seems not correct to me. You set some parameters to "false" which are not boolean.
    `
    printLatestUpdatedAlbums(4, false, false, false, false,false,230,false,false) (yours)
    printLatestUpdatedAlbums(5, false, false, false, 40,'',230,230,false) (correct)
    `
    The "40" does nothing if you set the description display to false also the 230 for height.
  • Your mysql error seems to be saying that the MySql server did not complete its query. There is actually nothing wrong with the query itself, but it will of course return an entry for every published album.

    1732 albums does not sound like a lot, maybe the server you are running MySQL on is not adequate for your gallery.
  • acrylian Administrator, Developer
    I have to correct myself, it is surely not how you set the options. I confused myself with the long parameter list. The reaason might lie in your quite big site and some code of that function not really optimized.
  • @acrylian - you're correct i did set false ($showdesc) which is not boolean.
    so below is the final parameters
    printLatestUpdatedAlbums(4, false, false, false, false,'',230,230,false);
    Currently, I'm using default theme and testing it locally. Index page contains 8 parents categories (each of these categories don't use random album cover, this help load time a bit) Below is the printLatestUpdatedAlbums(), that's it.
    like i said above without using printLatestUpdatedAlbums(); the page load faster.

    @sbillard - I'm aware that there's nothing wrong with query. I saw some people running more albums on production and it's stable. By the way, Can you elaborate a little bit, which settings do i need to change? should i bump up php memory limit? should i create a different server just to host mysql?
  • Sorry, I am not expert on MySQL. I use a hosted provider and they do the MySQL setup, etc. For me everything with MySQL just works correctly with no real performance issues.

    The page will of course load faster without the printLatestUPdatedAlbums() because there is a bit of processing that function needs to do. However, I did take a look at the code and did some optimizations. You could try tonight's nightly build and see if it helps. But the actual query of the error stays as it is necessary.
  • Thank you acrylian and sbilliard , I'll try tonight nightly build.
    Earlier, I found a solution to improve loading time by using http compression and expires header.

    I added this code to .htaccess

    Header unset ETag

    FileETag None
    <FilesMatch "(?i)^.*\.(ico|jpg|jpeg|png|gif|js|css)$">
    Header unset Last-Modified
    Header set Expires "Fri, 21 Dec 2014 00:00:00 GMT"
    Header set Cache-Control "public, no-transform"
    </FilesMatch>

    AddOutputFilterByType DEFLATE text/html text/plain text/xml

    <FilesMatch "\.(php|html|js|css)$">
    SetOutputFilter DEFLATE
    </FilesMatch>

    YSlow score 71 or equal to C (originally the score was 52 or equal to E, lol)
    Loading time went down from ~15 seconds to 7 - 9 seconds
  • @sbilliard - So i sync up with the latest nightly build (Zenphoto version 1.2.6 [4732]).
    i can tell the difference that the page load faster compare to before but there's a problem. Right now is rendering the parent category instead of rendering latest/newest albums. Should i printLatestAlbums instead of printLatestUpdatedAlbums?
  • acrylian Administrator, Developer
    Just to clarify the differences:
    - printLatestAlbums refers to the latest created/uploaded albums
    - printLatestUpdatedAlbums refers to those albums that have got new images or subalbums. These could of course be quite old albums.
  • Thanks for the clarification Malte.
    Current stable version display printLatestUpdatedAlbums the same like printLatestAlbums.
    It's a bit confusing.
  • acrylian Administrator, Developer
    Are all albums shown maybe new then it would naturally show the same as the latest created album is also the latest updated album. If not we may have a bug.
  • Yes all the albums shown, It's a strange behaviour when both functions rendering the same thing. It may be a bug.

    By the way, the page is loading faster now. I didn't realize there's an html cache plugin. lol. It speeds up the loading like crazy. Thank you for this plugin.
  • acrylian Administrator, Developer
    Please try the nightly build as we have done some optimizations yesterday to both stats.
  • Malte... this is awesome. Now I can see the difference between these two functions.
    printLatestAlbums render the latest albums from each of parents categories and printLatestUpdatedAlbums render the parent of each updated subalbums.
  • acrylian Administrator, Developer
    To be fair, actually sbillard did those optimizations..:-)
  • Thank you to both of you guys. ;)
Sign In or Register to comment.