[Twisted-Python] How to dispatch message to different servers

Tristan Seligmann mithrandi at mithrandi.net
Sat Mar 2 10:24:08 EST 2013


On Sat, Mar 2, 2013 at 3:46 PM, Phil Mayers <p.mayers at imperial.ac.uk> wrote:
> AMP would be somewhat more attractive (to me) if it were possible to run
> with the IDL just on the "server" (i.e. callee); this would achieve the
> goal of protocol-level sanity checking, without the cost of having to
> distribute the IDL to the clients. Presumably it would be possible to
> implement this now - have an AMP discovery command that dynamically
> builds the client-side IDLs. But there's no incentive for me to do that.

I don't really understand how this is any easier with PB than with
AMP, though. With AMP, you "just" need the same command definitions on
both sides. With PB, you need the exact same Python code versions for
every class you are sending over the wire; if achieving this is not a
problem, then why is it problematic to get the same AMP command
definitions on both sides?

> You don't need to do a TCP handshake for every request in any of those
> protocols either. Long-lived TCP/HTTP sessions are quite common, though
> not universal.

You don't quite have to do a TCP handshake for every request you want
to send over an HTTP channel, but there are still some problems.
Connection keep-alive means you can send another request after you
have received a response, without reconnecting; pipelining means you
can send another request right away, but you still won't get the
response until after you receive the first response. In addition,
there are various error handling situations where you are basically
forced to close the connection and open a new one. By contrast, an AMP
connection can have any number of AMP request/response exchanges in
flight at one time, in either direction; the closest thing to this in
HTTP-land is SPDY's connection multiplexing, but that's still
asymmetric (client makes requests to the server, server cannot make
requests to the client, so you need to do some kind of long polling /
inversion of control to simulate this).
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar



More information about the Twisted-Python mailing list