wordpress high cpu when publishing posts — CyberPanel - WebHosting Control Panel for OpenLiteSpeed
CyberLoader

wordpress high cpu when publishing posts

i wanted to know why the load increases when we hit publish/edit/update ??

I have tried optimizing the database, re-installing of wordpress, removing all unwanted entries in database but does not effect, but the high cpu on publish still remains as long as do any operation in WP admin, the CPU utilization will increase


If there is some expert advise i shall be thankful

Comments

  • What are your server specs, and can you run top using ssh.
  • Type your comment> @Numeriku said:
    > What are your server specs, and can you run top using ssh.

    4core 4ram load average is usually 1.0 ~ 2.5
    But when I publish an article in WordPress, CPU load average up to 8.0 ~ 15, sometimes it is higher enough. When I don't operate on WordPress for a while, it will return to normal

    Top using sees multiple lsphp processes using higher CPU utilization
  • what is the cpu steal.
  • edited December 2019
    Type your comment> @Numeriku said:
    > what is the cpu steal.

    https://i.imgur.com/6OFKNd4.jpg
    I don't know which is steel time you can see this picture
  • > @Numeriku said:
    > what is the cpu steal.

    top - 07:15:32 up 4 days, 11:44, 1 user, load average: 2.25, 2.23, 1.78
    Tasks: 137 total, 2 running, 135 sleeping, 0 stopped, 0 zombie
    %Cpu(s): 14.4 us, 11.3 sy, 13.5 ni, 60.5 id, 0.1 wa, 0.0 hi, 0.1 si, 0.1 st
    KiB Mem : 3880056 total, 522328 free, 890868 used, 2466860 buff/cache
    KiB Swap: 4194300 total, 4095740 free, 98560 used. 2531872 avail Mem
  • Is this happening on only one site, how busy is your site and are you running latest php. Though this sounds like a mysql issue, do you have many posts on your wordpress installation?
  • If there is i would recommend to use redis in conjunction with lscache on your wordpress installation to alleviate.

    Also lastly run this command on ssh, it might be a weak cpu by your provider.

    lscpu
  • Type your comment> @Numeriku said:
    > If there is i would recommend to use redis in conjunction with lscache on your wordpress installation to alleviate.
    >
    > Also lastly run this command on ssh, it might be a weak cpu by your provider.
    >
    > lscpu

    The real-time Uesr of my website range of 150-350, most of which have low CPU utilization when I don't enter WP admin

    cpu is E5 2650 2.0GHZ

    and 0.1 st 10%? or 0.1%?
  • There is quite a large number of users if its real time, i strongly suggest using lscache and use redis for object caching. It will definitely help with the issue that you are having. Even if you do not want to use a caching frontend, the object caching function will help by storing expensive calls to your database and retrieve queries from redis instead of accessing your database directly.
  • edited December 2019
    Type your comment> @Numeriku said:
    > There is quite a large number of users if its real time, i strongly suggest using lscache and use redis for object caching. It will definitely help with the issue that you are having. Even if you do not want to use a caching frontend, the object caching function will help by storing expensive calls to your database and retrieve queries from redis instead of accessing your database directly.

    Okay, I will try Thank you very much for your help!
  • Type your comment> @Numeriku said:
    > There is quite a large number of users if its real time, i strongly suggest using lscache and use redis for object caching. It will definitely help with the issue that you are having. Even if you do not want to use a caching frontend, the object caching function will help by storing expensive calls to your database and retrieve queries from redis instead of accessing your database directly.

    After a few days of testing, it's really obvious to improve the problem. Thank you again for your help! (^u^)
  • edited January 2020
    Type your comment> @Numeriku said:
    > No problem

    I want to ask if memcached is better?,I'll check some information

    Memcached seems to use multiple cores,but redis only uses a single core
    Is it better to use memcached in this case?
  • Type your comment> @rezoooo said:
    > Type your comment> @Numeriku said:
    > > No problem
    >
    > I want to ask if memcached is better?,I'll check some information
    >
    > Memcached seems to use multiple cores,but redis only uses a single core
    > Is it better to use memcached in this case?

    I have no experience with memcached so i can't comment on that.
  • Type your comment> @Numeriku said:
    > Type your comment> @rezoooo said:
    > > Type your comment> @Numeriku said:
    > > > No problem
    > >
    > > I want to ask if memcached is better?,I'll check some information
    > >
    > > Memcached seems to use multiple cores,but redis only uses a single core
    > > Is it better to use memcached in this case?
    >
    > I have no experience with memcached so i can't comment on that.

    okay thanks:)
  • I've seen this issue on popular sites with lots of posts and visitors even when fully optimized. What happens is that all your cache is being rebuilt every time something is published and things get a tad nuts due to this.

    The solution is usually to ensure your setup to use Redis/Memcached and set up Litespeed ESI(Edge Side Includes) in the Litespeed Cache plugin. I typically recommend Memcached but that's just what I'm used to. Redis I hear is pretty amazing too but not have as much experience with that.

    Reference links:
    https://blog.litespeedtech.com/2017/09/06/wpw-esi-and-litespeed-cache/
    https://www.litespeedtech.com/products/features/edge-side-includes
    https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:no-plugin-advanced:esi-support
    https://blog.litespeedtech.com/2017/12/13/wpw-choosing-between-public-cache-private-cache-and-esi/
    https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp

    This also happens with sites with widgets and sidebars with ads. You will want to set it up so these are excluded from being cached as they change frequently with stuff like adwords etc and this will cause tons of CPU use due to queries and rebuilding cache.
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!