# CPU usage increases steadily

**URL:** https://meta.discourse.org/t/cpu-usage-increases-steadily/356007
**Category:** Support
**Created:** [March 6, 2025, 5:49am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007 "2025-03-06T05:49:41Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 5:49am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/1 "2025-03-06T05:49:41Z")

</div>

I see this Sidekiq CPU usage pattern (the growing part is Sideqik):

 ![This image displays a graph showing the CPU usage percentages of various applications over time, with lines indicating the usage for "apps.plugin," "auditd," "backup," "bash," "boot," and "build," on a computer screen. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/0/a/0/0a021b0c6485df6a2b8513e5150e3ef002db1198.png)

Maybe connected with [Increased CPU Usage since 3.4.0.beta4-dev ( 58f75ed205 ) upgrade](https://meta.discourse.org/t/increased-cpu-usage-since-3-4-0-beta4-dev-58f75ed205-upgrade/350200)?

How should I investigate?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2025, 6:04am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/3 "2025-03-06T06:04:22Z")

</div>

when did you rebuild your container last? if it was a while ago I recommend you rebuild now.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 6:05am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/4 "2025-03-06T06:05:30Z")

</div>

The first usage drop was after the recommended rebuild.  
Last rebuild is one hour old but with same usage pattern.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2025, 6:06am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/5 "2025-03-06T06:06:11Z")

</div>

have you looked at sidekiq, is there a backlog? visit `/sidekiq`

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 6:10am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/6 "2025-03-06T06:10:32Z")

</div>

![The image shows a summary panel with a counter of 37 job applications, 5 candidates interviewed, and various zeroes across different categories, including rejected applicants, candidates in the applicant pool, and job openings. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/6/e/7/6e7760f3f76b58d7fb8386e5b6ab930f5321740c.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2025, 6:14am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/7 "2025-03-06T06:14:01Z")

</div>

```plaintext
./launcher enter app
apt-get update && apt-get install -y htop
htop

```

Is CPU high at the moment?

If it is high, then try to inspect CPU on a process that is running high using:

```plaintext
ps 
top -H -p PID_OF_HIGH_CPU

```

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 6:19am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/8 "2025-03-06T06:19:40Z")

</div>

![The image displays a Unix system running on Mindowski, showing various running processes, system status, and memory usage. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/9/e/7/9e7bf7b9f575fba280550d6aef03ce79a8906f28.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2025, 6:22am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/9 "2025-03-06T06:22:04Z")

</div>

that is not showing any concerning CPU amount, CPU is hovering on zero now across all processes?

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 6:25am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/10 "2025-03-06T06:25:34Z")

</div>

There is no longer running process taking much time.

HTOP shows ever changing CPU utilisation.

Netplan’s stats attribute the raising CPU utilisation to sideqik:

 ![The image shows a graphical audio editing interface with various waveforms and tracks displayed, along with a highlighted section indicating five percent progress. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/6/4/9/649f7b82db4d04461bbff24db4773b5e6b13e650.png)

Is there any profiling tooling for sideqik I could enable?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2025, 6:28am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/11 "2025-03-06T06:28:53Z")

</div>

the key is that you need to catch stuff misbahaving, finding background radiation is super hard.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 6:42pm UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/12 "2025-03-06T18:42:13Z")

</div>

Reading `app/jobs/base.rb` and `MethodProfiler`, I would like to learn if the collected metrics could be saved to a report in an accumulated way (as sums of time spent in different jobs) in a production environment.

I understand that detailed logging can be enabled via `ENV["DISCOURSE_LOG_SIDEKIQ"]`, but I expect this to generate a large amount of data in a production environment.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 6, 2025, 9:29pm UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/13 "2025-03-06T21:29:22Z")

</div>

> [@sam](#):
>
> when did you rebuild your container last?

For two-container do you mean the web container or the database/redis container?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 6, 2025, 9:41pm UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/14 "2025-03-06T21:41:45Z")

</div>

the cpu usage is in the web container, but I would rebuild both just in case.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 6, 2025, 10:34pm UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/15 "2025-03-06T22:34:55Z")

</div>

Sorry for the hassle. The staging site was the culprit. Maildev was not running, so all mails failed. I should sleep more.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [March 8, 2025, 6:01am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/16 "2025-03-08T06:01:49Z")

</div>

I wrote here about what I learned:

> [@Analyze CPU Time Spent in Background Jobs (Sidekiq)](https://meta.discourse.org/t/analyze-time-spent-in-background-jobs-sidekiq/356377):
>
> You can enable Sidekiq logging to collect measurements about time spent in each job via ENV["DISCOURSE\_LOG\_SIDEKIQ"]. The job machinery will write measurements to log/sidekiq.log as [lines of JSON](https://jsonlines.org/), which can easily be summarized via [jq](https://jqlang.org/). To get the total and average time spent in jobs taking more than 5% of the total time: sudo apt update && apt install jq -y jq -s ' group\_by(.job\_name) | map({ job\_name: .[0].job\_name, count: length, total\_duration: (map(.duration) | add…

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 7, 2025, 6:02am UTC](https://meta.discourse.org/t/cpu-usage-increases-steadily/356007/17 "2025-04-07T06:02:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
