urllib2 urlopen takes too much time

Filip Gruszczyński gruszczy at gmail.com
Sun Jun 21 12:00:31 EDT 2009


I have encountered a performance problem using suds, which was traced
down to _socket.recv. I am calling some web services and each of them
uses about 0.2 sec and 99% of this time is spent on urllib2.urlopen,
while the rest of the call is finished in milliseconds. Because of
this, my web app works really slow, especially when it must do many ws
calls. I could of course decrease the number of calls and do a lot of
caching (which would be quite perilous and I wouldn't like to delve
into this), but it seems as treating symptoms, rather than the illness
itself.

The machine I am connecting to through ws is in the same building, the
connection should be really fast and mostly it is - except for using
suds. Is it possible, that I could done something wrong and it hangs
on this socket for too long? Have anyone encountered similar problems?
Oh, and we did some profiling using also other tool written in C#,
that also uses those web services and it worked much faster, so it
doesn't seem to be connection problem.

-- 
Filip Gruszczyński



More information about the Python-list mailing list