[Twisted-Python] Help for Twisted + Thread + Message Queue

Laurens Van Houtven _ at lvh.io
Fri Oct 4 04:15:59 MDT 2013


On Fri, Oct 4, 2013 at 10:59 AM, Stefano Danzi <s.danzi at hawai.it> wrote:

> Hi Laurens,
> many thanks for yours considerations.
>
> 1) I don't have problems about latency but I can't halt all during the
> computation.


Why not?


> I can defer the computation for minutes if I attach to data the timestamp
> related to when data arrives.
>

Sure, gettimeofday is a thing, that shouldn't be a problem.


> 2) The "monster" machine that have to do all is an embedded pc based on
> 1000MHz AMD Geode NX1500
>

Okay, so single core.


> 3) The long computation need only the data. In extremis I could write data
> on a file or DB and compute using another program.
>

I would imagine you do that anyway for persistence reasons with the results
:)


> I bit better explanation of scenario:
>
> The radiomodem take "unexpected data" from a network of varius sensors.
> The sensors could be reachable or not.
> The only way to know when the sensor is reachable is to wait fo
> "unexpected data". If I need to send data to a specific sensor
> I have to do it immediatly after it send me "unexpected data", wait also 1
> second could be sufficient to have the sensor no longer reachable.
>
I can't send data to sensor and after do computation because meanwhile
> could arrive data from another sensor.
>
Mainly it is the reason because I think to defer long computation to
> another thread..
>

Okay, so try with threads first, and hope that the scheduler lets your
reactor thread work often enough. If that doesn't work, do the computation
in a subprocess, and hope that nice works well enough :)

lvh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20131004/74af4f76/attachment.html>


More information about the Twisted-Python mailing list