• At times there are performance issues with our site and I narrowed it down to the Tiny_Plugin::ajax_optimization_statistics method and also the Tiny_Bulk_Optimization::wpdb_retrieve_images_and_metadata method

    Those methods are consuming a significant amount of time, approximately 99.99% of the web transaction’s time.

    Here is part of the trace that

    • Custom/do_action 320.50 s 99.43%
      • Custom/WP_Hook::do_action 320.50 s 99.43%
        • Custom/WP_Hook::apply_filters 320.50 s 99.43%
          • Custom/Tiny_Plugin::ajax_optimization_statistics 320.50 s 99.43%
            • Custom/Tiny_Bulk_Optimization::get_optimization_statistics 320.50 s 99.43%
              • Custom/Tiny_Bulk_Optimization::wpdb_retrieve_images_and_metadata 38.39 s 11.91%
                • Custom/wpdb::get_results 38.39 s 11.91%
                  • Custom/wpdb::query 38.39 s 11.91%
                    • Custom/wpdb::_do_query 38.02 s 11.80%

    This was the query that was taking some time

    SELECT
    				wp_posts.ID,
    				wp_posts.post_title,
    				wp_postmeta.meta_value,
    				wp_postmeta_file.meta_value AS unique_attachment_name,
    				wp_postmeta_tiny.meta_value AS tiny_meta_value
    			FROM wp_posts
    			LEFT JOIN wp_postmeta
    				ON wp_posts.ID = wp_postmeta.post_id
    			LEFT JOIN wp_postmeta AS wp_postmeta_file
    				ON wp_posts.ID = wp_postmeta_file.post_id
    					AND wp_postmeta_file.meta_key = ?
    			LEFT JOIN wp_postmeta AS wp_postmeta_tiny
    				ON wp_posts.ID = wp_postmeta_tiny.post_id
    					AND wp_postmeta_tiny.meta_key = ?
    			WHERE
    				
    				wp_posts.post_type = ?
    				AND (
    					wp_posts.post_mime_type = ? OR
    					wp_posts.post_mime_type = ? OR
    					wp_posts.post_mime_type = ?
    				)
    				AND wp_postmeta.meta_key = ?
    			GROUP BY unique_attachment_name
    			ORDER BY ID DESC
    			LIMIT ? 

    We were compressing new images in the background and I noticed that using that features consumes server resources instead of sending to TinyPNG’s servers to compress, so I switched to “compress new images during upload,” but that also did not resolve the issue.

    Any help or insights would be great, been troubleshooting for some time to find a solution but I have not found one.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tinify

    (@tinify)

    Hi rconklin,

    Thanks for reaching out! And thank you for taking the time to do a little self-investigation. We want to let you know we’re investigating the performance issues you encountered and will notify you once we have an update.

    Thread Starter rconklin

    (@rconklin)

    @tinify thank you for looking into this! This has been a major headache for a little while now and would hate to have to switch image compression methods again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Methods taking a long time’ is closed to new replies.