简体   繁体   中英

Terrible node js API performance with very light usage

We have a Node.js graphql api, and with light usage (2-3 reqs/sec) request times shoot up into the hundreds of milliseconds very, very quickly.

Our main data sources are Postgres (with pg-node) and Redis (ioredis), and we're making proper use of dataloader to avoid n+1. The Postgres and Redis queries themselves are very quick, this slowness is entirely within the node app itself.

It seems as though just about everything slows down very quickly, I don't think it's network or pg/redis related at all.

What type of heroku dyno are you using?

The cheaper dynos are shared on EC2 instances so it could be that you're sharing with companies that use more bandwidth.

Also, you might want to look at the network performance. Heroku load balancers are also shared as well as their outbound traffic. We ran into an issue last year where our outbound calls to redis were taking a very long time because of that.

I'd recommend moving the your api to aws. It skips the dyno layer so you have much better performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM