# High CPU usage (Ruby)

**URL:** <https://meta.discourse.org/t/high-cpu-usage-ruby/348913>\
**Category:** Product Support\
**Tags:** server-resources\
**Created:** [January 25, 2025, 1:50am UTC](https://meta.discourse.org/t/high-cpu-usage-ruby/348913 "2025-01-25T01:50:40Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [January 28, 2025, 9:57pm UTC](https://meta.discourse.org/t/high-cpu-usage-ruby/348913/9 "2025-01-28T21:57:31Z")

</div>

Take a look at discourse-setup, which handles the scaling for new installs today:

```plaintext
# UNICORN_WORKERS: 2 * GB for 2GB or less, or 2 * CPU, max 8
  if ["$avail_gb" -le "2"]
  then
    unicorn_workers=$(( 2 * $avail_gb ))
  else
    unicorn_workers=$(( 2 * $avail_cores ))
  fi
  unicorn_workers=$(( unicorn_workers < 8 ? unicorn_workers : 8 ))

```

That second statement, using double the number of available cores, is the default on systems with more than 2GB RAM. It looks as though your issue is more down to a tug-of-war between your instances (host resources), rather than a discourse problem.

---

_[View the full topic](https://meta.discourse.org/t/high-cpu-usage-ruby/348913)._
