My simple bun server seems to use much more CPU and memory than is necessary while idle.

tylerlaws0n
TRIAL

a year ago

Project ID: 08a29f67-b910-46ed-9d90-9cbc39f97929

github: https://github.com/tylerlaws0n/sprt.dev

This simple bun server averages about 1 full CPU and 150 MB memory while the service is live and not being requested.

I have it connected to a redis cache and a postgres node client in the same railway project.

This high of a usage on memory and CPU while there are no requests running through the server make me suspect that the api is "doing work" or storing more than is necessary in memory during these time periods.

I tried the "sleep while idle", but this only seems to occasionally turn off the CPU and have zero impact on the memory.

I'd greatly appreciate any helps or hints for how to debug this. If there are any tools to look into what is stored in memory or what callstacks lead to the CPU usage that would be hugely helpful. Thanks!

2 Replies

a year ago

Have you followed their deploying to production suggestion?


tylerlaws0n
TRIAL

a year ago

Yes, my build step bundles and minifies as is suggested. I verified in the railway logs that all the correct scripts are being run and they are.


My simple bun server seems to use much more CPU and memory than is necessary while idle. - Railway Help Station