[Twisted-Python] Distributing calls over a time period

Mike Meyer mwm-keyword-twisted.c54178 at mired.org
Tue Jul 18 10:12:10 EDT 2006

I'm writing a capacity test tool for a client's web server. The idea
is to measure count how many requests exceed the spec'ed response time
under various loads, where load is specified as "M requests in N
secs". So I need to generate those M requests spaced relatively evenly
over N seconds, record the start time, and get a reasonably accurate
idea of when each requests ends.

I'm assuming that twisted callbacks will take care of the latter, and
don't have any reason to dobut that. However, the former has turned
out to be harder than I expected. I need to start the requests with
the reactor running so that previous requests will be handled
properly. The obvious solution - task.LoopingCall - isn't precise
enough, taking up to 33% more time than I'd alloted. The second
attempt - a loop using reactor.callLater with a delay based on the
requests and time left. That does slightly better, but only slightly.

Is there some other method that I might use for this? Or is twisted
the wrong tool entirely.

Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

More information about the Twisted-Python mailing list