Using HTTP/2 in Thriftly¶
Thriftly 3.0 now includes HTTP/2 support. This support is include on all license levels except for “Basic”. Using the new HTTP/2 support is very easy. All you need to do is select it for the transport in your process pool:
Once it’s selected (the pool must be restarted if you do this on an already-running pool) there really isn’t anything you need to do. Your clients will automatically attemp to negotiate an HTTP/2 connection and rather than requesting a downgrade to HTTP/1.1 as Thriftly has always done, now a more optimized HTTP/2 connection will be used. This is especially beneficial for APIs that have very large headers. In HTTP/1.1 the headers were always sent as plain text. If you had many kilobytes of headers on each call, that could be quite the overhead. In HTTP/2 these headers are automatically compressed, saving precious bytes and transfer time (especially for mobile.)
Another benefit of HTTP/2 is multiplexing. This allows a client to make multiple simultaneous Thriftly calls without having to open multiple connections. Their browsers will do this automatically. This saves the back and forth negotiation that occurs for each connection and also reduces load on the server.
To learn more about HTTP/2 please visit see this web.dev article.