# Server Performance Issues Due to High CPU Usage

**URL:** https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279
**Category:** Support
**Created:** [October 29, 2024, 12:02am UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279 "2024-10-29T00:02:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![chulapo](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chulapo](https://meta.discourse.org/u/chulapo)
#### Post date: [October 29, 2024, 12:02am UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/1 "2024-10-29T00:02:14Z")

</div>

I’ve received some complaints from users who occasionally can’t post or create topics. This issue seems to occur randomly, but it may be related to high CPU usage on the server.

Here’s a snapshot from `htop` showing the CPU usage during one of these spikes.

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/5/9/f590eb38a2bc4baaec78166810773f4122fefec1.jpeg)

Each time the CPU usage spikes, I notice the following command running:  
`postgres:13/main: discourse discouse [local] UPDATE`

This occurs every hour (more or less):

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/c/8/4c831115d6a15f0e77257a989935adf6b8ecbb64.jpeg)

Additionally, we’re seeing an increase in logs around the same times, usually coinciding with high CPU usage.

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/6/b/86bc456929ca22d9e8591247e39ce86195b27e93.jpeg)

Could this be a memory or CPU limitation on the server? If anyone has insights into diagnosing or resolving this, I would greatly appreciate your help. Thank you in advance!

---

<div class="post-metadata">

### Author: ![chulapo](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chulapo](https://meta.discourse.org/u/chulapo)
#### Post date: [November 15, 2024, 8:27pm UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/2 "2024-11-15T20:27:04Z")

</div>

Update:  
After upgrading the server, the issue seems to have been minimized.

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/9/6/d965b97645d33db5274f2820c47f2bff50e6a4ec.jpeg)

However, the sames errors still occur every hour while the `postgres:13/main: discourse discourse [local] UPDATE` command is running, which corresponds to the spikes in the chart.

Does anyone have suggestions on what might be causing this and how to resolve it?

---

<div class="post-metadata">

### Author: ![Erzgebirge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erzgebirge/32/486668_2.png) [@Erzgebirge](https://meta.discourse.org/u/Erzgebirge)
#### Post date: [February 5, 2025, 3:31pm UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/3 "2025-02-05T15:31:40Z")

</div>

Same problem here. Almost once every hour you are not able to post anything for 15 to 20 minutes, with a “502 error”.

I don’t know what’s not working

---

<div class="post-metadata">

### Author: ![Andrew\_Rowe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_rowe/32/445877_2.png) [@Andrew\_Rowe](https://meta.discourse.org/u/Andrew_Rowe)
#### Post date: [February 5, 2025, 8:21pm UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/4 "2025-02-05T20:21:22Z")

</div>

Did you recently upgrade?  
Anyhow… here are a couple recent threads with high cpu usage  
rebuilding may help

> [@High CPU usage (Ruby)](https://meta.discourse.org/t/high-cpu-usage-ruby/348913/22):
>
> Yeah fair play to the DC team they are usually very good. If I hadn’t have moved two other forums over I could have been more confident in saying it was related to up update (even though my hunch was saying it probably was) glad you and @markschmucker were on the ball and noticed the increase as well! Welcome to Discourse btw! +1

> [@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/11):
>
> Note, closing the loop, the bug causing it was this: [https://github.com/rubyjs/mini\_racer/commit/edaa9e862abcd9945fbfcdd115d02dd7326569cf](https://github.com/rubyjs/mini_racer/commit/edaa9e862abcd9945fbfcdd115d02dd7326569cf) I updated the gem. One immediate advantage is that it appears this version of v8 uses slightly less memory which is nice.

> [@Post 3.5.1 update - CPU maxed out 100%](https://meta.discourse.org/t/post-3-5-1-update-cpu-maxed-out-100/350530/5):
>
> Rebuild has worked and calmed things down so far. I do not see those postgres process in HTOp or at leat they are not anywhere near the top like before.

---

<div class="post-metadata">

### Author: ![Erzgebirge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erzgebirge/32/486668_2.png) [@Erzgebirge](https://meta.discourse.org/u/Erzgebirge)
#### Post date: [February 18, 2025, 10:21am UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/5 "2025-02-18T10:21:24Z")

</div>

> [@Andrew\_Rowe](#):
>
> Did you recently upgrade?

I did upgrade recently and the same problem appears quite often, every hour or so, as before.

Thank you for sharing those threads, will take a look! 👍

---

<div class="post-metadata">

### Author: ![chulapo](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@chulapo](https://meta.discourse.org/u/chulapo)
#### Post date: [February 23, 2025, 9:27pm UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/6 "2025-02-23T21:27:36Z")

</div>

We have identified the issue. It was caused by the `Discourse reactions like sync` setting. I don’t know if there is a way to avoid it other than disabling it.

> [@Reaction like sync issues](https://meta.discourse.org/t/reaction-like-sync-issues/317584/5):
>
> I don’t know if you were able to fix it, but in our case we also have a lot of posts and likes. For now, we have opted to disable the Discourse reactions like sync because it was causing those CPU peaks every 60 minutes and a lot of 502 errors.

---

<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: [March 25, 2025, 9:28pm UTC](https://meta.discourse.org/t/server-performance-issues-due-to-high-cpu-usage/333279/7 "2025-03-25T21:28:04Z")

</div>

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