Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider deprecating in favour of http-terminator #25

Open
gajus opened this issue Jan 20, 2020 · 6 comments
Open

Consider deprecating in favour of http-terminator #25

gajus opened this issue Jan 20, 2020 · 6 comments

Comments

@gajus
Copy link

gajus commented Jan 20, 2020

I have answered a variation of "how to terminate a HTTP server" many times on different Node.js support channels. Unfortunately, I couldn't recommend any of the existing libraries because they are lacking in one or another way (https://github.com/gajus/http-terminator#alternative-libraries). I have since put together a package that (I believe) is handling all the cases expected of graceful HTTP termination.

https://github.com/gajus/http-terminator

I would appreciate if you consider contributing to http-terminator and deprecating stoppable.

@ronkorving
Copy link

@gajus Just had a look at http-terminator. It looks good :)

It may be helpful though if you could explicitly list the things that http-terminator does better than stoppable. With all other alternatives combined, you list 6 reasons, but how many of those apply to stoppable?

@gajus
Copy link
Author

gajus commented Jan 20, 2020

Compared to stoppable:

  • it does not monkey-patch Node.js API (stoppable monkey-patches the Node.js API by adding stop method)
  • it immediately destroys all sockets without an attached HTTP request (stoppable does not check if there are attached HTTP requests)
  • it allows graceful timeout to sockets with ongoing HTTP requests (stoppable implements one timeout for all socket termination)
  • it properly handles HTTPS connections (it seems that stoppable does this)
  • it informs connections using keep-alive that server is shutting down by setting a connection: close header (stoppable does not)
  • it does not terminate the Node.js process (stoppable does not)

I didn't add a comparison table because some functionality is hard to compare, e.g. stoppable does not implement graceful shutdown just for ongoing requests, but it does have a timeout for all connections. It would be unfair to say that stoppable does not have timeout functionality.

@ronkorving
Copy link

Thanks for clarifying. FWIW btw, I'm just a user of stoppable, not the author, so can't provide you with the answer you're looking for. But here's hoping that @hunterloftis will get back to you :)

@maxisam
Copy link

maxisam commented Mar 5, 2021

@gajus First of all, I think both are great libraries
However, about this one

  • it immediately destroys all sockets without an attached HTTP request (stoppable does not check if there are attached HTTP requests)

I think one major different is stoppable tracing all requests

function onRequest (req, res) {

But in http-terminator you don't do the same thing. You use _httpMessage to determine if there is a request attached. If there is none, you close the socket.

https://github.com/gajus/http-terminator/blob/7a65e2c27694cd566ef99097d7bb15b9ddd3056f/src/factories/createInternalHttpTerminator.ts#L106

however, there is no documentation on _httpMessage.

So I can't really tell which one is better on this point, but I think both library handle this one.

@alexweej
Copy link

alexweej commented Apr 8, 2021

The fact that stoppable has (at least today) 0 dependencies is a plus for stoppable. http-terminator is bringing in a fair few indirect dependencies that would be a bit of a liability in production.

@titanism
Copy link

titanism commented Jun 7, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants