Jim@programming.dev to Python@programming.devEnglish · 1 year agoCLI tools hidden in the Python standard librarytil.simonwillison.netexternal-linkmessage-square2fedilinkarrow-up14arrow-down10 cross-posted to: python@programming.dev
arrow-up14arrow-down1external-linkCLI tools hidden in the Python standard librarytil.simonwillison.netJim@programming.dev to Python@programming.devEnglish · 1 year agomessage-square2fedilink cross-posted to: python@programming.dev
minus-squareo11c@programming.devlinkfedilinkEnglisharrow-up1·edit-21 year agoIt’s worth noting that the http.server module is based on socketserver.BaseServer.serve_forever, which is a atrocious. It uses a busy loop with a delay, so it both burns CPU and is unresponsive. (The fact that Python has had broken signal handling since 3.5 also hurts - EINTR should never be ignored from blocking calls)
minus-squareJim@programming.devOPlinkfedilinkEnglisharrow-up1·1 year agoI was just about to uninstall nginx… On a serious note: I’m not sure of the details of socketserver but I would think opening a socket would not be a cpu intensive process.
It’s worth noting that the
http.server
module is based onsocketserver.BaseServer.serve_forever
, which is a atrocious.It uses a busy loop with a delay, so it both burns CPU and is unresponsive.
(The fact that Python has had broken signal handling since 3.5 also hurts - EINTR should never be ignored from blocking calls)
I was just about to uninstall nginx…
On a serious note: I’m not sure of the details of
socketserver
but I would think opening a socket would not be a cpu intensive process.