Add worker-cpu-affinity nginx option (#2201)

worker_cpu_affinity is a common optimization method for improving nginx performance, adding this as a custom configuration. Also fix some format issues found during editing.
This commit is contained in:
Oilbeater 2018-03-17 00:32:45 +08:00 committed by Manuel Alejandro de Brito Fontes
parent d27a13223f
commit 41cefeb178
6 changed files with 35 additions and 16 deletions

View file

@ -101,6 +101,10 @@ type Configuration struct {
// By default access logs go to /var/log/nginx/access.log
AccessLogPath string `json:"access-log-path,omitempty"`
// WorkerCpuAffinity bind nginx worker processes to CPUs this will improve response latency
// http://nginx.org/en/docs/ngx_core_module.html#worker_cpu_affinity
// By default this is disabled
WorkerCpuAffinity string `json:"worker-cpu-affinity,omitempty"`
// ErrorLogPath sets the path of the error logs
// http://nginx.org/en/docs/ngx_core_module.html#error_log
// By default error logs go to /var/log/nginx/error.log
@ -492,6 +496,7 @@ func NewDefault() Configuration {
cfg := Configuration{
AllowBackendServerHeader: false,
AccessLogPath: "/var/log/nginx/access.log",
WorkerCpuAffinity: "",
ErrorLogPath: "/var/log/nginx/error.log",
BrotliLevel: 4,
BrotliTypes: brotliTypes,