Hacker News new | past | comments | ask | show | jobs | submit | fdfsdfasdfd's comments login

I'm just a fool on the internet, but if your appserver is NodeJS, you might want to consider HAProxy over nginx (I say this as a fan of nginx).

The reason being that (unless my information is stale), NodeJS will happily accept all the connections thrown at it, eventually causing each connection to be starved of compute capacity and finally falling over. HAProxy is able to keep a connection queue and feed a maximum of (for example) 4 concurrent requests to the backend(s), thus providing back-pressure to incoming requests. Makes it a lot easier if you need to eventually scale your app horizontally, too.


> HAProxy is able to keep a connection queue and feed a maximum of (for example) 4 concurrent requests to the backend(s), thus providing back-pressure to incoming requests.

NGINX can do this as well, either with the "max_conns" parameter for upstreams, or (trickier, but perhaps more effective when the upstream is async) in combination with rate limiting:

    limit_req_zone $server_name zone=root:10m rate=100r/s;
    limit_req_status 429;

    location / {
        limit_req zone=root burst=100 delay=4;
    }


Thank you, that's good advice.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: