
On Mon, 9 Dec 2019 21:42:36 -0500 Kyle Stanley <aeros167@gmail.com> wrote:
(b) Why limit coroutines? It's just another Python object and has no operating resources associated with it. Perhaps your definition of coroutine is different, and you are thinking of OS threads?
This was my primary concern with the proposed PEP. At the moment, it's rather trivial to create one million coroutines, and the total memory taken up by each individual coroutine object is very minimal compared to each OS thread.
There's also a practical use case for having a large number of coroutine objects, such as for asynchronously:
1) Handling a large number of concurrent clients on a continuously running web server that receives a significant amount of traffic.
Not sure how that works? Each client has an accepted socket, which is bound to a local port number, and there are 65536 TCP port numbers available. Unless you're using 15+ coroutines per client, you probably won't reach 1M coroutines that way.
2) Sending a large number of concurrent database transactions to run on a cluster of database servers.
1M concurrent database transactions? Does that sound reasonable at all? Your database administrator probably won't like you.
something like this definitely scales over time. Arbitrarily placing a limit on the total number of coroutine objects doesn't make sense to me for that reason.
There are a lot of arbitrary limits inside a computer system. You just aren't aware of them because you don't hit them in practice. Claiming that limits shouldn't exist is just pointless. Regards Antoine.