High CPU usage (Ruby)

Pretty frequently seeing high CPU usage and it’s usually around the 85% mark:

Was previously showing up as unicorn.conf.r:

Could this indicate UNICORN_WORKERS being set too high/low?

The server has 64GB RAM (usually shows around 40GB free) and 6 cores, there are 4 Discourse instances on the server each set to UNICORN_WORKERS: 8

Any ideas or tips on what’s causing it or what to try? (One of the forums is in read-only mode and doesn’t get much traffic, should it be set to have fewer workers?)

1 Like

I don’t know but my bet is you are using way more workers than what your cores can offer?

1 Like

Yep. I also suggest decreasing the number of unicorn workers:

2 Likes

You could try reducing unicorn workers.

2 Likes

Thanks for the replies everyone - not sure where I read it now but I always thought we were to set 2 workers per core. I’ve dropped the workers down now per forum, allocating more to the busiest forums and less to the ones not as busy. I’ll monitor things over the next week and report back if it hasn’t help.

1 Like