Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20712 > unrolled thread
| Started by | Plumo <richardbp@gmail.com> |
|---|---|
| First post | 2012-02-22 22:58 -0800 |
| Last post | 2012-02-26 08:44 +1100 |
| Articles | 12 — 7 participants |
Back to article view | Back to comp.lang.python
asynchronous downloading Plumo <richardbp@gmail.com> - 2012-02-22 22:58 -0800
Re: asynchronous downloading Justin Ezequiel <justin.mailinglists@gmail.com> - 2012-02-22 23:25 -0800
Re: asynchronous downloading Mark Hammond <mhammond@skippinet.com.au> - 2012-02-23 22:20 +1100
Re: asynchronous downloading Paul Rubin <no.email@nospam.invalid> - 2012-02-23 03:46 -0800
Re: asynchronous downloading Plumo <richardbp@gmail.com> - 2012-02-23 16:28 -0800
Re: asynchronous downloading Richard Baron Penman <richardbp@gmail.com> - 2012-02-24 00:50 +1100
Re: asynchronous downloading Giampaolo Rodolà <g.rodola@gmail.com> - 2012-02-23 18:31 +0100
Re: asynchronous downloading Plumo <richardbp@gmail.com> - 2012-02-23 17:10 -0800
Re: asynchronous downloading Plumo <richardbp@gmail.com> - 2012-02-23 17:10 -0800
Re: asynchronous downloading Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com> - 2012-02-23 18:31 -0800
Re: asynchronous downloading Giampaolo Rodolà <g.rodola@gmail.com> - 2012-02-24 10:03 +0100
Re: asynchronous downloading Richard Baron Penman <richardbp@gmail.com> - 2012-02-26 08:44 +1100
| From | Plumo <richardbp@gmail.com> |
|---|---|
| Date | 2012-02-22 22:58 -0800 |
| Subject | asynchronous downloading |
| Message-ID | <33089103.45.1329980290357.JavaMail.geo-discussion-forums@pbne2> |
I want to download content asynchronously. This would be straightforward to do threaded or across processes, but difficult asynchronously so people seem to rely on external libraries (twisted / gevent / eventlet). (I would use gevent under different circumstances, but currently need to stick to standard libraries.) I looked around and found there is little interest in developing a proper HTTP client on asyncore. The best I found stopped development a decade ago: http://sourceforge.net/projects/asynchttp/ What do you recommend? And why is there poor support for asynchronous execution? Richard
[toc] | [next] | [standalone]
| From | Justin Ezequiel <justin.mailinglists@gmail.com> |
|---|---|
| Date | 2012-02-22 23:25 -0800 |
| Message-ID | <8642ad38-41ab-4137-95bb-259e6c1fb519@qt7g2000pbc.googlegroups.com> |
| In reply to | #20712 |
have you seen http://www.doughellmann.com/PyMOTW/asyncore/
[toc] | [prev] | [next] | [standalone]
| From | Mark Hammond <mhammond@skippinet.com.au> |
|---|---|
| Date | 2012-02-23 22:20 +1100 |
| Message-ID | <mailman.72.1329996043.3037.python-list@python.org> |
| In reply to | #20712 |
On 23/02/2012 5:58 PM, Plumo wrote: > I want to download content asynchronously. This would be > straightforward to do threaded or across processes, but difficult > asynchronously so people seem to rely on external libraries (twisted > / gevent / eventlet). Exactly - the fact it's difficult is why those tools compete. > (I would use gevent under different circumstances, but currently need > to stick to standard libraries.) As above - use threads or processes - they are fine for relatively modest tasks. If your needs go beyond modest, I'd reevaluate your need to stick with just the stdlib - even demanding *sync* http apps often wind up using modules outside the stdlib. Look into virtualenv etc if permission to install packages is the issue. Batteries included free, but turbo-chargers are an extra ;) Mark
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2012-02-23 03:46 -0800 |
| Message-ID | <7x4nuhlqmf.fsf@ruckus.brouhaha.com> |
| In reply to | #20712 |
Plumo <richardbp@gmail.com> writes: > What do you recommend? Threads. > And why is there poor support for asynchronous execution? The freenode #python crowd seems to hate threads and prefer twisted, which seems to have the features you want and probably handles very large #'s of connections better than POSIX threads do. But I find the whole event-driven model to be an annoying abstraction inversion and threads to be simpler, so I've stayed with threads. I keep hearing boogieman stories about the evil hazards of race conditions etc. but none of that stuff has ever happened to me (yet) as far as I can tell. The main thing is to avoid sharing mutable data between threads to the extent that you can. Keep the threads isolated from each other except for communication through Queues and not too much can go wrong. The last program I wrote had around 20 threads and one or two condition variables and I don't think any significant bugs resulted from that. FWIW, the Erlang language is built around the above concept, it uses super-lightweight userland threads so it can handle millions of them concurrently, and it's used successfully for ultra-high-reliability phone switches and similar applications that are not allowed to fail, so it must be doing something right. There are a few schemes like Camaelia (sp?) implementing concurrency with Python generators or coroutines, but I think they're not widely used, and Python coroutines are kind of crippled because they don't carry any stack below their entry point.
[toc] | [prev] | [next] | [standalone]
| From | Plumo <richardbp@gmail.com> |
|---|---|
| Date | 2012-02-23 16:28 -0800 |
| Message-ID | <25425615.930.1330043285287.JavaMail.geo-discussion-forums@pbux2> |
| In reply to | #20723 |
My current implementation works fine below a few hundred threads. But each thread takes up a lot of memory so does not scale well. I have been looking at Erlang for that reason, but found it is missing useful libraries in other areas.
[toc] | [prev] | [next] | [standalone]
| From | Richard Baron Penman <richardbp@gmail.com> |
|---|---|
| Date | 2012-02-24 00:50 +1100 |
| Message-ID | <mailman.74.1330005055.3037.python-list@python.org> |
| In reply to | #20712 |
>> I want to download content asynchronously. This would be >> straightforward to do threaded or across processes, but difficult >> asynchronously so people seem to rely on external libraries (twisted >> / gevent / eventlet). > > > Exactly - the fact it's difficult is why those tools compete. It is difficult in Python because the async libraries do not offer much. Straightforward in some other languages. Do you know why there is little support for asynchronous execution in the standard libraries? For large scale downloading I found thread pools do not scale well. Richard
[toc] | [prev] | [next] | [standalone]
| From | Giampaolo Rodolà <g.rodola@gmail.com> |
|---|---|
| Date | 2012-02-23 18:31 +0100 |
| Message-ID | <mailman.81.1330018318.3037.python-list@python.org> |
| In reply to | #20712 |
Il 23 febbraio 2012 07:58, Plumo <richardbp@gmail.com> ha scritto: > I want to download content asynchronously. This would be straightforward to do threaded or across processes, but difficult asynchronously so people seem to rely on external libraries (twisted / gevent / eventlet). > > (I would use gevent under different circumstances, but currently need to stick to standard libraries.) > > I looked around and found there is little interest in developing a proper HTTP client on asyncore. The best I found stopped development a decade ago: http://sourceforge.net/projects/asynchttp/ > > What do you recommend? > And why is there poor support for asynchronous execution? > > Richard > -- > http://mail.python.org/mailman/listinfo/python-list If you want to stick with asyncore try to take a look at this: https://gist.github.com/1519999 > And why is there poor support for asynchronous execution? I'd say that's true for stdlib only (asyncore/asynchat). There are plenty of choices amongst third party modules though. To say one, I particularly like tornado which is simple and powerful: http://www.tornadoweb.org/documentation/httpclient.html --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/
[toc] | [prev] | [next] | [standalone]
| From | Plumo <richardbp@gmail.com> |
|---|---|
| Date | 2012-02-23 17:10 -0800 |
| Message-ID | <mailman.103.1330045834.3037.python-list@python.org> |
| In reply to | #20737 |
that example is excellent - best use of asynchat I have seen so far. I read through the python-dev archives and found the fundamental problem is no one maintains asnycore / asynchat.
[toc] | [prev] | [next] | [standalone]
| From | Plumo <richardbp@gmail.com> |
|---|---|
| Date | 2012-02-23 17:10 -0800 |
| Message-ID | <12104574.700.1330045825791.JavaMail.geo-discussion-forums@pbcwj5> |
| In reply to | #20737 |
that example is excellent - best use of asynchat I have seen so far. I read through the python-dev archives and found the fundamental problem is no one maintains asnycore / asynchat.
[toc] | [prev] | [next] | [standalone]
| From | Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com> |
|---|---|
| Date | 2012-02-23 18:31 -0800 |
| Message-ID | <mailman.105.1330050674.3037.python-list@python.org> |
| In reply to | #20773 |
[Multipart message — attachments visible in raw view] — view raw
On Thursday 23 Feb 2012 5:10:25 PM Plumo wrote: > I read through the python-dev archives and found the fundamental problem is > no one maintains asnycore / asynchat. By all means, scratch your own itch. :) -- Fayaz Yusuf Khan Cloud developer and architect Dexetra SS, Bangalore, India fayaz.yusuf.khan_AT_gmail_DOT_com fayaz_AT_dexetra_DOT_com +91-9746-830-823
[toc] | [prev] | [next] | [standalone]
| From | Giampaolo Rodolà <g.rodola@gmail.com> |
|---|---|
| Date | 2012-02-24 10:03 +0100 |
| Message-ID | <mailman.116.1330074228.3037.python-list@python.org> |
| In reply to | #20773 |
Il 24 febbraio 2012 02:10, Plumo <richardbp@gmail.com> ha scritto: > that example is excellent - best use of asynchat I have seen so far. > > I read through the python-dev archives and found the fundamental problem is no one maintains asnycore / asynchat. Well, actually I do/did. Point with asyncore/asynchat is that it's original design is so flawed and simplicistic it doesn't allow actual customization without breaking compatibility. See for example: http://bugs.python.org/issue6692 --- Giampaolo http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/
[toc] | [prev] | [next] | [standalone]
| From | Richard Baron Penman <richardbp@gmail.com> |
|---|---|
| Date | 2012-02-26 08:44 +1100 |
| Message-ID | <mailman.163.1330206283.3037.python-list@python.org> |
| In reply to | #20773 |
>> I read through the python-dev archives and found the fundamental problem is no one maintains asnycore / asynchat. > > Well, actually I do/did. ah OK. I had read this comment from a few years back: "IIRC, there was a threat to remove asyncore because there were no maintainers, no one was fixing bugs, no one was improving it, and no one was really using it" > Point with asyncore/asynchat is that it's original design is so flawed > and simplicistic it doesn't allow actual customization without > breaking compatibility. Python3 uses the same API - was there not enough interest to improve it? Richard
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web