threads and memory

Lee Leahu lee at ricis.com
Mon Feb 6 13:44:00 EST 2006


Hi List,

> >I am trying to write a simple threaded application which will simulate 1000 
> >connections to a remote service in order to "stress test" that the remote 
> >service can handle that many connections.
> [...]
> >Is there a way to accomplish what I am trying to do, perhaps in a more 
> >memory-friendly way?
> 
> Yes. You don't need one thread per connection:
> http://docs.python.org/lib/module-asyncore.html

I am running into a problem where asyncore is through a filedescriptor error if I try to launch more that 1023 connections:
------------------------------------
Traceback (most recent call last):
  File "./test.py", line 46, in ?
    asyncore.loop()
  File "/usr/lib/python2.4/asyncore.py", line 192, in loop
    poll_fun(timeout, map)
  File "/usr/lib/python2.4/asyncore.py", line 122, in poll
    r, w, e = select.select(r, w, e, timeout)
ValueError: filedescriptor out of range in select()
------------------------------------

Is there a limitation on the number of simultaneous connects that can be made with asyncore ?

Attached is the updated source code.

Thanks!

-- 
Lee Leahu                           RICIS, Inc.
Internet Technology Specialist      866-RICIS-77 Toll Free Voice (US)
lee at ricis.com                       708-444-2690 Voice (International)
http://www.ricis.com/               866-99-RICIS Toll Free Fax (US)
                                    708-444-2697 Fax (International)

RICIS, Inc. is a member of the Public Safety Alliance Group

This email and any attachments that are included in it have been scanned
for malicious or inappropriate content and are believed to be safe.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 1080 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20060206/8cd43007/attachment.py>


More information about the Python-list mailing list