Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Benefits of asyncio Date: Tue, 03 Jun 2014 14:12:19 +0300 Organization: A noiseless patient Spider Lines: 30 Message-ID: <87lhteuu0c.fsf@elektro.pacujo.net> References: <874n03t5t9.fsf@elektro.pacujo.net> <7x4n03dor0.fsf@ruckus.brouhaha.com> <878upe8poc.fsf@elektro.pacujo.net> <87wqcyuznv.fsf@elektro.pacujo.net> <87ppiquwyw.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="14170"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192axHgChomp3OSunvP4pkZ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:/cZmzAo6jwxD5jaMjUywKZY//rc= sha1:UVqEBU+cXTyCksddJs01Qhz3aNc= Xref: csiph.com comp.lang.python:72506 Chris Angelico : > your throughput is defined by your database. Asyncio is not (primarily) a throughput-optimization method. Sometimes it is a resource consumption optimization method as the context objects are lighter-weight than full-blown threads. Mostly asyncio is a way to deal with anything you throw at it. What do you do if you need to exit the application immediately and your threads are stuck in a 2-minute timeout? With asyncio, you have full control of the situation. > It's the same with all sorts of other resources. What happens if your > error logging blocks? Do you code everything, *absolutely everything*, > around callbacks? Because ultimately, it adds piles and piles of > complexity and inefficiency, and it still comes back to the same > thing: stuff can make other stuff wait. It would be interesting to have an OS or a programming language where no function returns a value. Linux, in particular, suffers from the deeply-ingrained system assumption that all file access is synchronous. However, your protestations seem like a straw man to me. I have really been practicing event-driven programming for decades. It is fraught with frustrating complications but they feel like fresh air compared with the what-now moments I've had to deal with doing multithreaded programming. Marko