Browse Source

- decrement proc-load if we really incremented it

- added host.load as status-variable


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@997 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.11
Jan Kneschke 17 years ago
parent
commit
7e861ea32e
  1. 27
      src/mod_fastcgi.c

27
src/mod_fastcgi.c

@ -406,8 +406,10 @@ int status_counter_set(server *srv, const char *s, size_t len, int val) {
int fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
buffer_copy_string(b, "fastcgi.backend.");
buffer_append_string_buffer(b, host->id);
buffer_append_string(b, ".");
buffer_append_long(b, proc->id);
if (proc) {
buffer_append_string(b, ".");
buffer_append_long(b, proc->id);
}
return 0;
}
@ -424,6 +426,15 @@ int fastcgi_status_init(server *srv, buffer *b, fcgi_extension_host *host, fcgi_
CLEAN(".connected");
CLEAN(".load");
#undef CLEAN
#define CLEAN(x) \
fastcgi_status_copy_procname(b, host, NULL); \
buffer_append_string(b, x); \
status_counter_set(srv, CONST_BUF_LEN(b), 0);
CLEAN(".load");
#undef CLEAN
return 0;
@ -872,7 +883,8 @@ static int fcgi_spawn_connection(server *srv,
pid_t child;
int val;
if (!buffer_is_empty(proc->socket)) {
if (errno != ENOENT &&
!buffer_is_empty(proc->socket)) {
unlink(proc->socket->ptr);
}
@ -1535,7 +1547,7 @@ static int fcgi_reconnect(server *srv, handler_ctx *hctx) {
hctx->proc->pid, hctx->proc->socket);
}
if (hctx->proc) {
if (hctx->proc && hctx->got_proc) {
hctx->proc->load--;
fcgi_proclist_sort_down(srv, hctx->host, hctx->proc);
}
@ -2919,11 +2931,18 @@ static handler_t fcgi_write_request(server *srv, handler_ctx *hctx) {
status_counter_inc(srv, CONST_BUF_LEN(p->statuskey));
/* the proc-load */
fastcgi_status_copy_procname(p->statuskey, hctx->host, hctx->proc);
buffer_append_string(p->statuskey, ".load");
status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->proc->load);
/* the host-load */
fastcgi_status_copy_procname(p->statuskey, hctx->host, NULL);
buffer_append_string(p->statuskey, ".load");
status_counter_set(srv, CONST_BUF_LEN(p->statuskey), hctx->host->load);
if (p->conf.debug) {
log_error_write(srv, __FILE__, __LINE__, "sddbdd",
"got proc:",

Loading…
Cancel
Save