Adding HTTP-2 to Node.js progress report
Tuesday, May 1, 2018
The Node.js community has been working on implementing HTTP/2 into the development framework. James Snell from the Node.js Technical Steering Committee gives us a progress report.
Commentary from Richard
The first documented version of HTTP was released in 1991, known as HTTP 0.9. This later led to the official introduction and recognition of HTTP 1.0 in 1996, but improvements and updates came swiftly in 1997 which stamped out HTTP 1.1. There hasn’t been a major update to the web protocol for over 15 years.
As the web increases in complexity and usage, websites have become bloated, slow, and hacky - in order to work around the old way of requesting, and connecting to resources in order to display a webpage.
HTTP/2 is a massive update that is difficult to fully explain without a deep dive into the history of HTTP itself, but here’s what I can tell you -it’s available for you to use now and it can make a tremendous difference in your web presence.
HTTP/2 is supported by the most current releases of Edge, Safari, Firefox and Chrome. Plus there are also several servers available that you can deploy and test on as well, including open source options.
The implementation of HTTP/2 into Node.js has been an ongoing effort since 2016, and something that the community continues to work on.
We recently had a conversation with James Snell, Open Source architect at nearForm and a member of the Node.js Technical Steering Committee. We wanted to talk about the potential of HTTP/2 for Node.js, and where it stands to be added to Node.js Core. Plus the challenges in adding this protocol in general, and how developers can start testing it out in their own environments.
ADM: What are the biggest benefits of adding HTTP/2 to Node.js?
Snell: The key benefit at this point is to get HTTP/2 into the hands of as many developers as possible, both on the server and client side. This will allow developers to get experience with the new protocol, figure out how to best take advantage of what it has to offer, help them build a corpus of best (and worst) practices, and help to evolve the current state of the art apps. The protocol itself offers more efficient bandwidth consumption and a number of performance gains, but also can significantly increase complexity. There are many open questions about the use of the protocol that can only be answered once it is in the hands of every-day developers.
ADM: When did you start adding HTTP/2 into Node.js? Where does it currently stand in development?
Snell: I initially started the effort in early 2016. Work continued through that year with others joining the effort in early 2017. It was added to Node.js core in August of 2017. Since then a larger team has been iterating and improving the implementation and API. Today, it is experimental as users work to prove out the design and implementation decisions and we work through any remaining bugs. The goal is to get it out of Experimental status within the 10.x pre-LTS release cycle (sometime between April 2018 and October 2018).
ADM: Will developers be able to use this in production soon?
Snell: While the support for HTTP/2 has been added to Node.js core, that is only one component out of many that need to be updated in order for developers to reasonably be able to use HTTP/2 in production.
We are currently waiting on HTTP/2 support to be added to frameworks such as Express and Hapi (efforts are currently underway) and there are other components of the typical production pipeline (such as nginx and other intermediate proxies) that have yet to enable HTTP/2 support on the backend. So while adding HTTP/2 to Node.js is a critical step, there is much more work to be done.
ADM: Are there any issues (now) that developers may run into?
Snell: While we continue to work to identify issues and prove the implementation, developers may run into bugs. We encourage anyone looking to use HTTP/2 to provide active feedback to help us identify those so we can resolve them as quickly as possible.
ADM: Have you done any testing?
Snell: The initial pull request that added HTTP/2 into Node.js core came with well over 100+ unit tests and the number has grown since. There are users who have put the code into production despite it still being experimental, and a growing number of core developers are working collaboratively to iterate on the implementation to improve it. Compatibility testing has demonstrated seamless interoperability with all major browser clients.
Additionally, while we were developing the http2 auto-push plugin (Jinwoo Lee of Google did the research on auto-push, and Matteo Collina of nearForm validated this and helped out with the Fastify plugin), we did performance comparisons between http/1, http/2, and http/2 with auto-push enabled. The test was performed in an LTE-like network emulation, and http/2 alone had ~130% performance gain over http/1, and http/2combined with auto-push showed additional ~10% performance gain.
ADM: What have been some of the challenges faced in adding this protocol?
Snell: The new http/2 implementation is the largest and most significant new subsystem added to Node.js since it was created. The protocol is complex and designing an API that strikes the right balance between performance and usability has been non-trivial.
ADM: What do you see as the largest impact that this protocol has on application development?
Snell: That remains to be determined. So far, direct application developer access to http/2 protocol features has been limited. There are definitely performance advantages to be realized, but it is still too early to say where the largest and most significant impacts will come.
ADM: What's the next phase here for the Node.js Project? When will it become a standard (of sorts)?
Snell: Continued iteration and bringing the http/2 implementation out of experimental before Node.js 10.x moves into Long Term Support in October of 2018. From there, we need to continue iterating on the API and implementation to continuously improve performance and scalability and identify areas we can innovate.
About James Snell
James Snell is an open source architect at nearForm and a member of the Node.js Technical Steering Committee. He has been a release manager for several Node.js releases, most recently Node.js 10.x - the Node.js Project’s latest release line.
James is often responsible for the brand new features in Node.js Core, so if you ever want to get a sneak peek at what is to come with Node.js follow James on Twitter or GitHub. Prior to nearForm, James worked in the open technologies department at IBM for 16 years.
Become a subscriber of App Developer Magazine for just $5.99 a month and take advantage of all these perks.
MEMBERS GET ACCESS TO
- - Exclusive content from leaders in the industry
- - Q&A articles from industry leaders
- - Tips and tricks from the most successful developers weekly
- - Monthly issues, including all 90+ back-issues since 2012
- - Event discounts and early-bird signups
- - Gain insight from top achievers in the app store
- - Learn what tools to use, what SDK's to use, and more