<div dir="ltr"><div class="gmail_default" style="font-size:small">On Thu, Jun 14, 2018 at 8:14 PM, Chris Barker via Python-Dev <span dir="ltr"><<a href="mailto:python-dev@python.org" target="_blank">python-dev@python.org</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Excuse my ignorance (or maybe it's a vocabulary thing), but I'm trying to understand the problem here.<div></div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>So why do queries fail with 10000 tasks? or ANY number? If the async DB access code is written right, a given query should not "await" unless it is in a safe state to do so.<br></div><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>So what am I missing here???</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>because threads ARE concurrent, and there is no advantage to having more threads than can actually run at once, and having many more does cause thread-switching performance issues.<br></div></div></blockquote></span><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>To me, tasks are (somewhat) logically analogous to threads.</div></div></blockquote><div><br></div></span><div>kinda -- in the sense that they are run (and completed) in arbitrary order, But they are different, and that difference is key to this issue.</div><div><br></div><div>As Yury expressed interest in this idea, there must be something I'm missing.</div><div><br></div><div>What is it?</div></div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">All tasks need resources, and bookkeeping for such tasks is likely to slow things down. More importantly, with an uncontrolled number of tasks you can require an uncontrolled use of resources, decreasing efficiency to levels well below that attainable with sensible conservation of resources. Imagine, if you will, a task that starts by allocating 1GB of memory. Would you want 10,000 of those?</div><div class="gmail_default" style="font-size:small"><br></div></div></div></div>