Profiling the Backend ​
The backend provides a serve:profile script that starts the server with the Node.js inspector enabled. This allows Chrome DevTools to attach to the running backend for CPU and memory profiling.
Prerequisites ​
Set up the local backend configuration and the Garden cluster kubeconfig as described in Setting Up a Local Development Environment.
Start the backend with the inspector ​
From the backend directory, start the server using:
yarn serve:profileThe backend starts as usual on the configured HTTP port (by default http://localhost:3030) and exposes the Node.js inspector on 127.0.0.1:9229.
Connect Chrome DevTools ​
- Open
chrome://inspectin Chrome. - Under Remote Target, find the backend Node.js process and select inspect.
- In the DevTools window that opens, use the Performance panel to record a CPU profile, or the Memory panel to take heap snapshots.
If the backend process is not listed, select Configure... on chrome://inspect and ensure that localhost:9229 is configured. Keep the terminal running yarn serve:profile open while profiling.
Stop the backend with Ctrl+C when profiling is complete.