Project

General

Profile

Feature #45306

mgr/dashboard: Use HTTP2 or websockets

Added by Stephan Müller 5 months ago.

Status:
New
Priority:
Normal
Category:
dashboard/general
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

In order to determine what we want to use in future. I will compare both HTTP2 and websockets.

First a bunch of information.

Currently we use the protocol HTTP1.1, which only allows one request per connection.

With HTTP2 and websockets it is possible to allow an unlimited amount of request per connection.

What does one request per connection mean? For example a client asks the server for a file, this will open a connection telling the server GET me something, the server will respond and close the connection. As our dashboard does not only consist of one file, a lot of connections are made. To meet the demand of any modern site of so many connections all modern browsers will do 8 connections simultaneously. On every connection also the same header is send.

What does unlimited amount of requests per connection mean? For example a client asks for a (whole) website. The client sends the first request like in HTTP1.1, the server responds with an HTTP1.1 Upgrade header, client and server negotiate which protocol to use (handshake). A connection is established and left open for requests. The client sends requests for multiple files while the server already responds with the files. This maxes out the established connection, as both participants can send at the same time (for example a video chat). As the connection is left open the server can PUSH data to the client even if he had not explicitly asked for (removes polling). To save data, only the headers during the handshake are send, they will not be send multiple times.

Whats the difference between HTTP2 (released as standard 2015) and websockets (released as standard 2011)?
Both only need one connection. Websockets can run insecure using port 80 and both can run secure using port 443. Websockets use a different URL prefix ws:// for insecure connections or wss:// for secure ones, HTTP2 uses only https:// as prefix. If HTTP2 is used data will automatically be compressed and the handshake is easier to implement than with websockets.

Sure HTTP2 is the better one as the protocol is much newer, but can we use it with cherrypy?
Currently I only found a plugin for cherrypy to allow websockets.
I've not found one for HTTP2 yet but I'm still collecting information.

Also available in: Atom PDF