How to make my Node app on Railway faster?
rayrift
HOBBYOP
3 months ago
Hi,
Good day
I have a Node backend in Fastify running on Railway. The response times are a little slower then i expecetd, and I'm pretty sure it's not my database.
Any tips for bringing the request time down in the Railway or in my Node app?
Attachments
1 Replies
dev-hari-prasad
FREE
3 months ago
You can do a few things to make your app faster like:
1. Configure your database connection pool (set max connections to 20 and add timeouts)
2. Disable verbose logging in the prod eg. Fastify’s logger: true adds overhead
3. Add compression with @fastify/compress, and reduce or remove request.log.info calls in routes
The biggest wins are the connection pool config and turning off logging in production. I think this shall help you achive 20% to 30% imporvment
