if (idle < wp->config->pm_min_spare_servers) {
if (wp->running_children >= wp->config->pm_max_children) {
if (!wp->warn_max_children) {
+ fpm_status_increment_max_children_reached(wp->shm_status);
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;
}
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) {
+ fpm_status_increment_max_children_reached(wp->shm_status);
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;
}
}
/* }}} */
+void fpm_status_increment_max_children_reached(struct fpm_shm_s *shm) /* {{{ */
+{
+ struct fpm_status_s status;
+
+ if (!shm) shm = fpm_status_shm;
+ if (!shm || !shm->mem) return;
+
+ /* one shot operation */
+ status = *(struct fpm_status_s *)shm->mem;
+
+ status.max_children_reached++;
+
+ /* one shot operation */
+ *(struct fpm_status_s *)shm->mem = status;
+}
+/* }}} */
+
+void fpm_status_update_max_children_reached(struct fpm_shm_s *shm, unsigned int max_children_reached) /* {{{ */
+{
+ struct fpm_status_s status;
+
+ if (!shm) shm = fpm_status_shm;
+ if (!shm || !shm->mem) return;
+
+ /* one shot operation */
+ status = *(struct fpm_status_s *)shm->mem;
+
+ status.max_children_reached = max_children_reached;
+
+ /* one shot operation */
+ *(struct fpm_status_s *)shm->mem = status;
+}
+/* }}} */
+
void fpm_status_update_activity(struct fpm_shm_s *shm, int idle, int active, int total, int clear_last_update) /* {{{ */
{
struct fpm_status_s status;
}
spprintf(output, 0,
- "accepted conn: %lu\n"
- "pool: %s\n"
- "process manager: %s\n"
- "idle processes: %d\n"
- "active processes: %d\n"
- "total processes: %d\n",
- status->accepted_conn, fpm_status_pool, status->pm == PM_STYLE_STATIC ? "static" : "dynamic", status->idle, status->active, status->total);
+ "accepted conn: %lu\n"
+ "pool: %s\n"
+ "process manager: %s\n"
+ "idle processes: %d\n"
+ "active processes: %d\n"
+ "total processes: %d\n"
+ "max children reached: %u\n",
+ status->accepted_conn, fpm_status_pool, status->pm == PM_STYLE_STATIC ? "static" : "dynamic", status->idle, status->active, status->total, status->max_children_reached);
spprintf(content_type, 0, "Content-Type: text/plain");
}
"<tr><th>idle processes</th><td>%d</td></tr>\n"
"<tr><th>active processes</th><td>%d</td></tr>\n"
"<tr><th>total processes</th><td>%d</td></tr>\n"
+ "<tr><th>max children reached</th><td>%u</td></tr>\n"
"</table>",
- status->accepted_conn, fpm_status_pool, status->pm == PM_STYLE_STATIC ? "static" : "dynamic", status->idle, status->active, status->total);
+ status->accepted_conn, fpm_status_pool, status->pm == PM_STYLE_STATIC ? "static" : "dynamic", status->idle, status->active, status->total, status->max_children_reached);
spprintf(content_type, 0, "Content-Type: text/html");
}
"\"process manager\":\"%s\","
"\"idle processes\":%d,"
"\"active processes\":%d,"
- "\"total processes\":%d"
+ "\"total processes\":%d,"
+ "\"max children reached\":%u"
"}",
- status->accepted_conn, fpm_status_pool, status->pm == PM_STYLE_STATIC ? "static" : "dynamic", status->idle, status->active, status->total);
+ status->accepted_conn, fpm_status_pool, status->pm == PM_STYLE_STATIC ? "static" : "dynamic", status->idle, status->active, status->total, status->max_children_reached);
spprintf(content_type, 0, "Content-Type: application/json");
}
int active;
int total;
unsigned long int accepted_conn;
+ unsigned int max_children_reached;
struct timeval last_update;
};
void fpm_status_update_accepted_conn(struct fpm_shm_s *shm, unsigned long int accepted_conn);
void fpm_status_increment_accepted_conn(struct fpm_shm_s *shm);
void fpm_status_set_pm(struct fpm_shm_s *shm, int pm);
+void fpm_status_update_max_children_reached(struct fpm_shm_s *shm, unsigned int max_children_reached);
+void fpm_status_increment_max_children_reached(struct fpm_shm_s *shm);
int fpm_status_handle_status(char *uri, char *query_string, char **output, char **content_type);
char* fpm_status_handle_ping(char *uri);
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. By default, the status page shows the following
; information:
-; accepted conn - the number of request accepted by the pool;
-; pool - the name of the pool;
-; process manager - static or dynamic;
-; idle processes - the number of idle processes;
-; active processes - the number of active processes;
-; total processes - the number of idle + active processes.
+; accepted conn - the number of request accepted by the pool;
+; pool - the name of the pool;
+; process manager - static or dynamic;
+; idle processes - the number of idle processes;
+; active processes - the number of active processes;
+; total processes - the number of idle + active processes.
+; max children reached - number of times, the process limit has been reached,
+; when pm tries to start more children (works only for
+; pm 'dynamic')
; The values of 'idle processes', 'active processes' and 'total processes' are
; updated each second. The value of 'accepted conn' is updated in real time.
; Example output:
-; accepted conn: 12073
-; pool: www
-; process manager: static
-; idle processes: 35
-; active processes: 65
-; total processes: 100
+; accepted conn: 12073
+; pool: www
+; process manager: static
+; idle processes: 35
+; active processes: 65
+; total processes: 100
+; max children reached: 1
; By default the status page output is formatted as text/plain. Passing either
; 'html' or 'json' as a query string will return the corresponding output
; syntax. Example: