Skip to content

Auto number of worker processes, and default number of connections #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

RealOrangeOne
Copy link
Contributor

Description:

Set the number workers automatically based on the number of available cores.

Benefits of this PR and context:

This allows NGINX to better take advantage of multiple cores.

How Has This Been Tested?

Source / References:

https://nginx.org/en/docs/ngx_core_module.html#worker_processes

This allows NGINX to better take advantage of multiple cores.
@aptalca
Copy link
Member

aptalca commented Apr 16, 2020

Thanks for the PR, but this has not been tested extensively in docker.

Also, nginx.conf is fully user configurable, so this can easily be applied runtime.

@aptalca aptalca closed this Apr 16, 2020
@RealOrangeOne
Copy link
Contributor Author

@aptalca

nginx.conf is fully user configurable

it is, however requires the end user to maintain the config file for themselves, which is a lot more effort for the sake of 2 (primarily 1) changes. Could be done by modifying command, but again that's more changes.

this has not been tested extensively in docker.

I'd be interested to know what makes you say this. I've been running it fine in production for years, and default nginx container has exactly these settings:

$ docker run --rm nginx:alpine cat /etc/nginx/nginx.conf
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

Believe that counts as enough testing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants