Earlier quoted context omitted.
Of all the micro-optimizations I could think of for web apps, the one with the highest cost and the least benefit would probably be supporting http2 (or *quic). In almost all cases, there is a fix that will speed up http1.1 to acceptable levels.
What's the "cost" to supporting HTTP 2 as an app developer, though? As far as I know, adding support to nginx requires changing one line of code. That's about as close to free as you can get.
Stop Wasting Connections, Use HTTP Keep-Alive
71–80 of 112 posts
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#72Better yet.. switch to http2 (where keep-alive is deprecated): https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Ke...
Its amazing that not everyone is on http2 yet when its basically free speed.
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#73Earlier quoted context omitted.
What's the "cost" to supporting HTTP 2 as an app developer, though? As far as I know, adding support to nginx requires changing one line of code. That's about as close to free as you can get.
Server push can’t be free. You need the web server to somehow know what resources will be required by the page and I still don’t understand how it doesn’t defeat browser caching but I presume it must involve some non trivial configuration.
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#74Earlier quoted context omitted.
What's the "cost" to supporting HTTP 2 as an app developer, though? As far as I know, adding support to nginx requires changing one line of code. That's about as close to free as you can get.
Server push can’t be free. You need the web server to somehow know what resources will be required by the page and I still don’t understand how it doesn’t defeat browser caching but I presume it must involve some non trivial configuration.
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#75Earlier quoted context omitted.
For a tiny startup, you might be able to just add http2 support in 10 minutes and everything might be fine, but most of the time it's more complicated. It's a bit like if I said, can I change your app libraries to bleeding edge? It's just a one line change.
Could you be more specific, though? What's more complicated? I'm legitimately curious because I know very little about HTTP 2, but at work (not a tiny startup) we recently enabled it and it turned out to be a trivial change. Unless you're implementing the networking layer of your backend yourself, it seems like a change with practically no cost or tradeoff, as long as your server software supports it.
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#76Earlier quoted context omitted.
I don't know why you're seeing what you're seeing but your testing/monitoring setup sounds like it's at a bit too low level for the thing you're trying to figure out. A few basic things you might want (or should, really, if you're implementing HTTP from scratch) to try: - Serve real content, say, a basic HTML page with a couple of external resources. - Serve same and monitor (turn on all teh logs) with apache. - Use…
Thanks, but I've done this (although used Nginx instead). The web server I've written is now serving several websites I'm hosting, some of which have thousands of images, so there's plenty of scope for connection re-use. Each connection ID is different within dev tools in Chrome - although errors have 0 - (often sequential, sometimes there are huge gaps). And this is the same with HTTP websites on the net (just tried…
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#77Better yet.. switch to http2 (where keep-alive is deprecated): https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Ke...
of course, because http2 is stateful and whenever the server or client whishes, they can send a close message. but stateful connection management comes with a cost, especially on tcp.
Keep-alive isn't any better. In Apache bad nginx, keep-alive and http/2 parallel requests are handled at a separate thread and hardly adds any noticeable load.
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#78Earlier quoted context omitted.
of course, because http2 is stateful and whenever the server or client whishes, they can send a close message. but stateful connection management comes with a cost, especially on tcp.
What do you mean by stateful in this context? Http/2 is multiplexed, unlike http/0.9-1.1, and while that has some overhead, it being a binary protocol probably makes up for it.
i.e.: https://http2.github.io/http2-spec/#StreamStates of course the "user layer" is stateless, but the whole connection handling is a state machine (which actually http/0.9-1.1 wasn't)
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#79Better yet.. switch to http2 (where keep-alive is deprecated): https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Ke...
Is it easy for Django/Rails/ExpressJS to implement Http2 in their next release?
Unfortunately neither of those currently support HTTP2.
For serving Python, I think your best bet right now is uWSGI behind NGINX.
Re: Stop Wasting Connections, Use HTTP Keep-Alive
#80Earlier quoted context omitted.
Could you be more specific, though? What's more complicated? I'm legitimately curious because I know very little about HTTP 2, but at work (not a tiny startup) we recently enabled it and it turned out to be a trivial change. Unless you're implementing the networking layer of your backend yourself, it seems like a change with practically no cost or tradeoff, as long as your server software supports it.
I imagine its more bureaucratic complexity than technical. This change would require lots of committee meetings, reviews, meetings, discussions, etc. at my company. It would probably take a year to decide to do it and 5 days to actually do it (Get all IT groups into a large war room, make the change on dev servers and then everyone has to completely test all their apps and sign off on it. Then do it again on staging.…