# Unknown directive "thread\_pool"

**URL:** <https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104>\
**Category:** NGINX\
**Created:** [May 27, 2015, 2:23pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104 "2015-05-27T14:23:31Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 27, 2015, 2:23pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/1 "2015-05-27T14:23:31Z")

</div>

Hi  
First time trying aio threads on linux, and I am getting this error

[emerg] 19909#0: unknown directive “thread\_pool” in  
/usr/local/nginx/conf/nginx.conf:7

Line7 reads:  
thread\_pool testpool threads=64 max\_queue=65536;

Everything indicates it was built --with-threads, so I’m not sure where  
to go from here

nginx -V:  
/usr/local/nginx/sbin/nginx -V  
nginx version: nginx/1.9.1 built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1)  
configure arguments: --with-debug --with-file-aio --with-threads

from configure output:  
Configuration summary

- using threads

Any help appreciated  
Thanks  
Richard

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [May 27, 2015, 3:34pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/2 "2015-05-27T15:34:50Z")

</div>

Hi Richard,

Do you have an Ubuntu package for Nginx installed also (usually  
installed in /usr/sbin)? Depending on how you are starting it the wrong  
executable may be being used.

Kind Regards  
Andrew

> Everything indicates it was built --with-threads, so I’m not sure where to go  
> from here  
> Thanks  
> Richard
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

–  
Andrew H. (LinuxJedi)  
Senior Developer Advocate  
Nginx Inc.

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [May 27, 2015, 4:57pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/3 "2015-05-27T16:57:50Z")

</div>

Thanks Andrew  
I figured this out but it was not a duplicate binary  
It was because I was issuing -HUP to reload nginx rather than proper  
start/stop :-[

Cheers  
Richard

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [May 27, 2015, 9:27pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/4 "2015-05-27T21:27:16Z")

</div>

Ah! That was my next guess. I’m glad you sorted it. If you have this  
problem again there is a way to do a rolling upgrade without a  
start/stop, see this link for more info:

> **[Controlling nginx](http://nginx.org/en/docs/control.html#upgrade)**
>
> nginx can be controlled with signals. The process ID of the master process is written to the file /usr/local/nginx/logs/nginx.pid by default. This name may be changed at configuration time, or in nginx.conf using the pid directive. The master process...

Kind Regards  
Andrew

> > Hi Richard,
> > 
> > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

–  
Andrew H. (LinuxJedi)  
Senior Developer Advocate  
Nginx Inc.

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 2:12pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/5 "2015-06-24T14:12:08Z")

</div>

Добрый день.  
Не понятно мне, куда помещать настройку по пулам.

# uname -orm

FreeBSD 10.1-RELEASE-p12 amd64  
nginx -v  
nginx version: nginx/1.8.0  
nginx собран с оцией --with-threads  
Далее.  
nginx.conf в секцию http добавил:  
thread\_pool one threads=32;  
thread\_pool cen threads=32;  
После делаю проверку.

# nginx -t

nginx: [emerg] “thread\_pool” directive is not allowed here in  
/usr/local/etc/nginx/nginx.conf:46  
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed  
Как в инструкиях сказано, что в секцию http добавляется настройка по  
пулам,  
а после проверки конфига мне говорится, что опции theread\_pool тут не  
место.  
Как быть в этом случае.  
Хочу реализовать отдачу картинок на обном из нагруженных проектов.  
И есть ли смысл использовать пулы от nginx на системе FreeBSD 10.1 ?

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,259166,259836#msg-259836](http://forum.nginx.org/read.php?2,259166,259836#msg-259836)

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 3:07pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/6 "2015-06-24T15:07:03Z")

</div>

I am not sure you need threads with freebsd because it has native aio  
support.

2015-06-24 15:11 GMT+03:00 bagas [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 3:33pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/7 "2015-06-24T15:33:21Z")

</div>

То-есть, на системе FreeBSD смысла нет использовать пул потоков от  
nginx?  
Про пул от nginx мало информации и примерров.

Posted at Nginx Forum:

> **[Re: unknown directive "thread\_pool"](https://forum.nginx.org/read.php?2,259166,259845#msg-259845)**
>
> Hi First time trying aio threads on linux, and I am getting this error \[emerg\] 19909#0: unknown directive "thread\_pool" in /usr/local/nginx/conf/nginx.conf:7 Line7 reads: thread\_pool testpool threads=64 max\_queue=65536; Everything i

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 3:39pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/8 "2015-06-24T15:39:46Z")

</div>

> <https://serverfault.com/questions/476765/how-do-i-enable-aio-on-nginx-on-freebsd>

Just add ‘aio on;’ instead of ‘aio threads;’.  
Also you should compile nginx without threads.

2015-06-24 16:32 GMT+03:00 bagas [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 4:03pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/9 "2015-06-24T16:03:44Z")

</div>

У меня aio работает, оно помоему по умолчанию до 1,9 ветки.  
Я прописывал в локейшены свои aio threads; но это стандартно, хотелось  
для  
каждого проекта сделать свой пул.

Posted at Nginx Forum:

> **[Re: unknown directive "thread\_pool"](https://forum.nginx.org/read.php?2,259166,259851#msg-259851)**
>
> Hi First time trying aio threads on linux, and I am getting this error \[emerg\] 19909#0: unknown directive "thread\_pool" in /usr/local/nginx/conf/nginx.conf:7 Line7 reads: thread\_pool testpool threads=64 max\_queue=65536; Everything i

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 5:37pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/10 "2015-06-24T17:37:12Z")

