On 2016-05-16, Chris Angelico <ros...@gmail.com> wrote: > On Tue, May 17, 2016 at 2:06 AM, Grant Edwards> <grant.b.edwa...@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.
[...] > 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? It handles one HTTP request at a time, but it allows multiple connections to be open simultaneously. It's got a sort of "event loop" where each time through the loop it accepts all new connections, shuts down any closed connections, and then handles requests (one at a time) on any open connections that are readable. I can see from the devices logs and from Chrome's network monitor that it has opened 5-6 parallel SSL connections by the time the page is loaded. I can also see that pending HTTP requests on already-opened connections are being delayed by the SSL connection setup times of the newer connections. > 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 :) Our devices are often used on air-gapped industrial networks with no connection to the interwebs. We can't assume access to any other web servers. I've thought about trying to do as much as possible with server-side includes for .js and .css files and embedding graphics elements in the HTML pages for icons, background, etc. But, that makes development more complicated and you give up the advanges of browser caching of css, js, png, and gif files. -- Grant Edwards grant.b.edwards Yow! Is it clean in other at dimensions? gmail.com -- https://mail.python.org/mailman/listinfo/python-list