WPFront
  • Home
  • Plugins
    • Notification Bar Plugin
      • Plugin Ideas
      • Plugin Settings
      • Plugin FAQ
    • Scroll Top Plugin
      • Plugin Settings
      • Plugin FAQ
    • User Role Editor Plugin
      • Plugin Documentation
      • Plugin Settings
      • Plugin FAQ
    • Paddle Gateway Plugin
  • Go Pro
  • Support
    • Documentation
    • FAQ
  • Affiliates
  • Contact
  • Login
  • Cart
  • This topic has 15 replies, 2 voices, and was last updated 8 years, 11 months ago by Syam Mohan.
Viewing 15 posts - 1 through 15 (of 16 total)
1 2 →
  • Author
    Posts
  • May 10, 2016 at 7:16 pm #30633
    Jack Sun
    Participant

    Hello, I had a similar issue before, but you helped me out. But it’s kind of different this time.

    There are about 32 custom roles on my site. And my site has been running pretty slow for the past few months, and I have no idea until the investigation recently. One of my members who has about 10 second roles kept complaining about not able to login in my site. Then I realized multiple roles can make my site running slow by high MySql CPU usage. Is it any possible because the wp_capabilities heavy process issue? Please check the screenshot below which describes the slowness when I, as an admin, working on the backend.

    https://gyazo.com/9962d991c6611aee547faa57a1c3786e

    Please help, and thanks for your effort for such a great plugin.

    May 10, 2016 at 11:18 pm #30667
    Syam Mohan
    Keymaster

    Hi Jack,

    Does the query monitor give any information about the PHP code/function/file that query gets invoked from?

    Thanks

    Syam

    May 11, 2016 at 3:23 am #30696
    Jack Sun
    Participant

    Dear Syam,

    Thanks for your help. I’ve removed two plugins that might cause issues, wordfence & w3-total-cache, and this is the the first part of the screenshot captured after user login. It takes 75 seconds to login, that’s too long.

    I expanded the table column of the Caller, so that should give us the information of where it got stuck.

    https://gyazo.com/518294a9863bc897372bb3874f4a714f

    May 11, 2016 at 7:52 pm #30746
    Syam Mohan
    Keymaster

    Hi Jack,

    If you deactivate the roles plugin, does it make any difference?

    Thanks

    Syam

    May 11, 2016 at 8:19 pm #30748
    Jack Sun
    Participant

    Dear Syam,

    I just give it a try, yes, it makes huge difference. The rendering time of the homepage reduces from 75 seconds to below 1 second.

    May 12, 2016 at 12:52 pm #30813
    Syam Mohan
    Keymaster

    Hi Jack,

    How/Where do you host your site?

    Thanks

    Syam

    May 13, 2016 at 2:42 am #30860
    Jack Sun
    Participant
    This reply has been marked as private.
    May 13, 2016 at 5:25 pm #30901
    Syam Mohan
    Keymaster
    This reply has been marked as private.
    May 13, 2016 at 7:03 pm #30909
    Jack Sun
    Participant

    These are what I run separately on mysql.

    https://gyazo.com/25d19e31e4d2ad51af38ef3e7ee72295

    1. It took 14 seconds to run the first query on mysql.

    2. It took 2.8 second to run the second query on mysql.

    3. Total number –
    wp_post 40,034 rows
    wp_wpfront_ure_post_type_permission 8,764 rows

    4. Yes, it’s still there.

    May 16, 2016 at 10:24 pm #31069
    Syam Mohan
    Keymaster

    Hi Jack,

    Those are not the queries I meant by main and sub query. If you can paste the query here, I’ll separate it for you.

    Thanks

    Syam

    May 25, 2016 at 12:39 pm #31808
    Jack Sun
    Participant

    Sorry for late response. Here are the queries.

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
    FROM wp_posts 
    WHERE 1=1 
    AND wp_posts.post_type = 'post'
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_author = 11061
    AND wp_posts.post_status = 'private')
    AND wp_posts.id NOT IN (SELECT post_id
    FROM wp_wpfront_ure_post_type_permissions
    WHERE role IN ('subscriber','fund_news_members','fund_seminar_members','seminar_basic','seminar_advanced','seminar_deals','seminar_practices','retirement_financial_members')
    AND enable_permissions = 1
    AND has_read = 0
    GROUP BY post_id
    HAVING COUNT(*) = 8) 
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 15
    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
    FROM wp_posts 
    INNER JOIN wp_term_relationships
    ON (wp_posts.ID = wp_term_relationships.object_id)
    WHERE 1=1 
    AND ( wp_term_relationships.term_taxonomy_id IN (865) )
    AND wp_posts.post_type = 'post'
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_author = 11061
    AND wp_posts.post_status = 'private')
    AND wp_posts.id NOT IN (SELECT post_id
    FROM wp_wpfront_ure_post_type_permissions
    WHERE role IN ('subscriber','fund_news_members','fund_seminar_members','seminar_basic','seminar_advanced','seminar_deals','seminar_practices','retirement_financial_members')
    AND enable_permissions = 1
    AND has_read = 0
    GROUP BY post_id
    HAVING COUNT(*) = 8) 
    GROUP BY wp_posts.ID
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 4
    May 27, 2016 at 7:44 pm #31970
    Syam Mohan
    Keymaster

    Hi Jack,

    Try these

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
    FROM wp_posts 
    WHERE 1=1 
    AND wp_posts.post_type = 'post'
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_author = 11061
    AND wp_posts.post_status = 'private')
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 15
    
    SELECT post_id
    FROM wp_wpfront_ure_post_type_permissions
    WHERE role IN ('subscriber','fund_news_members','fund_seminar_members','seminar_basic','seminar_advanced','seminar_deals','seminar_practices','retirement_financial_members')
    AND enable_permissions = 1
    AND has_read = 0
    GROUP BY post_id
    HAVING COUNT(*) = 8
    

    Thanks

    Syam

    May 27, 2016 at 8:04 pm #31972
    Jack Sun
    Participant

    Dear Syam,

    0.0462 sec

    0.0135 sec

    May 29, 2016 at 4:36 pm #32087
    Syam Mohan
    Keymaster

    Hi Jack,

    Can you send me a backup of your DB?

    Thanks

    Syam

    May 29, 2016 at 6:44 pm #32088
    Jack Sun
    Participant
    This reply has been marked as private.
  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 16 total)
1 2 →
  • The topic ‘MySQL is running high CPU usage.’ is closed to new replies.
Log In
Lost Password

Search Topics

Documentation

FAQ
Roles List Add Role Edit Role Delete Role Restore Role Add or Remove Capability Assign/Migrate Users Posts/Pages Extended Permissions Custom Post Type Permissions Navigation Menu Permissions Widget Permissions Admin Menu Editor Media/Attachment File Permissions User Level Permissions Content Restriction Shortcodes Login Redirect Export Roles Import Roles Bulk Edit Settings Multisite Roles List Multisite Add New Role Multisite Edit Role Multisite Delete Role Multisite Restore Role Multisite Sync Roles Multisite Settings WordPress Capabilities Actions and Filters Installation Instructions