10.10.2012 17:02, Serge S. Koval пишет:
> On Wed, Oct 10, 2012 at 2:52 PM, Andrew Grigorev <
and...@ei-grad.ru
> <mailto:
and...@ei-grad.ru>> wrote:
>
> Would you also say that ioloop.add_callback is not
> asynchoronous, because it executes the callbacks in the same
> order in which they where added?
>
> Bad example - you can listen for FD events and, suddenly, your
> callbacks are out of order. Same as ioloop.add_timeout and so on.
I said "ioloop.add_callback". It doesn't listen any FDs for events. Its
callbacks are just called in every IOLoop cycle with "for callback in
self._callbacks" loop in place.
> Anyway, there was miscommunication - you're talking about redis driver
> (toredis) implementation and its asynchronous API, I was more into
> lower level protocol, which is synchronous. Obviously, you can write
> asynchronous library which works with synchronous protocol by queueing
> requests and expecting replies in proper order from the service. I'm
> not even arguing here.
It seems for me, like you are associating a strange thing with the
"asynchronous" in your mind. Redis protocol, on the "lower level", is
not synchronous. You can send new requests while you recieving the
answers to other requests, which were sent earlier. It is how
"pipelining" works (also, I found it quite funny when discovered [some
years ago] that such behaviorof the network protocols has its own name
:-) ).
I understand "synchronous" as you have to wait the result of the current
operation, before you execute the next. May be I understand it wrong?
> And yes, after thinking about it - having one connection for tornado
> app to redis should work unless you have pretty heavy traffic and will
> send data faster than redis can handle it.
It would not work if you want to use the redis transactions in
asynchronous request handler. Also, there is a PubSub.
> If redis can't recv() data before internal socket buffer will be
> filled, connection will be dropped. Should not be the problem, as it
> is highly unlikely that 1 tornado process can create so much load on
> one redis server.
You saying a strange thing. Could you justify your words by any
references to redis (or linux, probably) source code?)
Actually, there are mechanisms in TCP, which would regulate the data
flow to ammend the situation described by you.
> Serge.
Btw, our conversation reminded me this post -
http://softwaremaniacs.org/blog/2009/12/13/unfortunate-asynchronism/ :-).
So, lets just stop this useless flame...
--
Andrew