</div>

On Wed, Jun 24, 2015 at 08:11:28AM -0400, bagas wrote:

> Добрый день.

“unknown directive” != “directive is not allowed here”

> Не понятно мне, куда помещать настройку по пулам.

> **[Основная функциональность](http://nginx.org/ru/docs/ngx_core_module.html#thread_pool)**
>
> Задаёт имя и параметры пула потоков, используемого для многопоточной обработки операций чтения и отправки файлов без блокирования рабочего процесса.

“”"  
Контекст: main  
“”"

nginx.conf:

# == thread\_pool …; events { } http { server { } }

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 3:40pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/11 "2015-06-24T15:40:57Z")

</div>

RTFM 🙂 [Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#aio)

2015-06-24 16:39 GMT+03:00 Anatoli M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 5:55pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/12 "2015-06-24T17:55:19Z")

</div>

Hi Francis,

it seems that you start to learn Russian! 🙂

On 6/24/15 6:36 PM, Francis D. wrote:

> # Контекст: main } }
> 
> f

Valentin wrote a good blog post about threads:

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

There is a complete and simple configuration in the “Configuring  
Thread Pools” section, near the end of the post.

Also, there is a russian version of this article on [habrahabr.ru](http://habrahabr.ru).

–  
Maxim K.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 6:04pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/13 "2015-06-24T18:04:40Z")

</div>

On Wednesday 24 June 2015 09:32:45 bagas wrote:

> То-есть, на системе FreeBSD смысла нет использовать пул потоков от nginx?  
> Про пул от nginx мало информации и примерров.

You should use native AIO on FreeBSD instead.

See: [NGINX | F5](http://nginx.com/blog/thread-pools-boost-performance-9x/)  
or in Russian: [Пулы потоков: ускоряем NGINX в 9 и более раз / Habr](http://habrahabr.ru/post/260669/)

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 7:19pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/14 "2015-06-24T19:19:27Z")

</div>

Это я все понимаю.  
Спасибо за содействие.

Posted at Nginx Forum:

> **[Re: unknown directive "thread\_pool"](https://forum.nginx.org/read.php?2,259166,259872#msg-259872)**
>
> Hi First time trying aio threads on linux, and I am getting this error \[emerg\] 19909#0: unknown directive "thread\_pool" in /usr/local/nginx/conf/nginx.conf:7 Line7 reads: thread\_pool testpool threads=64 max\_queue=65536; Everything i

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 24, 2015, 7:18pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/15 "2015-06-24T19:18:17Z")

</div>

Спасибо.  
На хабре же я и прочитал твою статью, сделал как у тебя а в этоге фиг.  
)  
Пока отложу настройку пулов, пусть используются родные фряхины.

Posted at Nginx Forum:

> **[Re: unknown directive "thread\_pool"](https://forum.nginx.org/read.php?2,259166,259871#msg-259871)**
>
> Hi First time trying aio threads on linux, and I am getting this error \[emerg\] 19909#0: unknown directive "thread\_pool" in /usr/local/nginx/conf/nginx.conf:7 Line7 reads: thread\_pool testpool threads=64 max\_queue=65536; Everything i

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 25, 2015, 7:21pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/16 "2015-06-25T19:21:54Z")

</div>

On Wed, Jun 24, 2015 at 06:55:05PM +0300, Maxim K. wrote:

Hi there,

> it seems that you start to learn Russian! 🙂

That’s the joy of machine translation 🙂

I hope I didn’t end up answering the wrong question.

> Valentin wrote a good blog post about threads:
> 
> [NGINX | F5](http://nginx.com/blog/thread-pools-boost-performance-9x/)
> 
> There is a complete and simple configuration in the “Configuring  
> Thread Pools” section, near the end of the post.

Thanks for the pointer; I’ve had a read through it. It looks  
generally good – but it does show the thread\_pool directive  
at http level: possibly either that or the documentation at  
[Core functionality](http://nginx.org/en/docs/ngx_core_module.html#thread_pool) should be  
updated to be consistent?

I think the original poster has the answers wanted – thread\_pool goes  
outside http, and probably isn’t needed on FreeBSD for file reads –  
so it all looks good.

Cheers,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 26, 2015, 9:23am UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/17 "2015-06-26T09:23:05Z")

</div>

On 6/25/15 8:21 PM, Francis D. wrote:

> > Valentin wrote a good blog post about threads:  
> > updated to be consistent?

Good catch. It should be fixed. Thanks.

> I think the original poster has the answers wanted – thread\_pool goes  
> outside http, and probably isn’t needed on FreeBSD for file reads –  
> so it all looks good.
> 
> Cheers,
> 
> f

–  
Maxim K.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [June 30, 2015, 4:53pm UTC](https://www.ruby-forum.com/t/unknown-directive-thread-pool/242104/18 "2015-06-30T16:53:31Z")

</div>

On Friday 26 June 2015 10:22:59 Maxim K. wrote:

> > [Core functionality](http://nginx.org/en/docs/ngx_core_module.html#thread_pool) should be  
> > updated to be consistent?
> 
> Good catch. It should be fixed. Thanks.

Fixed. Thank you, Francis.

wbr, Valentin V. Bartenev
