Let's say we have a system like this:
______ { application instances ---network--- (______) { application instances ---network--- | | requests ---> load balancer { application instances ---network--- | data | { application instances ---network--- | base | { application instances ---network--- \______/
The request arrives, the load balancer sends it to the application server instance, and the application server instances access the database (elsewhere on the local network). Application instances can be either separate processes or separate threads. To cover all the bases, let's say there are several identical processes, each of which has a pool of identical application application threads.
If the database is slow or the network gets bogged down, it is obvious that the throughput of query services will be degraded.
Now, in all my experiments before Python, this will be accompanied by a corresponding decrease in CPU usage by application instances - they will spend more time blocking I / O and less time doing things that are CPU intensive.
However, they tell me that this is not the case with Python - under certain circumstances of Python, this situation can lead to an increase in the use of Python CPUs, possibly up to 100%. Something about Global Interpreter Lock and multiple threads seems to be causing Python to spend all his time switching between threads, checking to see if any of them still have a response from the database. "In this regard, libraries based on events related to events have recently grown."
It is right? Do Python application application threads affect more processors when their I / O latency increases?
source share