[Spread-users] Spread python poll() taking almost 100% CPU

Baillargeon, Sonny Sonny.Baillargeon at bmonb.com
Fri Oct 1 15:39:47 EDT 2004


I am a noob to spread but find it works great.  I am using the python
module 1.4 with spread 3.17.2 and python 2.3.4 on Solaris 8.

I wrote a quick little spread listner.  I run 2 spread servers per
segment and currently I am testing with 2 segments.

The problem is the spread listener is taking up close to 100% CPU when I
run the listener.  The python code is:
#!/usr/bin/env python

# Spread server proof of concept

import spread
import time
from time import strftime
import string

spreadport = '7777'
spreadserver = '@host2'
group = 'spread777'
spreadName = spreadport + spreadserver

mbox = spread.connect(spreadName, group, 0, 1)

while 1:
    if mbox.poll():
        msg = mbox.receive()
        if type(msg) == spread.RegularMsgType:
            message = msg.message
            now = strftime('%a %d %b %Y %H:%M:%S', time.localtime())
            print 'MESSAGE(' + now +'): %s' % message

Is there a better way of listen for spread messages?  Is the poll()
causing my cpu issue?


<FONT SIZE = 1>****************************************************************************
This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. Unless otherwise stated, opinions expressed in this e-mail are those of the author and are not endorsed by the author's employer.</FONT>

More information about the Spread-users mailing list