# UNICORN\_WORKERS vs UNICORN\_SIDEKIQS, DISCOURSE\_DB\_POOL?

**URL:** https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814
**Category:** Self-hosting
**Created:** [3월 31, 2016, 8:32오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814 "2016-03-31T08:32:04Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Caswal\_Parker](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@Caswal\_Parker](https://meta.discourse.org/u/Caswal_Parker)
#### Post date: [3월 31, 2016, 8:32오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/1 "2016-03-31T08:32:04Z")

</div>

Like a lot of people I am wanting to migrate my phpbb3 forum across to discourse. It’s a reasonable sized forum of 38,000 users and 98,000 threads. I have done one trial run and impressed by the import process so far.

The problem is the queued jobs processing time, and reading advice about creating more sidekiqs etc. Just across the posts people seem to be approaching this with different methods (setting workers, sidekiqs etc). I have search around but can’t find any description as to what is best.

Within your app.yml you can set:

`UNICORN_WORKERS`

But what does that set/do compared to setting

`UNICORN_SIDEKIQS`

In one post about increasing SIDEKIQS, it was recommended to increase DISCOURSE\_DB\_POOL as well, do you have to do this if you increase the workers? Or does the workers setting wrap sidekiqs? So what is best practice? Just setting UNICORN\_WORKERS and it works it all out?

I am running my site more old school. (None of this cloud business). So it is a dedicated box:

> Xeon E5-1620v2 4 Physical Cores, 8 Logical Cores, 3.7ghz  
> 64gb Ram  
> 2x2TB Spinny Disks Soft Raid.

The only other thing the box is currently running is an apache2.4 server, covering my wordpress install, and the old phpBB forums.

My current app.yml sets db\_shared\_buffers to 16GB, db\_work\_mem to 40MB.

Thanks for any help, Cheers.

---

<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: [3월 31, 2016, 8:59오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/2 "2016-03-31T08:59:09Z")

</div>

> [@Caswal\_Parker](#):
>
> UNICORN\_SIDEKIQS

This setting will increase the count of processes running the job queue. Each job queue out of the box runs 5 threads (5 concurrent jobs)

Increasing this to say 8, will mean you can run 40 concurrent background jobs. Which may be useful when you are struggling to clear up a job queue post import.

Keep in mind that at some point too much concurrency hurts you and stuff starts getting slower, so you want to play with this a bit to find the right number.

After you clear your job queue it is very rare to need more than 2 unicorn sidekiqs.

---

<div class="post-metadata">

### Author: ![Caswal\_Parker](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@Caswal\_Parker](https://meta.discourse.org/u/Caswal_Parker)
#### Post date: [3월 31, 2016, 9:00오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/3 "2016-03-31T09:00:55Z")

</div>

Thanks, so what does UNICORN\_WORKERS do? Is that processes running the forum itself?

---

<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: [3월 31, 2016, 9:02오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/4 "2016-03-31T09:02:47Z")

</div>

> [@Caswal\_Parker](#):
>
> Is that processes running the forum itself?

yes, that is the number of web workers, aka concurrent web requests the Rails stack can run.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [12월 7, 2017, 3:01오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/5 "2017-12-07T03:01:38Z")

</div>

> [@sam](#):
>
> After you clear your job queue it is very rare to need more than 2 unicorn sidekiqs.

If so, why the default is 5?

> [@sam](#):
>
> Each job queue out of the box runs 5 threads (5 concurrent jobs)

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [2월 23, 2020, 8:28오후 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/6 "2020-02-23T20:28:56Z")

</div>

Sidekiq에서 스레드(작업 큐) 수를 어떻게 변경할 수 있는지 여쭤봅니다.

> [@sam](#):
>
> 기본적으로 각 작업 큐는 5개의 스레드(5개의 동시 작업)를 실행합니다.

---

<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: [2월 23, 2020, 10:20오후 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/7 "2020-02-23T22:20:08Z")

</div>

해당 값을 늘리려면 `DISCOURSE_SIDEKIQ_WORKERS` 환경 변수를 사용하세요.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [11월 21, 2020, 10:28오전 UTC](https://meta.discourse.org/t/unicorn-workers-vs-unicorn-sidekiqs-discourse-db-pool/41814/11 "2020-11-21T10:28:39Z")

</div>


