<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi zipxing,<br><br></div><div class="gmail_quote">You don't mention the interpreter. Is it CPython? What kind of results do you get trying it on PyPy?<br>

<br>Also, you don't need to specify epollreactor. Recent versions of twisted will automagically choose the appropriate backend. I fixed this and some other cleanups and got:<br>
<br>----<br>from time import clock<br>from twisted.internet import protocol, reactor<br>from twisted.protocols import basic<br><br>class MeasuringEchoProtocol(basic.LineReceiver):<br>    MEASUREMENT_INTERVAL = 1000<br><br>


    def lineReceived(self, data):<br>        self.factory.requests += 1<br>        if self.factory.requests % self.MEASUREMENT_INTERVAL == 0:<br>            print "RPS: {0}".format(self.factory.requests / clock())<br>


<br>        self.transport.write(data)<br><br><br><br>class ServerFactory(protocol.ServerFactory):<br>    protocol = MeasuringEchoProtocol<br><br>    def __init__(self):<br>        self.requests = 0<br><br><br><br>def main():<br>


    reactor.listenTCP(9976, ServerFactory())<br>    clock()<br>    reactor.run()<br><br>if __name__ == '__main__':<br>    main()<br>----<br><br></div><div class="gmail_quote">Keep in mind that due to setup time few requests get handled right when it starts, so the server RPS will take some time to balance out. On my wimpy laptop on battery power, that was around 420.274404782.<br>

<br></div><div class="gmail_quote">cheers<br>lvh<br>
</div></div></div>