Jobs::PeriodicalUpdates is the cause of high CPU (over 100%)

AI-generated summary

The discussion revolves around high CPU usage (over 100%) on a Discourse server after a rebuild, primarily caused by the Jobs::PeriodicalUpdates job, which takes up to 79 seconds to complete. Users report that other jobs like Jobs::AboutStats, Jobs::DestroyOldDeletionStubs, Jobs::DirectoryRefreshDaily, and Jobs::EnsureDbConsistency also contribute to high CPU. The server has 400GB SSD, 16-core CPU, and about 600k topics, with unclear RAM usage. pfaffman suggests a possible bug or resource misconfiguration, while Steven points to rebake_old_posts_count as a likely culprit, noting it’s now hidden. hokod asks how to disable or adjust this setting, but pfaffman clarifies it cannot be turned off and is necessary due to recent changes. qinyj also seeks to make rebake_old_posts_count visible to reduce its value. pfaffman advises checking if discourse-setup was run to optimize resource usage. The consensus is that these jobs are essential, and performance may improve with time or adjustments.

Jobs::PeriodicalUpdates is the cause of high CPU (over 100%)

When we check: sidekiq/scheduler/history

I see, Jobs::PeriodicalUpdates reached 79 secs. Causing the CPU to increase, users accessing the website are out.

Does turning off Jobs::PeriodicalUpdates have any effect? How to turn off?
And, Jobs::AboutStats ; Jobs::DestroyOldDeletionStubs ; Jobs::DirectoryRefreshDaily ; Jobs::EnsureDbConsistency
also causes CPU to go high above 100%

How do I resolve these errors?

What is your hardware, ram, SSD? How big is your database? How many posts?

we have about 600k topics.
400GB SSD, 16 core CPU. About Ram, I don’t see full.

I get these errors when I rebuild discourse (it was fine before rebuild).

Hmm. That is odd. Maybe a bug.

Hope everyone helps.
Can anyone tell me:

in the Jobs::PeriodicalUpdates . task
What do you think this Jobs::PeriodicalUpdates means?
Is it possible to disable Jobs::PeriodicalUpdates?

I think this is the list of tasks used by this job: discourse/app/jobs/scheduled/periodical_updates.rb at 1472e47aae5bfdfb6fd9abfe89beb186c751f514 · discourse/discourse · GitHub

I’m not an expert to analyse this, I see two settings mentionned

  • automatically download gravatars, I don’t thnink it would explain a high CPU usage
  • rebake_old_posts_count this one is now hidden, but maybe you did set up a lot of old posts to rebake every 15 minutes months ago. It would explain this cpu usage a bit more

I see, after 15 minutes, periodicupdates running.

If this is the cause, how can I turn off: rebake_old_posts_count ?

Was the the first upgrade on a long while? I think that you’re likely resizing images due to a change a while back. It’ll work out beeper long.

my last upgrade, was 2.7.x (I don’t remember the exact number of x)

hope someone can help me

You can’t turn it off. There have been changes that require a rebake. If you have enough resources you might be able to adjust things to improve performance.

:slight_smile: I believe there is a way to handle the error,
It’s just that my level of technology is limited.

Did you run discourse-setup after this server had those resources? It may not be making the most use of your resources.

But I’m fairly certain that the jobs that it is doing need to be done, so you don’t want to turn them off.

Now rebake_old_posts_count is hidden, how can I make it visible? I want to decrease the value.