• Hello Everyone

    We are a news site running a WordPress multisite install.
    We get around 1.2 million users a month. We have experience 400% growth in the past 6 months.
    We have 5 editors loading up to 250 posts a day.
    Our database at the moment is sitting at 470.8 MB.

    We have 57288 posts and 14,777 Comments, about 10 custom post types and two more taxonomies besides categories.

    Our problem has been slow queries which causes the database to stop responding and the site subsequently not responding.
    We implemented ‘no_found_rows’ => true and transient in our queries to get rid some of the slow queries.

    However, slow queries continue to be a problem.

    We installed Query Monitor and realised that even WordPress core queries like the default query that load the archives and categories below are running slow:

    SELECT SQL_CALC_FOUND_ROWS wp_18_posts.ID
    FROM wp_18_posts
    INNER JOIN wp_18_term_relationships
    ON (wp_18_posts.ID = wp_18_term_relationships.object_id)
    WHERE 1=1
    AND ( wp_18_term_relationships.term_taxonomy_id IN (35,117,144,145,147,148,151,153,434,435,436,437) )
    AND wp_18_posts.post_type IN ('post', 'afp_feed_article')
    AND (wp_18_posts.post_status = 'publish'
    OR wp_18_posts.post_status = 'private')
    GROUP BY wp_18_posts.ID
    ORDER BY wp_18_posts.post_date DESC
    LIMIT 0, 10

    Here are a few of the queries running slow:

    SELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_18_term_relationships
    ON (wp_posts.ID = wp_18_term_relationships.object_id)
    WHERE 1=1
    AND ( wp_18_term_relationships.term_taxonomy_id IN (161) )
    AND wp_posts.post_type IN ('post', 'afp_feed_article', 'page')
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'private')
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 1
    SELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_18_term_relationships
    ON (wp_posts.ID = wp_18_term_relationships.object_id)
    WHERE 1=1
    AND ( wp_18_term_relationships.term_taxonomy_id IN (162) )
    AND wp_posts.post_type IN ('post', 'afp_feed_article', 'page')
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'private')
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 4
    
    SELECT wp_posts.ID
    FROM wp_posts
    WHERE 1=1
    AND wp_posts.ID NOT IN (101572,130445,103158,130463,129903,112440)
    AND wp_posts.post_type IN ('post', 'afp_feed_article')
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'private')
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 9
    SELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_18_term_relationships
    ON (wp_posts.ID = wp_18_term_relationships.object_id)
    WHERE 1=1
    AND ( wp_18_term_relationships.term_taxonomy_id IN (189) )
    AND wp_posts.post_type IN ('post', 'afp_feed_article', 'page')
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'private')
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 4
    
    SELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_18_term_relationships
    ON (wp_posts.ID = wp_18_term_relationships.object_id)
    WHERE 1=1
    AND ( wp_18_term_relationships.term_taxonomy_id IN (174) )
    AND wp_posts.post_type IN ('post', 'afp_feed_article', 'page')
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'private')
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 4
    
    SELECT wp_posts.ID
    FROM wp_posts
    INNER JOIN wp_18_term_relationships
    ON (wp_posts.ID = wp_18_term_relationships.object_id)
    WHERE 1=1
    AND ( wp_18_term_relationships.term_taxonomy_id IN (186) )
    AND wp_posts.post_type IN ('post', 'afp_feed_article', 'page')
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'private')
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 4

    We really tried beefing up our server infrastructure. Our environment at the moment looks like this:

    – Two Database servers replicating– one for logged in users (read and write), one for visitors – read only.
    – Two load balancers
    – 4 Web servers
    – Varnish cache
    – We are not using W3Total Cache
    Software: Ubuntu, Lampstack (Apache, PHP, MySQL), Nginx

    14 plugins:
    Better WordPress reCAPTCHA
    6 whose function are invoked by plugins
    Mobile detection and switcher
    Image Watermark
    Regenerate Thumbnails
    Video Thumbnails
    UberMenu 2 – WordPress Mega Menu Plugin
    WordPress SEO
    WordPress SEO News
    WP-DBManager
    Akismet
    Gravity Forms
    Gravity Forms Polls Add-On
    Gravity Forms User Registration Add-On
    WP Clean Up

    Had WP Smush.it but uninstalled it because it was making the dashboard slow.

    The question is: Is WordPress ideal for a site our size and the size growing up so rapidly(in terms of size and visitors)? Is there a limit as to the size of a size that WordPress can run optimally?
    If is WordPress is ideal for this kind of a site, how to I set up my environment(infrusture) and my WordPress installation to get the best performance in terms of speed and faster queries.
    Some people have suggested changing hosts and switching to dedicated WordPress hosting like WP-Engine, siteground or flywheel.

    What do I do to solve the slow queries and how do I set up my environment to get the best performance?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Struggling to getting the best performance out of my WordPress news site’ is closed to new replies.