[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-23 Thread Terry J. Reedy
Terry J. Reedy added the comment: If the unforeseeable future arrives, someone can reopen or open a new issue. -- nosy: +terry.reedy resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-23 Thread Marat Sharafutdinov
Marat Sharafutdinov added the comment: Concerning the example adding a jitter is useful, thanks! But anyway in case there will be something not constant as sleeping for 1 sec is, the problem will continue to appear. -- ___

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-23 Thread Andrew Svetlov
Andrew Svetlov added the comment: The problem of the example is: all 1 tasks starts in the same moment, than waits for 1 sec each and at the same moment every task clones itself. Adding a jitter into example can solve the issue. --

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-22 Thread Yury Selivanov
Yury Selivanov added the comment: > Does this mean that GC uses most part of CPU time so the loop blocks? GC stops all Python code in the OS process from running. Because of the GIL code in threads will obviously be stopped too. This is true for both CPython and PyPy

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-22 Thread Marat Sharafutdinov
Marat Sharafutdinov added the comment: Does this mean that GC uses most part of CPU time so the loop blocks? And another question: do you have any plans to optimize the loop so it would be possible to run really lot of tasks in parallel? Thanks. --

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Yury Selivanov
Yury Selivanov added the comment: The "blocking" you observe is caused by Python GC. If I add "import gc; gc.disable()" the warnings disappear. -- ___ Python tracker

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Marat Sharafutdinov
Marat Sharafutdinov added the comment: But why if I use multiprocessing (run 100 tasks by 100 workers) it still continue blocking loop within some workers? Are 100 tasks "a lot of work" for asyncio loop? ```python import asyncio from multiprocessing import Process

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Yury Selivanov
Yury Selivanov added the comment: Well, there's nothing we can do here, it's just a lot of work for a single-threaded process to get a 1 tasks going. You'll get the same picture in any other async Python framework. --

[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Marat Sharafutdinov
New submission from Marat Sharafutdinov : I want to schedule a lot of parallel tasks, but it becomes slow with loop blocking: ```python import asyncio task_count = 1 async def main(): for x in range(1, task_count + 1): asyncio.ensure_future(f(x)) async def