Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-25 Thread Imran Geriskovan
On 4/25/16, cr0hn cr0hn wrote: > I uploaded as GIST my PoC code, if anyone would like to see the code or > send any improvement: > https://gist.github.com/cr0hn/e88dfb1fe8ed0fbddf49185f419db4d8 > Regards, Thanks for the work. >> 2) You cant use any blocking call anywhere in

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-25 Thread cr0hn cr0hn
Thanks for your responses. I uploaded as GIST my PoC code, if anyone would like to see the code or send any improvement: https://gist.github.com/cr0hn/e88dfb1fe8ed0fbddf49185f419db4d8 Regards, El miércoles, 20 de abril de 2016, 1:00:08 (UTC+2), Imran Geriskovan escribió: > > >1. With

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-19 Thread Imran Geriskovan
> This is a very simple example, but it illustrates some of the problems with > threading vs coroutines: >1. With threads you need more locks, and the more locks you have: a) the > lower the performance, and b) the greater the risk of introducing > deadlocks; > So please keep in mind that

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-19 Thread Tobias Oberstein
Sorry, I should have been more explicit: With Python (both CPython and PyPy), the least overhead / best performance (throughput) approach to network servers is: Use a multi-process architecture with shared listening ports (Linux SO_REUSEPORT), with each process running an event loop

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-19 Thread Gustavo Carneiro
On 19 April 2016 at 22:02, Imran Geriskovan wrote: > >> A) Python threads are not real threads. It multiplexes "Python Threads" > >> on a single OS thread. (Guido, can you correct me if I'm wrong, > >> and can you provide some info on multiplexing/context switching of

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-19 Thread Tobias Oberstein
Am 19.04.2016 um 23:02 schrieb Imran Geriskovan: A) Python threads are not real threads. It multiplexes "Python Threads" on a single OS thread. (Guido, can you correct me if I'm wrong, and can you provide some info on multiplexing/context switching of "Python Threads"?) Sorry, you are wrong.

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-18 Thread cr0hn
Thank you for your responses. The scenario (I forgot in my first post): I'm trying to improve I/O accesses (disk/network...). So, if a Python thread map with a OS 1:1 thread, and the main problem (I understood that) is the cost of context switching between of threads/coroutines... this raises

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-18 Thread Guido van Rossum
On Mon, Apr 18, 2016 at 1:26 PM, Imran Geriskovan < imran.gerisko...@gmail.com> wrote: > A) Python threads are not real threads. It multiplexes "Python Threads" > on a single OS thread. (Guido, can you correct me if I'm wrong, > and can you provide some info on multiplexing/context switching of >

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-18 Thread Imran Geriskovan
>>> I don't think you need the threads. >>> 1. If your tasks are I/O bound, coroutines are a safer way to do things, >>> and probably even have better performance; >> >> Thread vs Coroutine context switching is an interesting topic. >> Do you have any data for comparison? > My 2cts: > OS native

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-18 Thread Tobias Oberstein
Am 18.04.2016 um 21:33 schrieb Imran Geriskovan: On 4/18/16, Gustavo Carneiro wrote: I don't think you need the threads. 1. If your tasks are I/O bound, coroutines are a safer way to do things, and probably even have better performance; Thread vs Coroutine context

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-18 Thread Imran Geriskovan
On 4/18/16, Gustavo Carneiro wrote: > I don't think you need the threads. > 1. If your tasks are I/O bound, coroutines are a safer way to do things, > and probably even have better performance; Thread vs Coroutine context switching is an interesting topic. Do you have any

Re: [python-tulip] Process + Threads + asyncio... has sense?

2016-04-18 Thread Gustavo Carneiro
I don't think you need the threads. 1. If your tasks are I/O bound, coroutines are a safer way to do things, and probably even have better performance; 2. If your tasks are CPU bound, only multiple processes will help, multiple (Python) threads do not help at all. Only in the special case where