[Python-Dev] Synchronous and Asynchronous servers in the standard
library
"Martin v. Löwis"
martin at v.loewis.de
Mon Nov 8 06:50:25 CET 2004
Andrew Bennetts wrote:
> One such list is here:
> http://mail.zope.org/pipermail/zope3-dev/2002-October/003235.html
I fail to see any of these as problematic:
1. invokes readable/writable in each round, thereby not preserving
state; presumably ok for select and poll, but bad (wasting
performance for kqueue).
I can't see this as a problem: asyncore does use select/poll,
not kqueue. In doing so, it first processes all ready file
descriptors before going to the next round, so in the next
round, it needs to check all dispatchers again.
There seems to be an implicit assertion that anything that uses
select/poll must be evil, and the only true API is kqueue.
I can't claim to understand the rationale for introducing
kqueue in the first place, but if it is to improve performance,
then I expect that any performance gained in kqueue over
select goes away by using Python (e.g. adding an indirection
in dispatching is probably more expensive than what kqueue
would have saved).
2. ties together protocol and transport. So what? I don't
want to use SMTP over UDP, or X.25. TCP, possibly together
with TLS, is just fine.
3. tied to sockets. Again: so what? I can't follow the assertion
that you cannot use pyOpenSSL because of that, but then,
I haven't used pyOpenSSL. The only possible interpretation
is that pyOpenSSL does not expose "raw" (pollable) socket
objects, which would really sound like a limitation in
pyOpenSSL, not in asyncore.
a. Cannot use NT I/O completion ports. Again, what's wrong
with select? Performance? I'd really like to see a Python
application where the speed gain from IOCP is significant
compared to using select. The limit of 64 sockets is serious,
but Python bumps it to 512.
b. cannot do the the TCP transfer code in the C networking
core. I don't really understand that point. What is the
TCP transfer code?
Regards,
Martin
More information about the Python-Dev
mailing list