3 ms·
As the above comment says, the problem is if you want to write a server that handles a lot of concurrency and shared state. If you write a server and it uses t
by ubernostrum 9y ago
As the above comment says, the problem is if you want to write a server that handles a lot of concurrency and shared state.
If you write a server and it uses threading as the concurrency model and its workload is primarily CPU-bound, the GIL will be a problem for you.
Take away either of those conditions -- use a model other than threading, or have an I/O-bound workload -- then the normal background overhead of the GIL is not something you'll notice.
People who deploy Python applications as network daemons tend to use pools of worker processes (not threads) and have I/O-bound workloads, which is why the assertion that Python is somehow "bad for servers" is not one you'll typically hear from people who actually deploy Python on servers. Much like the comment you're referring to, which is from someone who seems to primarily have type-system complaints about Python (i.e., they wouldn't touch a dynamically-typed language to begin with) and is throwing in "oh and the GIL probably makes it unsuitable for a server" as an additional (but factually incorrect) reason not to use Python.
Meanwhile, if you are writing a server which uses threading and lots of shared state which will be modified concurrently, you're in for a world of pain no matter what language you choose. There's a reason why there are multiple up-and-coming or even moderately-popular languages now which have as a design feature the inability to do such a thing.
- gaius 9y agoRight, hence me making that caveat. multiple up-and-coming or even moderately-popular languages now which have as a design feature the inability to do such a thing STM in Haskell seems quite promising, but the approach of just outsourcing that problem to Redis gets you pretty far.