[Twisted-Python] Distributing calls over a time period

Jean-Paul Calderone exarkun at divmod.com
Tue Jul 18 10:31:22 EDT 2006


On Tue, 18 Jul 2006 10:12:10 -0400, Mike Meyer <mwm-keyword-twisted.c54178 at mired.org> wrote:
>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.

What platform are you running on?  On any recent Linux system,
LoopingCall should be more than precise enough for this.

Can you be more specific about what you mean by "taking up to 33%
more time"?

What kind of time units are we talking about here?

Jean-Paul




More information about the Twisted-Python mailing list