OT: limit number of connections from browser to my server?

Chris Angelico rosuav at gmail.com
Mon May 16 12:15:50 EDT 2016


On Tue, May 17, 2016 at 2:06 AM, Grant Edwards
<grant.b.edwards at gmail.com> wrote:
> So, when a browser wants to load a page that has the main html file, a
> css file, a javascript library or two, and a few icons and background
> bitmaps, they browser opens up a half-dozen SSL connections in
> parallel.
>
> That's fine when the server is Facebook's server farm.
>
> But when it's a small embedded device running at 40MHz with a
> single-threaded web server and software crypto, it turns a 2-second
> page load time into a 15-second page load time.
> ...
> So now I'm going to set up a simple Python HTTP server to try some
> other approaches:
>
>   1) Only allow the listening socket to accept 1 connection at a time.
>
>   2) Accept the TCP connection, but don't allow the SSL handshaking to
>      start on the "extra" connections.
>
>   3) ???
>
>   4) Profits!
>
> Any ideas?

If your server is single-threaded, it ought to be processing only one
connection at a time anyway. Are you sure parallel connections are the
problem here?

The solution might actually be to move all your static files
elsewhere. Slap 'em up onto github.io or something, and then the
browser is free to make all the parallel connections it likes; your
embedded device can just serve the stuff that actually varies
(presumably the main HTML file). I know that isn't what you asked for,
but it's something to consider :)

ChrisA



More information about the Python-list mailing list