diff options
author | Jérôme Loyet <fat@php.net> | 2009-12-21 22:30:19 +0000 |
---|---|---|
committer | Jérôme Loyet <fat@php.net> | 2009-12-21 22:30:19 +0000 |
commit | 759800798427bd0d1a2cc789d14b9ef2b9982996 (patch) | |
tree | 9eb5ee5f57db3e508839acc4a69d02042f9f2799 | |
parent | 2d79ec186df2141ac2544182efd274579965a8f4 (diff) | |
download | php-git-759800798427bd0d1a2cc789d14b9ef2b9982996.tar.gz |
status and ping online feature
-rw-r--r-- | sapi/fpm/config.m4 | 1 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_children.c | 2 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_conf.c | 77 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_conf.h | 5 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 23 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_process_ctl.c | 12 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_request.c | 3 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_shm.c | 2 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_shm.h | 1 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_status.c | 212 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_status.h | 32 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_worker_pool.c | 4 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_worker_pool.h | 2 | ||||
-rw-r--r-- | sapi/fpm/php-fpm.conf.in | 40 |
14 files changed, 412 insertions, 4 deletions
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4 index 1d34b617dd..9453d129da 100644 --- a/sapi/fpm/config.m4 +++ b/sapi/fpm/config.m4 @@ -585,6 +585,7 @@ if test "$PHP_FPM" != "no"; then fpm/fpm_shm_slots.c \ fpm/fpm_signals.c \ fpm/fpm_sockets.c \ + fpm/fpm_status.c \ fpm/fpm_stdio.c \ fpm/fpm_unix.c \ fpm/fpm_worker_pool.c \ diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 8b0c3539d7..32cf1cc5a7 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -26,6 +26,7 @@ #include "fpm_unix.h" #include "fpm_env.h" #include "fpm_shm_slots.h" +#include "fpm_status.h" #include "zlog.h" @@ -145,6 +146,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */ fpm_globals.max_requests = wp->config->max_requests; if (0 > fpm_stdio_init_child(wp) || + 0 > fpm_status_init_child(wp) || 0 > fpm_unix_init_child(wp) || 0 > fpm_signals_init_child() || 0 > fpm_env_init_child(wp) || diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index cc726591fc..6840fce20a 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -10,6 +10,7 @@ #include <string.h> #include <stdlib.h> #include <stddef.h> +#include <string.h> #if HAVE_INTTYPES_H # include <inttypes.h> #else @@ -26,6 +27,8 @@ #include "fpm_cleanup.h" #include "fpm_php.h" #include "fpm_sockets.h" +#include "fpm_shm.h" +#include "fpm_status.h" #include "xml_config.h" #include "zlog.h" @@ -190,6 +193,9 @@ static struct xml_conf_section fpm_conf_set_pm_subsection_conf = { .parsers = (struct xml_value_parser []) { { XML_CONF_SCALAR, "style", &fpm_conf_set_pm_style, 0 }, { XML_CONF_SCALAR, "max_children", &xml_conf_set_slot_integer, offsetof(struct fpm_pm_s, max_children) }, + { XML_CONF_SCALAR, "status", &xml_conf_set_slot_string, offsetof(struct fpm_pm_s, status) }, + { XML_CONF_SCALAR, "ping", &xml_conf_set_slot_string, offsetof(struct fpm_pm_s, ping) }, + { XML_CONF_SCALAR, "pong", &xml_conf_set_slot_string, offsetof(struct fpm_pm_s, pong) }, { XML_CONF_SUBSECTION, "dynamic", &fpm_conf_set_dynamic_subsection, offsetof(struct fpm_pm_s, dynamic) }, { 0, 0, 0, 0 } } @@ -288,6 +294,9 @@ int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc) /* {{{ */ free(wpc->name); free(wpc->listen_address); + free(wpc->pm->status); + free(wpc->pm->ping); + free(wpc->pm->pong); if (wpc->listen_options) { free(wpc->listen_options->owner); free(wpc->listen_options->group); @@ -466,6 +475,74 @@ static int fpm_conf_process_all_pools() /* {{{ */ close(fd); } } + + if (wp->config->pm->ping && *wp->config->pm->ping) { + char *ping = wp->config->pm->ping; + int i; + + if (*ping != '/') { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' must start with a '/'", wp->config->name, ping); + return(-1); + } + + if (strlen(ping) < 2) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' is not long enough", wp->config->name, ping); + return(-1); + } + + for (i=0; i<strlen(ping); i++) { + if (!isalnum(ping[i]) && ping[i] != '/' && ping[i] != '-' && ping[i] != '_' && ping[i] != '.') { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, ping); + return(-1); + } + } + + if (!wp->config->pm->pong) { + wp->config->pm->pong = strdup("pong"); + } else { + if (strlen(wp->config->pm->pong) < 1) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping response page '%s' is not long enough", wp->config->name, wp->config->pm->pong); + return(-1); + } + } + } else { + if (wp->config->pm->pong) { + free(wp->config->pm->pong); + wp->config->pm->pong = NULL; + } + } + + if (wp->config->pm->status && *wp->config->pm->status) { + int i; + char *status = wp->config->pm->status; + struct fpm_status_s fpm_status; + + if (*status != '/') { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' must start with a '/'", wp->config->name, status); + return(-1); + } + + if (strlen(status) < 2) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' is not long enough", wp->config->name, status); + return(-1); + } + + for (i=0; i<strlen(status); i++) { + if (!isalnum(status[i]) && status[i] != '/' && status[i] != '-' && status[i] != '_' && status[i] != '.') { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, status); + return(-1); + } + } + wp->shm_status = fpm_shm_alloc(sizeof(struct fpm_status_s)); + if (!wp->shm_status) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to allocate shared memory for status page '%s'", wp->config->name, status); + return(-1); + } + fpm_status_update_accepted_conn(wp->shm_status, 0); + fpm_status_update_activity(wp->shm_status, -1, -1, -1, 1); + fpm_status_set_pm(wp->shm_status, wp->config->pm->style); + //memset(&fpm_status.last_update, 0, sizeof(fpm_status.last_update)); + } } return 0; } diff --git a/sapi/fpm/fpm/fpm_conf.h b/sapi/fpm/fpm/fpm_conf.h index 5e6b56c2c3..486319a737 100644 --- a/sapi/fpm/fpm/fpm_conf.h +++ b/sapi/fpm/fpm/fpm_conf.h @@ -5,6 +5,8 @@ #ifndef FPM_CONF_H #define FPM_CONF_H 1 +#define FPM_CONF_MAX_PONG_LENGTH 64 + struct key_value_s; struct key_value_s { @@ -27,6 +29,9 @@ extern struct fpm_global_config_s fpm_global_config; struct fpm_pm_s { int style; int max_children; + char *status; + char *ping; + char *pong; struct { int start_servers; int min_spare_servers; diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 93cc03f332..df39bfaa49 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -102,6 +102,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; #endif #include <fpm/fpm.h> #include <fpm/fpm_request.h> +#include <fpm/fpm_status.h> #ifndef PHP_WIN32 /* XXX this will need to change later when threaded fastcgi is implemented. shane */ @@ -1764,6 +1765,7 @@ consult the installation file that came with this distribution, or visit \n\ SG(server_context) = (void *) &request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *status_buffer; fpm_request_info(); @@ -1776,6 +1778,27 @@ consult the installation file that came with this distribution, or visit \n\ return FAILURE; } + if (fpm_status_handle_status(SG(request_info).request_uri, &status_buffer)) { + sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1 TSRMLS_CC); + if (status_buffer) { + int i; + SG(sapi_headers).http_response_code = 200; + PUTS(status_buffer); + efree(status_buffer); + } else { + SG(sapi_headers).http_response_code = 500; + PUTS("Unable to retrieve status\n"); + } + goto fastcgi_request_done; + } + + if (status_buffer = fpm_status_handle_ping(SG(request_info).request_uri)) { + sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1 TSRMLS_CC); + SG(sapi_headers).http_response_code = 200; + PUTS(status_buffer); + goto fastcgi_request_done; + } + /* If path_translated is NULL, terminate here with a 404 */ if (!SG(request_info).path_translated) { zend_try { diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index c37e394a56..44293e4ec5 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -18,6 +18,7 @@ #include "fpm_cleanup.h" #include "fpm_request.h" #include "fpm_worker_pool.h" +#include "fpm_status.h" #include "zlog.h" @@ -322,7 +323,6 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ int active = 0; if (wp->config == NULL) continue; - if (wp->config->pm->style != PM_STYLE_DYNAMIC) continue; for (child = wp->children; child; child = child->next) { int ret = fpm_request_is_idle(child); @@ -340,13 +340,19 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ } } - zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] currently %d active children, %d spare children, %d running children. Spawning rate %d", wp->config->name, active, idle, wp->running_children, wp->idle_spawn_rate); - if ((active + idle) != wp->running_children) { zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to retrieve process activiry of one or more child(ren). Will try again later.", wp->config->name); continue; } + /* update status structure for all PMs */ + fpm_status_update_activity(wp->shm_status, idle, active, idle + active, 0); + + /* the rest is only used by PM_STYLE_DYNAMIC */ + if (wp->config->pm->style != PM_STYLE_DYNAMIC) continue; + + zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] currently %d active children, %d spare children, %d running children. Spawning rate %d", wp->config->name, active, idle, wp->running_children, wp->idle_spawn_rate); + if (idle > wp->config->pm->dynamic.max_spare_servers && last_idle_child) { last_idle_child->idle_kill = 1; fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_TERM); diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index 1aedeaf557..693bf8347b 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -13,6 +13,7 @@ #include "fpm_process_ctl.h" #include "fpm_children.h" #include "fpm_shm_slots.h" +#include "fpm_status.h" #include "fpm_request.h" #include "zlog.h" @@ -40,6 +41,8 @@ void fpm_request_reading_headers() /* {{{ */ fpm_clock_get(&slot->tv); slot->accepted = slot->tv; fpm_shm_slots_release(slot); + + fpm_status_increment_accepted_conn(fpm_status_shm); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_shm.c b/sapi/fpm/fpm/fpm_shm.c index a0f7aa8e7d..cfacde2042 100644 --- a/sapi/fpm/fpm/fpm_shm.c +++ b/sapi/fpm/fpm/fpm_shm.c @@ -41,7 +41,7 @@ struct fpm_shm_s *fpm_shm_alloc(size_t sz) /* {{{ */ } /* }}} */ -static void fpm_shm_free(struct fpm_shm_s *shm, int do_unmap) /* {{{ */ +void fpm_shm_free(struct fpm_shm_s *shm, int do_unmap) /* {{{ */ { if (do_unmap) { munmap(shm->mem, shm->sz); diff --git a/sapi/fpm/fpm/fpm_shm.h b/sapi/fpm/fpm/fpm_shm.h index f3f0be02b4..bbff54c402 100644 --- a/sapi/fpm/fpm/fpm_shm.h +++ b/sapi/fpm/fpm/fpm_shm.h @@ -15,6 +15,7 @@ struct fpm_shm_s { }; struct fpm_shm_s *fpm_shm_alloc(size_t sz); +void fpm_shm_free(struct fpm_shm_s *shm, int do_unmap); void fpm_shm_free_list(struct fpm_shm_s *, void *); void *fpm_shm_alloc_chunk(struct fpm_shm_s **head, size_t sz, void **mem); diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c new file mode 100644 index 0000000000..ad897076a1 --- /dev/null +++ b/sapi/fpm/fpm/fpm_status.c @@ -0,0 +1,212 @@ + + /* $Id$ */ + /* (c) 2009 Jerome Loyet */ + +#include "php.h" +#include <stdio.h> + +#include "fpm_config.h" +#include "fpm_status.h" +#include "fpm_clock.h" +#include "zlog.h" + +struct fpm_shm_s *fpm_status_shm = NULL; +static char *fpm_status_pool = NULL; +static char *fpm_status_uri = NULL; +static char *fpm_status_ping= NULL; +static char *fpm_status_pong= NULL; + + +int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */ +{ + if (!wp || !wp->config) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "unable to init fpm_status because conf structure is NULL"); + return(-1); + } + if (wp->config->pm->status || wp->config->pm->ping) { + if (wp->config->pm->status) { + if (!wp->shm_status) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to init fpm_status because the dedicated SHM has not been set", wp->config->name); + return(-1); + } + fpm_status_shm = wp->shm_status; + } + fpm_status_pool = strdup(wp->config->name); + if (wp->config->pm->status) { + fpm_status_uri = strdup(wp->config->pm->status); + } + if (wp->config->pm->ping) { + if (!wp->config->pm->pong) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] ping is set (%s) but pong is not set.", wp->config->name, wp->config->pm->ping); + return(-1); + } + fpm_status_ping = strdup(wp->config->pm->ping); + fpm_status_pong = strdup(wp->config->pm->pong); + } + } + return(0); +} +/* }}} */ + +void fpm_status_set_pm(struct fpm_shm_s *shm, int pm) /* {{{ */ +{ + 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.pm = pm; + + /* one shot operation */ + *(struct fpm_status_s *)shm->mem = status; +} + +void fpm_status_increment_accepted_conn(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.accepted_conn++; + + /* one shot operation */ + *(struct fpm_status_s *)shm->mem = status; +} +/* }}} */ + +void fpm_status_update_accepted_conn(struct fpm_shm_s *shm, unsigned long int accepted_conn) /* {{{ */ +{ + 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.accepted_conn = accepted_conn; + + /* 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; + + if (!shm) shm = fpm_status_shm; + if (!shm || !shm->mem) return; + + /* one shot operation */ + status = *(struct fpm_status_s *)shm->mem; + + status.idle = idle; + status.active = active; + status.total = total; + if (clear_last_update) { + memset(&status.last_update, 0, sizeof(status.last_update)); + } else { + fpm_clock_get(&status.last_update); + } + + /* one shot operation */ + *(struct fpm_status_s *)shm->mem = status; +} +/* }}} */ + +int fpm_status_get(int *idle, int *active, int *total, int *pm) /* {{{ */ +{ + struct fpm_status_s status; + if (!fpm_status_shm || !fpm_status_shm->mem) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to access status shared memory", fpm_status_pool); + return(0); + } + if (!idle || !active || !total) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to get status information : pointers are NULL", fpm_status_pool); + return(0); + } + + /* one shot operation */ + status = *(struct fpm_status_s *)fpm_status_shm->mem; + + if (idle) *idle = status.idle; + if (active) *active = status.active; + if (total) *total = status.total; + if (pm) *pm = status.pm; +} +/* }}} */ + +/* return 0 if it's not the request page + * return 1 if ouput has been set) + * *output unchanged: error (return 500) + * *output changed: no error (return 200) + */ +int fpm_status_handle_status(char *uri, char **output) /* {{{ */ +{ + struct fpm_status_s status; + + if (!fpm_status_uri || !uri) { + return(0); + } + + /* It's not the status page */ + if (strcmp(fpm_status_uri, uri)) { + return(0); + } + + if (!output || !fpm_status_shm) { + return(1); + } + + if (!fpm_status_shm->mem) { + return(1); + } + + /* one shot operation */ + status = *(struct fpm_status_s *)fpm_status_shm->mem; + + if (status.idle < 0 || status.active < 0 || status.total < 0) { + return(1); + } + + 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); + + if (!*output) { + zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to allocate status ouput buffer", fpm_status_pool); + return(1); + } + + return(1); +} +/* }}} */ + +char *fpm_status_handle_ping(char *uri) /* {{{ */ +{ + if (!fpm_status_ping || !fpm_status_pong || !uri) { + return(NULL); + } + + /* It's not the status page */ + if (strcmp(fpm_status_ping, uri)) { + return(NULL); + } + + return(fpm_status_pong); +} +/* }}} */ + diff --git a/sapi/fpm/fpm/fpm_status.h b/sapi/fpm/fpm/fpm_status.h new file mode 100644 index 0000000000..a8bb8ddd53 --- /dev/null +++ b/sapi/fpm/fpm/fpm_status.h @@ -0,0 +1,32 @@ + + /* $Id$ */ + /* (c) 2009 Jerome Loyet */ + +#ifndef FPM_STATUS_H +#define FPM_STATUS_H 1 +#include "fpm_worker_pool.h" +#include "fpm_shm.h" + +#define FPM_STATUS_BUFFER_SIZE 512 + +struct fpm_status_s { + int pm; + int idle; + int active; + int total; + unsigned long int accepted_conn; + struct timeval last_update; +}; + +int fpm_status_init_child(struct fpm_worker_pool_s *wp); +void fpm_status_update_activity(struct fpm_shm_s *shm, int idle, int active, int total, int clear_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); +int fpm_status_get(int *idle, int *active, int *total, int *pm); +int fpm_status_handle_status(char *uri, char **output); +char* fpm_status_handle_ping(char *uri); + +extern struct fpm_shm_s *fpm_status_shm; + +#endif diff --git a/sapi/fpm/fpm/fpm_worker_pool.c b/sapi/fpm/fpm/fpm_worker_pool.c index 67c15d2c41..368deb6aa0 100644 --- a/sapi/fpm/fpm/fpm_worker_pool.c +++ b/sapi/fpm/fpm/fpm_worker_pool.c @@ -8,6 +8,7 @@ #include <stdlib.h> #include <unistd.h> +#include "fpm.h" #include "fpm_worker_pool.h" #include "fpm_cleanup.h" #include "fpm_children.h" @@ -32,6 +33,9 @@ static void fpm_worker_pool_cleanup(int which, void *arg) /* {{{ */ free(wp->user); free(wp->home); free(wp); + if (wp->shm_status) { + fpm_shm_free(wp->shm_status, !fpm_globals.is_child); + } } fpm_worker_all_pools = 0; } diff --git a/sapi/fpm/fpm/fpm_worker_pool.h b/sapi/fpm/fpm/fpm_worker_pool.h index 43654474fc..afdf5ae12a 100644 --- a/sapi/fpm/fpm/fpm_worker_pool.h +++ b/sapi/fpm/fpm/fpm_worker_pool.h @@ -7,6 +7,7 @@ #include "fpm_conf.h" #include "fpm_arrays.h" +#include "fpm_shm.h" struct fpm_worker_pool_s; struct fpm_child_s; @@ -37,6 +38,7 @@ struct fpm_worker_pool_s { int running_children; int idle_spawn_rate; int warn_max_children; + struct fpm_shm_s *shm_status; }; struct fpm_worker_pool_s *fpm_worker_pool_alloc(); diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index 851636b437..6d63bbd37c 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -81,6 +81,46 @@ Used with any pm_style. <value name="max_children">50</value> + Sets the status URI to call to obtain php-fpm status page. + If not set, no URI will be recognized as a status page. + It show text/plain looking like: + accepted conn: 12073 + pool: default + process manager: static + idle processes: 35 + active processes: 65 + total processes: 100 + "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": idle + active + The last three number are uptaded every second. + The "accepted conn" is updated in real time + *** WARNING *** + It has to start with a /. It could be named has you want. + It's maybe not a good idea to use .php extension to be certain + not to conflict with a real PHP file + <value name="status">/status</value> + + Set the ping URI to call the monitoring page of php-fpm + If not set, no URI will be recognized as a ping page. + This could be used to test from outside that php-fpm + is alive and responding: + - have a graph of php-fpm availability (rrd or such) + - remove a server from a pool if it's not responding (load balancing systems) + - trigger alerts for the operating team (24/7) + *** WARNING *** + It has to start with a /. It could be named has you want. + It's maybe not a good idea to use .php extension to be certain + not to conflict with a real PHP file + <value name="ping">/ping</value> + Set the response to custom the response of a ping request + If 'pong' is not set, the default is "pong". + The response is text/plain with a 200 response code + <value name="pong">pong</value> + Settings group for 'dynamic' pm style <value name="dynamic"> |