Profiling my NodeJS server shows it's hanging... But how to figure out why? Profiling my NodeJS server shows it's hanging... But how to figure out why? kubernetes kubernetes

Profiling my NodeJS server shows it's hanging... But how to figure out why?


By adding more logs around the database requests, we realised that the first few requests were taking around 2-3 seconds while the following ones were only ~10ms or less.

The solution was to use PgBouncer to maintain a connection pool with the database.
More info here:https://techcommunity.microsoft.com/t5/azure-database-for-postgresql/steps-to-install-and-setup-pgbouncer-connection-pooling-proxy/ba-p/730555