Welcome! Log In Create A New Profile

Advanced

Is the auto parameter of the worker_processes directive planned to support the Docker runtime?

Posted by agile6v 
Hi, Maxim Dounin

Currently obtaining the number of CPU cores in Docker actually obtains the
number of CPU cores for the host, resulting in that the number of processes
started by "worker_processes auto" cannot match the CPU resources requested
by the container itself.

For example, if the host has 24 CPU cores and the number of CPU cores
allocated to the container is 4, Nginx will also start 24 worker processes
if the worker_processes auto directive is set, which is not what we
expected.

Is there any plan to support this feature?

Best regards
agile6v

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,279418,279418#msg-279418

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Hello!

On Thu, Apr 12, 2018 at 10:33:36AM -0400, agile6v wrote:

> Hi, Maxim Dounin
>
> Currently obtaining the number of CPU cores in Docker actually obtains the
> number of CPU cores for the host, resulting in that the number of processes
> started by "worker_processes auto" cannot match the CPU resources requested
> by the container itself.
>
> For example, if the host has 24 CPU cores and the number of CPU cores
> allocated to the container is 4, Nginx will also start 24 worker processes
> if the worker_processes auto directive is set, which is not what we
> expected.
>
> Is there any plan to support this feature?

See https://trac.nginx.org/nginx/ticket/1151. If you have a good
solution, consider sharing.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Hi, Maxim Dounin

I submitted a patch that supports the auto parameter of the worker_processes
directive to detect the container environment automatically. Refers to the
JDK implementation: https://bugs.openjdk.java.net/browse/JDK-8146115

If you have time please review it. Thanks.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,279418,279565#msg-279565

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login