The 0x tool mentioned in ENG-5078 does not work with node:cluster. We can modify keyserver.js to launch a single process when KEYSERVER_PROFILING_ENABLED is set. This is what I did in my personal dev environment to get 0x working.
Basically if KEYSERVER_PROFILING_ENABLED is set, we avoid cluster.fork()ing and just "spill" into the else block that would usually only be executed by child processes (cpid == 0). Previous cluster fork()ing logic continues to work as expected when KEYSERVER_PROFILING_ENABLED is unset.
Will users have to set KEYSERVER_PROFILING_ENABLED in their environment manually?
The yarn command for profiling will begin with KEYSERVER=true KEYSERVER_PROFILING_ENABLED=true node... to make this config "invisible" to the dev. As long as they run yarn profile-* things will work as expected.
Depends on D9300