[Twisted-Python] Load testing twistd + twisted.soap

Matthew Glubb matt at zgroupplc.com
Fri Apr 27 04:51:05 MDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

I am attempting to write a simple load test for my soap web services.  
I am running the application under twistd and using trial for unit  
tests. I understand that for a real load test, I would use a tool  
like ab or http_load in a more scientific environment but I want to  
get a quick feel for how well a twisted application stands up against  
low levels of load on my dev box and I feel that there is merit in  
setting a baseline level of performance in a unit test.

I am running into problems with the following:

class SOAPTestCase(BaseTestCase):

     url = 'http://localhost:8080/'

     def setUp(self):
         self.proxy = Proxy(self.url)

     def testMutipleAPCs(self):
         """Assert that multiple APCs succeed"""
         deferred = defer.Deferred()
         for i in range(100):
             d = self.testAPCTimeout()
             d.chainDeferred(deferred)
         return deferred

     def testAPCTimeout(self):
         deferred = self.proxy.callRemote('processApc', 0,  
self._getRandomString())
         deferred.addBoth(self.APCTimeout)
         return deferred

     def APCTimeout(self, result):
         requestIdForApc, requestDataForApc, errorFlag, result = result

         self.assertEqual(result, res)
         self.assertTrue(isinstance(requestIdForApc, str))
         self.assertEqual(id, requestIdForApc)
         self.assertTrue(isinstance(requestDataForApc, str))
         self.assertEqual(data, requestDataForApc)

         self.assertTrue(isinstance(errorFlag, str))
         self.assertEqual(cp.cp_base.getErrorFlag(cp.cp_base.APC,  
err), errorFlag)

For a start, I get a lot of 'reactor left in unclean state' warnings.  
This number of twisted.internet.tcp.Client instances that this  
reports on is never usually all of them:

twisted.trial.util.DirtyReactorError: THIS WILL BECOME AN ERROR SOON!  
reactor left in unclean state, the following Selectables were left  
over:  <<class 'twisted.internet.tcp.Client'> to ('localhost', 8080)  
at 1782390> <<class 'twisted.internet.tcp.Client'> to ('localhost',  
8080) at 1782150> ...

In addition I get pending time calls still pending:

twisted.trial.util.PendingTimedCallsError: pendingTimedCalls still  
pending (consider setting twisted.internet.base.DelayedCall.debug =  
True): <DelayedCall 24636392 [24.8269200325s] called=0 cancelled=0  
Client.failIfNotConnected(TimeoutError('',))> ...

Does any twisted genius have any idea what I am doing wrong?

Regards,


Matt


m a t t h e w   g l u b b

________________________________________________________________________
Z Group PLC

Tel: +44 (0) 8700 111 173
Fax: +44 (0) 8707 051 393
Txt: +44 (0) 7800 140 877
Web: <http://www.zgroupplc.com/>

This  email  and  any  files  transmitted  with it are  confidential and
intended solely for the use of the individual or entity to whom they are
addressed.  The opinions  expressed in this mail are those of the author
and do not necessarily  represent the views of the company.  If you have
received this email in error please notify <service at zgroupplc.com>



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFGMdWcyI6MkdKPngkRAqTgAJ9I9dxz3B3EYPMfY8fY09kVqmVMdACfSqa2
wPgXzPQMX+FgKcC41oWEQA8=
=V8JT
-----END PGP SIGNATURE-----




More information about the Twisted-Python mailing list