About continuous profiling #5277
Replies: 2 comments
-
Have you tested xhprof or excimer? |
Beta Was this translation helpful? Give feedback.
-
I think https://github.com/NoiseByNorthwest/php-spx could be made Swoole-friendly provided one uses PHP's builtin server for the visualization of the profiling and spx_profiler_start() and spx_profiler_stop() in the Swoole server while setting automatic start to 0 Then a UNIX domain socket could be used to inform the Swoole server to either enable or disable profiling during runtime (which - for instance - would modify a Swoole\Atomic variable) If the message coming in over the UNIX domain socket is to enable, then the Atomic variable would be set to 1 and some INI settings might be set via ini_set() (See the SPX extension repository for help on this) Finally, in the code that needs to be profiled, you might do something like: global $profilingEnabled; // This is the Swoole\Atomic variable controlling if PROFILING is currently enabled if ((int) $profilingEnabled->get() === 1) { // ... Code to be profiled .... if ((int) $profilingEnabled->get() === 1) { I have previously done this on a project, however there is one caveat: All INI settings of PHP SPX profiler extension are PHP_INI_SYSTEM if I recall correctly, so what I ended up doing was to modify the source code of the SPX extension such that all INI settings were instead PHP_INI_ALL (meaning that they are modifyable from any context) Just my 2 cents... |
Beta Was this translation helpful? Give feedback.
-
Is there anyone who uses continuous profiling on the Swoole-based project?
I know the blackfire.io supports Swoole but I'm looking for OSS.
Now I am trying to use Grafana Pyroscope but It does not work well with Swoole.
Any information or suggestions are appreciated.
Beta Was this translation helpful? Give feedback.
All reactions