WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery Optimizer
[resolved] How to verify NGO is working? Using with W3TC minify (7 posts)

  1. harvitronix
    Member
    Posted 2 years ago #

    Hello,

    Thanks a lot for making this plugin. According to P3 Plugin Profiler, my site is lightning fast with the exception of the NextGen Gallery, which is taking over 4 seconds to load.

    I've installed NGO and I believe I have set it up correctly, but the plugin profiler is still showing a huge load time for NextGen, even when I do a manual scan to avoid any photo gallery pages.

    Settings: I have photo galleries loading with the default [nggallery id=XX] tag. I'm using a custom theme, so in step 1 of the setup, I'm pointing it to the 'galleria' css (since I'm using Galleria for the front-end display). Also, I'm using js/css minify through W3TC; I'm not sure if that's blocking NGO from doing what it needs to do?

    Any help would be greatly appreciated.
    Matt.

    http://wordpress.org/extend/plugins/nextgen-gallery-optimizer/

  2. harvitronix
    Member
    Posted 2 years ago #

    Update: I've removed all the NextGen scripts and stylesheets from minify/combine since I assume that would block NGO from doing its thing, but there is no change in the results.

    Thanks,
    Matt.

  3. Mark Jeldi
    Member
    Plugin Author

    Posted 2 years ago #

    Hi harvitronix,

    Thanks for using NextGEN Gallery Optimizer!

    I've been running some tests, and I'm not really sure why you're seeing such large load times for NextGEN. Do you have a very large collection of galleries/images, at all?

    Running P3 on my development environment, NextGEN takes just 0.0314 seconds to load...1/4 the time WP Core takes, according to the plugin.

    I've performed some query tests also, and it appears NextGEN doesn't make any at all unless called via a shortcode or widget...so I doubt it's a large-query problem if you're seeing high-load on non-gallery pages.

    Yes, it's best to keep NextGEN's scripts and stylesheets away from minification/combining if Optimizer's to only load them where needed...removing them was a good decision. Optimizer doesn't touch NextGEN's code however, so it won't be able to speed up its execution times.

    I would suggest switching to a default theme like Twenty Eleven, switching off all other plugins, and giving it a quick test...just in case there's any hidden calls, conflicts or interaction. If that doesn't help, there might be some sort of php/mysql bottleneck and you may need to assign them more memory/cpu.

    Hope this helps!

    Cheers,
    Mark.

  4. harvitronix
    Member
    Posted 2 years ago #

    Mark,

    Thanks for the response.

    When I disable the NextGen plugin, my load time goes to below 1 second, and my total queries go from about 2,000 to about 150. So the load is for sure happening with NextGen, even in the admin area.

    The template I'm using is fully custom and developed by me, so I can say with almost 100% certainty that there are no calls to the gallery anywhere else, other than on specific post pages.

    I have about 1,000 galleries, so I'm assuming that's the issue. But I'm not too worried if the load time on gallery-specific pages is pretty bad, so long as the load time on all the other pages is fast as expected.

    So I guess, is there any other way to test if NGO is running properly? Or do you think with that many galleries, I should switch gallery plugins all together?

    Thanks again for the help. I really appreciate it.
    Matt.

  5. Mark Jeldi
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Matt,

    I've been doing a whole lot more testing...creating large numbers of galleries, each filled with large numbers of images. However many I add, I still can't get the numbers to jump like yours...so the number of galleries/images you have doesn't seem to be the problem (though there would obviously be some overhead there).

    I would say that insanely large number of queries is key! NextGEN should only fire off one. I'm actually surprised 2000 queries only costs you 4 seconds!

    There's a great plugin called Debug Objects that will help you analyze where they're coming from (it shows admin users the results at the bottom of your front-end pages)...

    http://wordpress.org/extend/plugins/debug-objects/

    For me, running it on a post with a single [nggallery id=x] shortcode (displaying 8 images) returns the following (1 single query for NextGEN)...

    Time: 0.1ms (9.4175338745117E-5s)
    Query: SELECT SQL_CALC_FOUND_ROWS tt.*, t.* FROM wp_ngg_gallery AS t INNER JOIN wp_ngg_pictures AS tt ON t.gid = tt.galleryid WHERE t.gid = 1 AND tt.exclude<>1 ORDER BY tt.sortorder ASC
    Function: nggdb::get_gallery()

    I wonder what you'll get...

    Btw...Optimizer only handles the scripts and styles on the front-end, this is something else entirely.

    Cheers,
    Mark.

  6. harvitronix
    Member
    Posted 2 years ago #

    Mark,

    Thanks a lot for all the help.

    Unfortunately, I can't run Debug Objects on a post page because it times out. But I can run it on non-post pages (so a category page, for instance), and the difference in results is quite strange.

    With NGG turned off, I had 87 queries, page loaded in 1.3 seconds.

    With NGG turned on, I had 86 queries (??), page loaded in 6 seconds.

    Also interesting is that there was no query calling wp_ngg_gallery. I assume there would be on post pages, but since I can't load those pages in debug mode, I can only guess.

    So it seems P3 Plugin Profiler and Debug Objects are at odds when reporting the number of queries, but in agreement when it comes to execution time.

    I'm so confused. Thanks again for the help. I totally understand that this is way out of the scope of your plugin!

    Matt.

  7. Mark Jeldi
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Matt,

    No worries.

    That's quite strange. Perhaps some of your queries are being cached by WordPress (or a plugin), reducing the total count.

    You shouldn't see any queries to wp_ngg_gallery unless there's an actual gallery being called on the page, so that would be the correct behavior.

    There is a possibility that your database tables for NextGEN have been corrupted in some way, which might prolong the execution time. If you want to check your database in isolation, I've tidied up the core query NextGEN uses to fetch all the image data (below), which you can use to check your execution times...

    If you have phpMyAdmin running on your server...just navigate to the correct database, hit the "Query" tab at the top, and enter the following (with 1 being the gallery id you want to retrieve)...

    SELECT SQL_CALC_FOUND_ROWS tt.*, t.* FROM wp_ngg_gallery AS t INNER JOIN wp_ngg_pictures AS tt ON t.gid = tt.galleryid WHERE t.gid = '1'

    Running this on my 8 image example gallery, I get the following...
    Showing rows 0 - 7 ( 8 total, Query took 0.0007 sec)

    While you're there, it might be worth checking/optimizing/defragmenting the three NextGEN tables too...though do make sure to run a backup first.

    Hope this helps!

    Cheers,
    Mark.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic