[Twisted-Python] Accurate delays in callLater
Ian Duggan
ian at ianduggan.net
Thu Jun 23 18:05:04 EDT 2005
On Thursday 23 June 2005 13:49, George Sakkis wrote:
> Normally 'feel' messages arrive every 100ms and 'see' every 150ms. That's
> more or less what I observe when the processing of 'see' is turned off.
> When it is on however, messages are received with bursts, e.g. 7 'feel'
> messages within 200ms instead of 2. This is surprising because if I
> believe the profiler, 'see' is usually processed in 25 to 55ms, so a delay
> of 60ms should be long enough. Is it going to help if the processing of
> 'see' is dispatched in a separate thread ?
Hmm. My gut tells me that your "see" processing is not fast enough (or
something is blocking), and things are backing up in queues. When it comes
around to service your "feel" messages (once things are backed up) it goes
through 7 very quickly since they are cheap to process.
If this is the case, moving "see" to a thread might help.
You might also try out the BigTimesliceTimer stuff and see if you are
"blocking" for too long.
http://svn.twistedmatrix.com/cvs/sandbox/exarkun/btt.py
http://svn.twistedmatrix.com/cvs/sandbox/exarkun/test_btt.py
As an aside, what is considered a reasonable amount of time for a function to
run in in twisted?
--Ian
More information about the Twisted-Python
mailing list