static int min_spare_threads = 0; /* MinSpareThreads */
static int max_spare_threads = 0; /* MaxSpareThreads */
static int active_daemons_limit = 0; /* MaxRequestWorkers / ThreadsPerChild */
-static int active_daemons = 0; /* workers that still active, i.e. are
- not shutting down gracefully */
static int max_workers = 0; /* MaxRequestWorkers */
static int server_limit = 0; /* ServerLimit */
static int thread_limit = 0; /* ThreadLimit */
* Not kept up-to-date when shutdown is pending.
*/
int total_daemons;
-
+ /*
+ * Workers that still active, i.e. are not shutting down gracefully.
+ */
+ int active_daemons;
/*
* idle_spawn_rate is the number of children that will be spawned on the
* next maintenance cycle if there aren't enough idle servers. It is
ap_scoreboard_image->parent[slot].quiescing = 0;
ap_scoreboard_image->parent[slot].not_accepting = 0;
event_note_child_started(slot, pid);
- active_daemons++;
+ retained->active_daemons++;
retained->total_daemons++;
return 0;
}
int child_threads_active = 0;
if (ps->quiescing == 1) {
ps->quiescing = 2;
- active_daemons--;
+ retained->active_daemons--;
}
for (j = 0; j < threads_per_child; j++) {
int status = ap_scoreboard_image->servers[i][j].status;
if (free_length > retained->idle_spawn_rate[child_bucket]) {
free_length = retained->idle_spawn_rate[child_bucket];
}
- if (free_length + active_daemons > active_daemons_limit) {
- if (active_daemons < active_daemons_limit) {
- free_length = active_daemons_limit - active_daemons;
+ if (free_length + retained->active_daemons > active_daemons_limit) {
+ if (retained->active_daemons < active_daemons_limit) {
+ free_length = active_daemons_limit - retained->active_daemons;
}
else {
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, ap_server_conf,
"server is at active daemons limit, spawning "
"of %d children cancelled: %d/%d active, "
"rate %d", free_length,
- active_daemons, active_daemons_limit,
+ retained->active_daemons, active_daemons_limit,
retained->idle_spawn_rate[child_bucket]);
free_length = 0;
}
"spawning %d children, there are around %d idle "
"threads, %d active children, and %d children "
"that are shutting down", free_length,
- idle_thread_count, active_daemons,
+ idle_thread_count, retained->active_daemons,
retained->total_daemons);
}
for (i = 0; i < free_length; ++i) {
ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, ap_server_conf,
"Spawning new child: slot %d active / "
"total daemons: %d/%d",
- free_slots[i], active_daemons,
+ free_slots[i], retained->active_daemons,
retained->total_daemons);
make_child(ap_server_conf, free_slots[i], child_bucket);
}
event_note_child_killed(child_slot, 0, 0);
ps = &ap_scoreboard_image->parent[child_slot];
if (!ps->quiescing)
- active_daemons--;
+ retained->active_daemons--;
ps->quiescing = 0;
/* NOTE: We don't dec in the (child_slot < 0) case! */
retained->total_daemons--;
}
retained->mpm->num_buckets = num_buckets;
- active_daemons = 0;
-
/* Don't thrash since num_buckets depends on the
* system and the number of online CPU cores...
*/