Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

svn: /php/php-src/ branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c trunk/sapi/fpm/fpm/fpm_process_ctl.c

97 views
Skip to first unread message

Jérôme Loyet

unread,
Aug 30, 2010, 11:21:31 AM8/30/10
to php...@lists.php.net
fat Mon, 30 Aug 2010 15:21:31 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=302886

Log:
- only one process (for all pools) could be killed by the 'dynamic' process manager. Now it's one process per pool which can be killed by the 'dynamic' process manager.
- rename nonsense variable (i)

Changed paths:
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c
U php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2010-08-30 10:27:03 UTC (rev 302885)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2010-08-30 15:21:31 UTC (rev 302886)
@@ -317,13 +317,13 @@
static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct event_base *base) /* {{{ */
{
struct fpm_worker_pool_s *wp;
- struct fpm_child_s *last_idle_child = NULL;
- int i;

for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
struct fpm_child_s *child;
+ struct fpm_child_s *last_idle_child = NULL;
int idle = 0;
int active = 0;
+ int children_to_fork;

if (wp->config == NULL) continue;

@@ -378,11 +378,11 @@
}

/* compute the number of idle process to spawn */
- i = MIN(wp->idle_spawn_rate, wp->config->pm_min_spare_servers - idle);
+ children_to_fork = MIN(wp->idle_spawn_rate, wp->config->pm_min_spare_servers - idle);

/* get sure it won't exceed max_children */
- i = MIN(i, wp->config->pm_max_children - wp->running_children);
- if (i <= 0) {
+ children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children);
+ if (children_to_fork <= 0) {
if (!wp->warn_max_children) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
@@ -392,7 +392,7 @@
}
wp->warn_max_children = 0;

- fpm_children_make(wp, 1, i, 1, base);
+ fpm_children_make(wp, 1, children_to_fork, 1, base);

/* if it's a child, stop here without creating the next event
* this event is reserved to the master process
@@ -401,7 +401,7 @@
return;
}

- zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, i);
+ zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, children_to_fork);

/* Double the spawn rate for the next iteration */
if (wp->idle_spawn_rate < FPM_MAX_SPAWN_RATE) {

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c 2010-08-30 10:27:03 UTC (rev 302885)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_process_ctl.c 2010-08-30 15:21:31 UTC (rev 302886)
@@ -317,13 +317,13 @@
static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct event_base *base) /* {{{ */
{
struct fpm_worker_pool_s *wp;
- struct fpm_child_s *last_idle_child = NULL;
- int i;

for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
struct fpm_child_s *child;
+ struct fpm_child_s *last_idle_child = NULL;
int idle = 0;
int active = 0;
+ int children_to_fork;

if (wp->config == NULL) continue;

@@ -378,11 +378,11 @@
}

/* compute the number of idle process to spawn */
- i = MIN(wp->idle_spawn_rate, wp->config->pm_min_spare_servers - idle);
+ children_to_fork = MIN(wp->idle_spawn_rate, wp->config->pm_min_spare_servers - idle);

/* get sure it won't exceed max_children */
- i = MIN(i, wp->config->pm_max_children - wp->running_children);
- if (i <= 0) {
+ children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children);
+ if (children_to_fork <= 0) {
if (!wp->warn_max_children) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
@@ -392,7 +392,7 @@
}
wp->warn_max_children = 0;

- fpm_children_make(wp, 1, i, 1, base);
+ fpm_children_make(wp, 1, children_to_fork, 1, base);

/* if it's a child, stop here without creating the next event
* this event is reserved to the master process
@@ -401,7 +401,7 @@
return;
}

- zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, i);
+ zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, children_to_fork);

/* Double the spawn rate for the next iteration */
if (wp->idle_spawn_rate < FPM_MAX_SPAWN_RATE) {

0 new messages