0

I have a wordpress article with 50 000 words. After a debug I realised that the CPU is 100% when I read the post / open the category page. I have a quad core server with 8gb ram (the ram level is below 1%), so the problem is the CPU.

I opened putty and entered the command: top

This is the first line:

20961 zzz  20   0  278m  41m 8712 R  100  0.5   0:05.49 php53.cgi

where 100 is the CPU usage.

The page loads after 1 minute.

I searched on google for a solution to this problem and I found this solution: https://wordpress.stackexchange.com/a/43830/21370

The accepted solution for the above link was:

Change the recursion limit to 200x normal, that is, set: pcre.recursion_limit=20000000

Change the backtrack limit to 100x normal, that is, set: pcre.backtrack_limit=10000000

The problem is that it's not working. I changed recursion_limit and backtrack_limit to lower and higher values. But I still got the same problem.

Please give me a solution to my problem. Thanks.

5
  • 1
    What about breaking up the page using some type of pagination like the more tag as one example? May 30, 2014 at 11:29
  • that works, but still, there should be a solution for displaying all the text on one page
    – Rares P.
    May 30, 2014 at 11:44
  • 2
    I just tested creating a post with 50k words of lorem ipsum text, no problem there. Do you have any heavy shortcodes or content filters activated?
    – birgire
    May 30, 2014 at 11:54
  • 1
    Turn off all plugins, switch to one of the Twenty* themes and try it again. Does anything change?
    – kaiser
    May 30, 2014 at 12:25
  • 1
    Are you using shared hosting? May 30, 2014 at 13:08

3 Answers 3

0

Check the number of post revisions for that one 50K word article. While in Edit Page, go to Screen Options and be sure "Revisions" is ticked.

If you have more than one revision, WP is querying the database for that one large post and all revisions, and that will account for some - possibly all - of the CPU spike. The CPU spike is MySQL working on the query to display the article.

Delete some or all of the page revisions. See https://wordpress.org/plugins/revision-control/

And because you have a VPS, try https://github.com/major/MySQLTuner-perl to adjust RAM and cache and other parameters for MySQL. Those can make a huge difference in MySQL performance.

0

Thanks for helping, but the problem is this one:

I have a Magento website and I connected the Wordpress to magento using a plugin, so the problem is this plugin: http://fishpig.co.uk/magento/wordpress-integration/

So it's not using Wordpress's core functions each time..That's why it loads the page so hard and the CPU goes to 100%.

For those who think about using this Magento Plugin, they need to know that it's full of bugs.

-4
  • upgrade your php to php 5.5.
  • switch apache to nginx.
  • enable opcache.
  • install memcached.
  • install w3 total cache plugin.

for easy setup these tools, use https://rtcamp.com/easyengine/installation/

2
  • 3
    Please explain why this answer is helpful. Aside from that: memcache is what was there prior memcached. Use that one instead. Also, using Nginx or Lighttp (or others) instead of Apache does not always come with a performance gain.
    – kaiser
    May 30, 2014 at 14:57
  • also never trust wget -qO ee rt.cx/ee && sudo bash wordpress.stackexchange.com/questions/241909/…
    – prosti
    Oct 7, 2016 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.