Thanks all for the thoughts.<br clear="all"><br>Clinching drivers for us to choose AMQP (RabbitMQ) include built-in persistence, manual ACK (ie only when finished, not just when pulled), plus the obviously strong configuration-driven routing capabilities.<div>

<br></div><div>With this distributed architecture using rabbit, we&#39;re not likely to pursue a hot-swap design with Twisted - there wouldn&#39;t be the same payback compared with the ease with which new entire adapter service code can be deployed with rabbit maintaining messages between components. It is something I&#39;ve come back to a few times though - have thought roughly about the idea of an enhanced Service class that can be easily swapped in and out.</div>

<div><br></div><div>The plan was that if we continued with <i>n </i>Twisted services attached by rabbit queues that we&#39;d eventually build some manner of central Manager that could be responsible for tracking these things. In fact we may extend it to become a deployment manager as well at some point, that could control the graceful swapping out of Twisted services.</div>

<div><br></div><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

Introducing these kinds of limits into the Twisted ecosystem would not be impossible, but it is very challenging, because you&#39;d have to come up with a model that applied equally well to all of the supported protocols and all the ways you might want to store state within those protocols.</blockquote>

<div>On this note, I hadn&#39;t aimed for the gold-plated approach of persisting every state - we have stateful objects that we pass around and was thinking more of closing all inbound services, waiting for completion, then closing outbound services and persisting these objects&#39; state. That would be less reusable across Twisted as a whole, I understand, but certainly makes for a more easily consumable first bite. </div>

<div><br></div><div>Fair enough re &#39;best-practice&#39; :) I knew if I went as far as to ask that, I&#39;d get a reasonable gauge back at least</div><div><br></div><div>Thanks again</div><div>Brad</div><div><br></div>
<div>
PS - Christopher, I look forward to seeing that lib</div><div><br><br><div class="gmail_quote">On 21 October 2011 07:13, Glyph <span dir="ltr">&lt;<a href="mailto:glyph@twistedmatrix.com">glyph@twistedmatrix.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Oct 20, 2011, at 6:50 AM, Brad Milne wrote:<br>
<br>
&gt; We have a core message-handling platform which encompasses an ever-increasing array of modules and services run inside one Twisted process. This is good as it means the reactor is in control of most of the stuff relevant to it. However, as the number of deployed services within it grows, it becomes increasingly burdensome to have all the modules in a single deployed codebase running in a single launched process.<br>


&gt; Java has JEE; erlang has hot code loading; x has y; what does Twisted have? pb?<br>
<br>
</div>Erlang can do this because it has a strict separation of state and behavior (in the vernacular, &quot;it is not object-oriented&quot;) and J2EE can do this because it requires you to externalize all your state - usually to a relational database.  Part of the appeal of Twisted is that you can freely use simple, in-memory mutable data structures to store your mutable state.<br>


<br>
Introducing these kinds of limits into the Twisted ecosystem would not be impossible, but it is very challenging, because you&#39;d have to come up with a model that applied equally well to all of the supported protocols and all the ways you might want to store state within those protocols.<br>


<div class="im"><br>
&gt; To date we have begun introducing RabbitMQ (AMQP), with separate Twisted processes running as adapters at either end of queues. On the surface this fits nicely as it provides distributed architecture, resilience through isolation, and decoupled upgrade paths. On the flipside though, it means more technology and more processes running outside of a singleton Twisted reactor (read: OS process management, which Twisted&#39;s designed to be better than).<br>


<br>
</div>I&#39;m not sure what you mean by &quot;OS process management&quot; versus &quot;Twisted process management&quot;.  It&#39;s true that you get some benefits from using spawnProcess to manage your subprocesses, since you can write code to automatically start and stop them in response to certain stimuli, but this relies completely on however it is your OS starts and stops processes.  Why not just have a Twisted monitor process that starts and monitors the health of all of your queue producer/consumer processes?  Then you should get the best of both worlds.<br>


<div class="im"><br>
&gt; So my questions:<br>
&gt; 1) I&#39;m right, right? Twisted doesn&#39;t have mechanisms or a library for hot swapping code modules or similar solutions for low impact upgrades and high availability? (I originally read about Twisted *plugins* hoping for this, but was disappointed to find how basic they actually were)<br>


<br>
</div>Reza already replied with a pretty good list of possible options for this, but: no, there&#39;s no single, one-size-fits-all solution for this.<br>
<br>
And there could be!  As I said above, it&#39;s tricky, but if you could think of a good design for such a system, I&#39;d absolutely LOVE for it to be in Twisted.  Please feel free to contribute something :).<br>
<div class="im"><br>
&gt; 2) Is RabbitMQ with txAMQP-empowered Twisted instances on the ends of the queues a sensible, compatible, best-practice approach as agreed by the community?<br>
<br>
</div>No.<br>
<br>
I don&#39;t mean that it doesn&#39;t work, I just don&#39;t like the term &quot;best-practice&quot;.<br>
<br>
Maybe your implementation is a good idea, maybe not.  But if I said it&#39;s a &quot;best practice&quot;, that would relieve you of the need to think critically about whether or not this approach was satisfying your requirements.  There are some cases where this is a good idea, some not.  There are some people in the community who have had good experiences with this approach; I personally don&#39;t use it.<br>


<br>
You&#39;ll have to be the judge of whether it&#39;s working for you or not.<br>
<div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br></div></div>