• Resolved tehfab1

    (@tehfab1)


    I have been trying to figure out why my website is so slow. My journey led me to try a plugin called P3 Plugin Profiler.

    After running several tests it became clear that Shortcodes Ultimate was the source of my website’s trials. When I disabled it the site had a noticeable speed boost. What is going on here? A quick look through the plugin doesn’t appear to show any issues. I only use the youtube advanced, divider, spacer, accordion/spoiler, columns, and table style shortcodes. None of those should make any DB queries at all.

    Here are screenshots of the results:

    With Shortcodes Ultimate active: https://alleysandcorners.com/sfs/SNAG_Program-0024.png

    With Shortcodes Ultimate inactive: https://alleysandcorners.com/sfs/SNAG_Program-0025.png

    Notice the significant improvement in site load time / DB queries between the two tests?

    Is there anything that you know which might cause this?

    The site is https://virtualadministrator.com . Its running on a private VPS which is quite powerful. If you want to connect to look at the site I could arrange for you to have a look.

    Thanks in advanced. I love this plugin a lot but cannot use it if it adds so much to the load on the server :(.

    https://www.ads-software.com/plugins/shortcodes-ultimate/

Viewing 11 replies - 1 through 11 (of 11 total)
  • This person has/had more than 3000 queries:
    https://www.ads-software.com/support/topic/performance-problem-3?replies=3

    I saw your posts and decided to test. But couldnt find any huge problems. Just tested with your shortcodes and this post had 306 mysql queries. With plugin disabled it had 164 queries.

    P3 Profiles had before 254/ after 106 queries.

    Use this plugin to test, it is much better:
    https://www.ads-software.com/plugins/query-monitor/

    With it you can see directly for post page results.

    What content did you put inside your shortcodes ?

    Thread Starter tehfab1

    (@tehfab1)

    Hey thanks for the update! I will give that plugin a try and see if I can narrow it down more.

    Typically the content in the shortcodes is simply text / images. Occasionally I go crazy with it and embed some additional plugins, but mostly its plain text / basic HTML.

    I’ll update shortly with some additional results. Thanks for looking into this with me. Shortcodes Ultimate is the first plugin I install on every site I use, I really would like to avoid trying to replace it if possible!

    I had double more shortcodes per one post than you and just 306 queries.

    Thread Starter tehfab1

    (@tehfab1)

    Ok, I think I’m starting to understand whats going on here. The SQL calls that are going out of control are meta_cache refreshes for users. We have well over 1,000 registered users on our site, so when Shortcodes Ultimate loops through each user and attempts to call the username it turns into a very expensive operation.

    Here is an example:

    SELECT user_id, meta_key, meta_value
    FROM va_usermeta
    WHERE user_id IN (348)
    ORDER BY umeta_id ASC

    The function trail looks like this:

    update_meta_cache()
    get_metadata()
    get_user_meta()
    WP_User->_init_caps()
    WP_User->for_blog()
    WP_User->init()
    WP_User->__construct()
    WP_User_Query->query()
    WP_User_Query->__construct()
    get_users()
    Su_Tools::get_users()
    Su_Data::shortcodes()
    Shortcodes_Ultimate::register()
    do_action('init')

    The Function that causes all the ruckus is in /inc/core/tools.php Line 1307

    public static function get_users() {
    
    		$users = array();
    
    		foreach ( (array) get_users() as $user ) $users[$user->ID] = $user->data->display_name;
    
    		return $users;
    
    	}

    The function is called in /inc/core/data.php Line 4209.

    ~~~~~~~~~~~~

    I commented out the foreach loop and Shortcodes Ultimate went from ~1,500 calls per page load to 3 lol. I don’t use any shortcodes that would rely on Shortcodes Ultimate being aware of what users are on the site so I’m going to leave it commented out for now. However, it might merit looking into a less expensive way to perform that task for websites which have a large number of users.

    Now, as an aside. This site is running Wishlist member. I’m not sure, but it wouldn’t surprise me if this was somehow exacerbating the issue and essentially breaking the user cache. I wonder if Wishlist member is forcing the update_meta_cache() function to run when a user is called to make sure they still have access to restricted areas of the website. I cannot confirm this, though, since like the nice people they are, they encrypted the code of their plugin.

    I wonder if that other guy also has wishlist member installed on his website.

    Probably what needs to be done is simply to write a single command that calls all the user display names at once. There must be a way to do this that side steps this potentially SQL expensive process.

    Your help, though, has been invaluable and I can use the plugin with no problem now! My site is like three times as fast haha.

    Thank you so much. I hope the data I gathered and shared here will be helpful in correcting this issue.

    I dont know man. You and the other person with problem probably use some extended version of plugin, or older one.

    I dont have so much lines in these both files.

    But you are right. I found both parts in files and commented them out. queries went from 306 to 164. It is indeed big problem if you have many users.

    As i can see “This content is for registered users only. Please login.” shortcode is still working with this function disabled. This is god one.

    PS: I dont use any cache plugin right now.

    Yes, it is it exactly. 306 – 164 = my 142 users.

    So Bbpress forum with thousands users = oh my God. ??

    Thread Starter tehfab1

    (@tehfab1)

    Yeah, crazy.

    I don’t know why the line numbers don’t match up. The plugin was installed through the Plugin installer in wordpress. Maybe something was funky with Notepad++ or something.

    Plugin Author Vova

    (@gn_themes)

    Hey all,

    this bug has been fixed in 4.7.0. New version will be available in next few days.

    Thanks for reports!

    Plugin Author Vova

    (@gn_themes)

    in this plugin when we add boexes … we got option to edit colors of box and Font … but there should be option for font Size … and a option need like CENTER , Right Side , Left Side BUTTON … Then we can keep that TExT in CENTER of Box or reight side or left side !!

    Hey Vladimir,

    I’m still having a huge query problem on my site. My recent query report shows SU making 1440 query calls; again, this is about the number of users we have.

    I’m hoping the user query can still be removed as easily as expressed above.

    Highest Regards,
    Adam Apollo

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Plugin making 700 SQL Calls?’ is closed to new replies.