Performance Issues with Threaded Python Network Server

Joao Prado Maia JMaia at lexgen.com
Thu Jan 17 08:53:30 EST 2002


> > Well, the python server is supposed to work in paralel with 
> the actual
> > message board software, which does everything related to 
> the database,
> > managing users and so on. The server just inserts a new row on the
> > appropriate table with the article posted by the user.
> >
> > I'm thinking on even setting a constant on the code that 
> even tells the
> > server to act as a read-only server and start ignoring 
> postings. In any
> > case, you are right, I should add a little bit more of 
> documentation but
> I'm
> > still researching on the matter and finding problems that need to be
> fixed.
> >
> If the dataabse is only ever used to send out postings, you 
> might consider
> doing the dot-escaping when you add the articles to the 
> database, rather
> than when you extract them for transmission.
> 
> one-time-only-is-better-than-whenever-needed-ly y'rs  - steve

Very true, but I would need to change the software that does the majority of
the inserts into the database (the actual web message board software) to
make this happen. My original goal for this little news server was to just
'plug-and-use' into any existing web message board software. If I needed to
change it then it would be an extra level of complexity.

In any case, I'm sending this to tell you that I found the reason of the
heavy CPU usage on the script. It was actually Outlook Express that is the
buggy element here - it sends spurious null lines after receiving random
numbers of articles. I had already seen that and I did even add a check for
'<blank>' lines coming from the socket that are not coming while someone is
trying to do a POST, but I wasn't doing anything other than a 'continue' in
the loop.

What I did was add a flag variable and increment it until it went up to 10
lines of consecutive '<blank>' lines, and disconnect the user on this case.
This way I wouldn't stay on the infinite loop of Outlook sending me crap
while I ignored the '<blank>' lines.

Anyway, now it's all good - CPU stays at 0.20% most of the times :)

Thanks for all your help,
Joao


--
Joao Prado Maia
Software QA
Bioinformatics Dept.
Lexicon Genetics, Inc.


*************************************************************************** 
 The contents of this communication are intended only for the addressee and
may contain confidential and/or privileged material. If you are not the
intended recipient, please do not read, copy, use or disclose this
communication and notify the sender.  Opinions, conclusions and other
information in this communication that do not relate to the official
business of my company shall be understood as neither given nor endorsed by
it.  
*************************************************************************** 






More information about the Python-list mailing list