[Twisted-Python] newbe twisted xmpp load

Wrene Robyn wrobyn at cox.net
Fri Mar 9 14:34:47 MST 2007


and for some reason from twisted.words.protocols.jabber.jid
imports reactor but doesnt use it as far as I can tell, that caused  
the below code to fail if you imported pollreactor.
Still would love to see an example of the below code converted to use  
pollreactor

On Mar 9, 2007, at 7:04 AM, Wrene Robyn wrote:

> Hi,
> Yes I am on os X. Could you show me how to convert my code below to  
> use poll? Thanks!
> [mport sys
> import socket
> import time
> import resource
> from threading import Thread
> from twisted.words.protocols.jabber import client, jid
> from twisted.words.xish import domish
> from twisted.internet import reactor
>
> resource.setrlimit(8,[65000,65000])
> class testit():
>
>     def authd(xmlstream):
>         print "authenticated"
>
>         presence = domish.Element(('jabber:client','presence'))
>         xmlstream.send(presence)
>     #xmlstream.addObserver('/message',  debug)
>     #xmlstream.addObserver('/presence', debug)
>     #xmlstream.addObserver('/iq',       debug)
>
>     def debug(elem):
>         print elem.toXml().encode('utf-8')
>         print "="*20
>     for i in range(981,2000):
>         print i
>         myJid = jid.JID(str(i)+'@jbrsrvrnamt/twisted_words')
>         factory = client.basicClientFactory(myJid, 'test')
>         factory.addBootstrap('//event/stream/authd',authd)
>         reactor.connectTCP('jbrsrvrname',5222,factory)
>
>     reactor.run()
>
> current = testit()
> current.start()
>
> On Mar 6, 2007, at 10:01 AM, Jean-Paul Calderone wrote:
>
>> On Tue, 6 Mar 2007 9:44:49 -0500, wrobyn at cox.net wrote:
>>> Hello,
>>> I am attempting to write an xmpp load testing thingy in python. I  
>>> am hitting big walls with regard to creating concurrent  
>>> connections above 250.. I need really 1-n concurrent connections,  
>>> the upper limit would be around 500,000 but I would be happy at  
>>> this point breaching the 250 ceiling.
>>> Would twisted be able to handle this? Can someone post a simple  
>>> loop or routine to log in 1-n "people" (i am using the increment  
>>> in a counter as username) into a jabber server?
>>
>>> From the ~250 limit, I would guess you're on OS X and running  
>>> into the
>> default per-process open file limit.  You can raise this using the  
>> `ulimit'
>> command. If you're on some other platform, then it'd be helpful if  
>> you gave
>> more details about the exact failure you're running into.
>>
>> Overall, if you use the select reactor, you're limited to  
>> FD_SETSIZE, which
>> varies, but is usually within an order of magnitude of 1000.  If  
>> you use the
>> poll reactor, then you're limited to the number of TCP connections  
>> you can
>> have, which is going to be at most 65000 per IP address (and  
>> possibly as low
>> as 32000).  You might find performance lacking with large numbers  
>> of clients
>> even with the poll reactor, but the epoll reactor should do  
>> somewhat better.
>>
>> I don't know if you'll be able to do 500k with a single process,  
>> but I think
>> you should at least be able to get to the point where the limit  
>> you hit is
>> the CPU, not something related to file descriptors.
>>
>> Jean-Paul
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list