Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4891 - trunk/src/core

Anonymous User
October 23, 2012 05:10AM
Author: defan
Date: 2012-10-23 09:08:41 +0000 (Tue, 23 Oct 2012)
New Revision: 4891
URL: http://trac.nginx.org/nginx/changeset/4891/nginx

Log:
Core: the "auto" parameter of the "worker_processes" directive.

The parameter will set the number of worker processes to the
autodetected number of available CPU cores.


Modified:
trunk/src/core/nginx.c

Modified: trunk/src/core/nginx.c
===================================================================
--- trunk/src/core/nginx.c 2012-10-18 14:48:33 UTC (rev 4890)
+++ trunk/src/core/nginx.c 2012-10-23 09:08:41 UTC (rev 4891)
@@ -21,6 +21,8 @@
static char *ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static char *ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
+static char *ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);


static ngx_conf_enum_t ngx_debug_points[] = {
@@ -69,9 +71,9 @@

{ ngx_string("worker_processes"),
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
+ ngx_set_worker_processes,
0,
- offsetof(ngx_core_conf_t, worker_processes),
+ 0,
NULL },

{ ngx_string("debug_points"),
@@ -1329,3 +1331,32 @@

return ccf->cpu_affinity[ccf->cpu_affinity_n - 1];
}
+
+
+static char *
+ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_str_t *value;
+ ngx_core_conf_t *ccf;
+
+ ccf = (ngx_core_conf_t *) conf;
+
+ if (ccf->worker_processes != NGX_CONF_UNSET) {
+ return "is duplicate";
+ }
+
+ value = (ngx_str_t *) cf->args->elts;
+
+ if (ngx_strcmp(value[1].data, "auto") == 0) {
+ ccf->worker_processes = ngx_ncpu;
+ return NGX_CONF_OK;
+ }
+
+ ccf->worker_processes = ngx_atoi(value[1].data, value[1].len);
+
+ if (ccf->worker_processes == NGX_ERROR) {
+ return "invalid value";
+ }
+
+ return NGX_CONF_OK;
+}

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

[nginx] svn commit: r4891 - trunk/src/core

Anonymous User 1055 October 23, 2012 05:10AM

Re: [nginx] svn commit: r4891 - trunk/src/core

Михаил Монашёв 527 October 23, 2012 09:10AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 165
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