# Worker process is more than defined?

**URL:** https://meta.discourse.org/t/worker-process-is-more-than-defined/113230
**Category:** Self-hosting
**Tags:** unsupported-install, hosting
**Created:** [April 2, 2019, 1:57pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230 "2019-04-02T13:57:51Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [April 2, 2019, 1:57pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/1 "2019-04-02T13:57:51Z")

</div>

I use discourse\_docker to generate Docker image, then deploy to kubernetes. In my `container/web_only.yml`:

```yaml
env:
  UNICORN_WORKERS: 2

```

However, if I execute `top` in the container, I can see 4 workers:

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/c/6c3b0391039b32ba0de4599c27d287c8b2ce1dbd.png)

Is it out of control, or did I missed something?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 2, 2019, 2:15pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/2 "2019-04-02T14:15:26Z")

</div>

That controle the number of unicorn workers but that isn’t the only thing in the container. We also run sidekiq, nginx, etc. Sidekiq also shows as Ruby in `top` until you press c

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [April 2, 2019, 3:17pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/3 "2019-04-02T15:17:37Z")

</div>

Thank you. I see. So is this the minimum configuration for a low-traffic site? I set a maximum memory usage of 1GB to the container and it got OOM a few times.

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/6/e6f9add3802b94899652cbc75b722cac041d7ad4.png)

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [April 2, 2019, 3:22pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/4 "2019-04-02T15:22:14Z")

</div>

Our recommended configuration is at least 2G of RAM + 2G of swap.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [April 2, 2019, 3:26pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/5 "2019-04-02T15:26:54Z")

</div>

Yeah, I understand. The “recommended” configuration, I guess, is for a real “community”. My instance, however, is only a support forum for my personal project with really low traffic (really). I know bigger RAM can always solve the problem, but it would be great if I can get some ideas on RAM optimization so I don’t have to upgrade my server with actually no need:)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 2, 2019, 3:43pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/6 "2019-04-02T15:43:27Z")

</div>

The minimum is 1GB Ram with 2GB Swap. And if you follow the [official install](https://meta.discourse.org/t/142537?silent=true) guide we automatically set swap for you. Did you get OOM with swap?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 2, 2019, 3:58pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/7 "2019-04-02T15:58:35Z")

</div>

> [@Vencent](#):
>
> some ideas on RAM optimization

You could probably get away with one unicorn (you have two now) and one sidekiq.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [April 2, 2019, 4:04pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/8 "2019-04-02T16:04:26Z")

</div>

> [@RGJ](#):
>
> You could probably get away with one unicorn (you have two now) and one sidekiq.

That is what I’m thinking. Does that mean my whole site will block if a single request is doing I/O (i.e. database read)? I’m not really familiar with the tech details in Discourse but it seems likely to happen.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [April 2, 2019, 4:10pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/9 "2019-04-02T16:10:36Z")

</div>

> [@Falco](#):
>
> Did you get OOM with swap?

No, I disabled swap because my cloud service provider suggests me to. I also heard it’s better to disable swap on a Kubernetes node. Maybe I should try to loose the RAM limit for Discourse and see what happens.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [April 2, 2019, 4:11pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/10 "2019-04-02T16:11:48Z")

</div>

> [@Vencent](#):
>
> No, I disabled swap because my cloud service provider suggests me to.

Well, so that is an unsupported configuration. Good luck with the experiments, but that is not a setup we support.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 2, 2019, 4:16pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/11 "2019-04-02T16:16:17Z")

</div>

> [@Vencent](#):
>
> I also heard it’s better to disable swap on a Kubernetes node.

Yes, but that’s in the same league as “it’s better to have more RAM” .  
And if you don’t have more RAM then you should have swap as a fallback.

> [@Vencent](#):
>
> my whole site will block if a single request is doing I/O (i.e. database read)?

No, it won’t be THAT bad.  
But you said you had really low traffic…

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [April 2, 2019, 4:22pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/12 "2019-04-02T16:22:41Z")

</div>

> [@RGJ](#):
>
> No, it won’t be THAT bad.  
> But you said you had really low traffic…

I’m not a Ruby developer but this is what seems to happen when there is only one thread in one process and the code has no async I/O support.

Yeah, I do have really low traffic. Just asking for curiosity 😁

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [April 2, 2019, 4:31pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/13 "2019-04-02T16:31:20Z")

</div>

> [@Vencent](#):
>
> code has no async I/O support

I’m not sure about Unicorn, I know `thin` has an eventmachine that deals with this.

---

<div class="post-metadata">

### Author: ![Corsterix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/corsterix/32/135849_2.png) [@Corsterix](https://meta.discourse.org/u/Corsterix)
#### Post date: [April 2, 2019, 4:49pm UTC](https://meta.discourse.org/t/worker-process-is-more-than-defined/113230/14 "2019-04-02T16:49:44Z")

</div>

Disabling swap is an extremely bad idea, I suggest you ignore your cloud service provider and get yourself some swap.
