fat Mon, 21 Dec 2009 22:30:19 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=292454
Log: status and ping online feature Changed paths: U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/config.m4 U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.h A php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.c A php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.h U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.c U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.h U php/php-src/branches/PHP_5_3_FPM/sapi/fpm/php-fpm.conf.in
Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/config.m4 =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/config.m4 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/config.m4 2009-12-21 22:30:19 UTC (rev 292454) @@ -585,6 +585,7 @@ 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 \ Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ 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) || Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ .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 @@ 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 @@ 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; } Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.h 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ struct fpm_pm_s { int style; int max_children; + char *status; + char *ping; + char *pong; struct { int start_servers; int min_spare_servers; Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -102,6 +102,7 @@ #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 @@ SG(server_context) = (void *) &request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *status_buffer; fpm_request_info(); @@ -1776,6 +1778,27 @@ 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 { Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ 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 @@ } } - 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); Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ fpm_clock_get(&slot->tv); slot->accepted = slot->tv; fpm_shm_slots_release(slot); + + fpm_status_increment_accepted_conn(fpm_status_shm); } /* }}} */ Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -41,7 +41,7 @@ } /* }}} */ -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); Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.h =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.h 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_shm.h 2009-12-21 22:30:19 UTC (rev 292454) @@ -15,6 +15,7 @@ }; 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); Added: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.c (rev 0) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -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); +} +/* }}} */ + Property changes on: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.c ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Added: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.h =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.h (rev 0) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.h 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 Property changes on: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_status.h ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.c =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.c 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.c 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ 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; } Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.h =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.h 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_worker_pool.h 2009-12-21 22:30:19 UTC (rev 292454) @@ -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 @@ 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(); Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/php-fpm.conf.in =================================================================== --- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/php-fpm.conf.in 2009-12-21 22:11:28 UTC (rev 292453) +++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/php-fpm.conf.in 2009-12-21 22:30:19 UTC (rev 292454) @@ -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">
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php