Page MenuHomePhabricator
Paste P11187

debian/patches/wmf-0001-php-fpm-setproctitle-busy.diff
ActivePublic

Authored by CDanis on Tue, May 12, 8:16 PM.
Description: php-fpm workers setproctitle
When a php-fpm worker becomes busy, it will show "busy" in its process title,
and "idle" if not.
Author: Chris Danis <cdanis@wikimedia.org>
Forwarded: no
Last-Update: 2020-05-12
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/sapi/fpm/fpm/fpm_request.c
+++ b/sapi/fpm/fpm/fpm_request.c
@@ -19,6 +19,7 @@
#include "fpm_status.h"
#include "fpm_request.h"
#include "fpm_log.h"
+#include "fpm_env.h"
#include "zlog.h"
@@ -54,6 +55,13 @@ void fpm_request_accepting() /* {{{ */
/* idle++, active-- */
fpm_scoreboard_update(1, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
+
+ struct fpm_scoreboard_s *scoreboard;
+ scoreboard = fpm_scoreboard_get();
+ char *title;
+ spprintf(&title, 0, "pool %s: idle", scoreboard->pool);
+ fpm_env_setproctitle(title);
+ efree(title);
}
/* }}} */
@@ -97,6 +105,13 @@ void fpm_request_reading_headers() /* {{
/* idle--, active++, request++ */
fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
+
+ struct fpm_scoreboard_s *scoreboard;
+ scoreboard = fpm_scoreboard_get();
+ char *title;
+ spprintf(&title, 0, "pool %s: busy", scoreboard->pool);
+ fpm_env_setproctitle(title);
+ efree(title);
}
/* }}} */

Event Timeline

CDanis edited the content of this paste. (Show Details)Tue, May 12, 8:16 PM
CDanis changed the title of this paste from untitled to Masterwork From Distant Lands.
CDanis edited the content of this paste. (Show Details)Tue, May 12, 8:16 PM
CDanis changed the title of this paste from Masterwork From Distant Lands to debian/patches/wmf-0001-php-fpm-setproctitle-busy.diff.Tue, May 12, 9:04 PM
CDanis edited the content of this paste. (Show Details)Tue, May 12, 9:13 PM