Welcome! Log In Create A New Profile

Advanced

Re: Auto detect the number of CPU's and set worker_processes

Maxim Dounin
September 17, 2012 05:44AM
Hello!

On Sat, Sep 15, 2012 at 07:55:49PM -0400, justin wrote:

> I am trying to get fancy and have `nginx.conf` auto-detect the number of
> CPU's on the server and then set `worker_processes` to that number. Here is
> what I have:
>
> worker_processes $(cat /proc/cpuinfo | grep "processor" | sort -u | wc
> -l);
>
> Unfortunately, that is throwing an error on nginx start. Is it even possible
> to run shell commands from inside nginx configuration files?

No, it's not currently supported. You may try e.g. make + sed (or
any other templating system) to do this, as well as many other
macro-expansion related things.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Auto detect the number of CPU's and set worker_processes

Anonymous User September 15, 2012 07:55PM

Re: Auto detect the number of CPU's and set worker_processes

Joshua Zhu September 15, 2012 11:50PM

Re: Auto detect the number of CPU's and set worker_processes

Maxim Dounin September 17, 2012 05:44AM

Re: Auto detect the number of CPU's and set worker_processes

Igor Sysoev September 17, 2012 05:56AM

Re: Auto detect the number of CPU's and set worker_processes

Mark Alan September 17, 2012 07:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 309
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready