- This topic has 15 replies, 2 voices, and was last updated 8 years, 6 months ago by Syam Mohan.
-
AuthorPosts
-
May 10, 2016 at 7:16 pm #30633Jack SunParticipant
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 #30667Syam MohanKeymasterHi 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 #30696Jack SunParticipantDear 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.
May 11, 2016 at 7:52 pm #30746Syam MohanKeymasterHi Jack,
If you deactivate the roles plugin, does it make any difference?
Thanks
Syam
May 11, 2016 at 8:19 pm #30748Jack SunParticipantDear 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 #30813Syam MohanKeymasterHi Jack,
How/Where do you host your site?
Thanks
Syam
May 13, 2016 at 2:42 am #30860Jack SunParticipantThis reply has been marked as private.May 13, 2016 at 5:25 pm #30901Syam MohanKeymasterThis reply has been marked as private.May 13, 2016 at 7:03 pm #30909Jack SunParticipantThese 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 rows4. Yes, it’s still there.
May 16, 2016 at 10:24 pm #31069Syam MohanKeymasterHi 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 #31808Jack SunParticipantSorry 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 #31970Syam MohanKeymasterHi 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 #31972Jack SunParticipantDear Syam,
0.0462 sec
0.0135 sec
May 29, 2016 at 4:36 pm #32087Syam MohanKeymasterHi Jack,
Can you send me a backup of your DB?
Thanks
Syam
May 29, 2016 at 6:44 pm #32088Jack SunParticipantThis reply has been marked as private. -
AuthorPosts
- The topic ‘MySQL is running high CPU usage.’ is closed to new replies.