3 ms·
The biggest issue with `http.server` is it's a blocking single-threaded server, so it can serve a single client at a time. This makes it really really not grea
by masklinn 5y ago
The biggest issue with `http.server` is it's a blocking single-threaded server, so it can serve a single client at a time.
This makes it really really not great when trying to serve pages (with various attending static files), or to ad-hoc share large resources with other people on the network.
- javajosh 5y agoA single-threaded server is fine if you're only mildly IO bound, which is the case when you're serving files-as-resources. My understanding anyway is that http.server is explicitly not for production use!
- masklinn 5y ago> A single-threaded server is fine if you're only mildly IO bound, which is the case when you're serving files-as-resources. It's fine if you're also evented, but that's not the case here, http.server literally can only interact with one connection at a time, the next connection(s) will be queued up waiting for http.server to finish its thing and accept them. > My understanding anyway is that http.server is explicitly not for production use! Sure, but "I'm at a lan party and have the installer for $game so we don't explode the 'net connection" is not the sort of "production use" that's intended by this statement. Neither is "I want to open this HTML file I wrote which has a bunch of static assets booting up the webapp".
- londons_explore 5y agoIt also means a mis-configured client that doesn't close the connection can hang the server. Looking at you HttpClient-on-esp8266...
- jcims 5y agoWe had an engineer add it to his unit tests and started blaming the network team when everything started slowing down. Took me two days to convince him to try another server.
- teh_klev 5y agoParent does point out they use this for quick tinkering.
- masklinn 5y agoYes, and I point out issues I've hit when using this for quick tinkering.