Skip to content

Serving content over HTTPS is very slow (17x-80x slower than HTTP) #7657

Open
@ide

Description

@ide

I am interested in using CircuitPython running on a Pico W to serve a small website over HTTPS. The main reason for HTTPS is to enable browser APIs like service workers (good for offline support) and push notifications (useful for IoT).

The good news is it's possible to serve content over HTTPS using a self-signed certificate, shown in this minimal reproducible example. It's about 15 lines of code that does real work. The not-so-good news is that it's extremely slow, taking 6 seconds to respond with a HTML file that's around 100 bytes and a 1024-bit RSA certificate (2048-bit certificates are 1.5x slower). Over plain HTTP, the same file takes about 75 to 350 milliseconds to serve. The HTTPS performance becomes a practical issue when trying to serve a website comprising multiple assets like an HTML file, favicon, web app manifest, and a service worker script since the web server is single-threaded (admittedly, I haven't explored whether HTTP pipelining helps).

This is a feature request to make HTTPS web servers viable. Realistically, HTTPS/1.1 will incur more round trips and more computation than HTTP/1.1 but if they were just 2x slower, for instance, that'd make them viable to run on a Pico W. It's also definitely possible my server is written poorly or the certificate is misconfigured.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions