[python-uk] urllib latency

Matt Hamilton matth at netsight.co.uk
Mon Dec 20 15:13:24 CET 2010


On 20 Dec 2010, at 14:04, Giorgio Zoppi wrote:

> 2010/12/20 Matt Hamilton <matth at netsight.co.uk>:
>> Ok, here's a non job related post...
>> 
>> Anyone know why urllib.urlopen() can be so much slower than using ab to do the same thing? I seem to be getting an extra 100ms latency on a simple HTTP GET request of a static, small image.
>> I've tried it repeatedly and get consistent results. The server under test is a cluster of Plone instances behind haproxy. The client and server are connected via 100Mbit fairly lightly loaded network.
>> 
>> I've tried taking the read() part out, still the same... I've tried using urllib2 and still pretty much the same.
> 
> How does work twisted in this case?

No idea. I've not tried to use twisted in this case. Wouldn't it be overkill? How would twisted be any different making a single request to a server? Unless I'm wrong isn't twisted's main benefit that it allows concurrency?

-Matt

-- 
Matt Hamilton                                         matth at netsight.co.uk
Netsight Internet Solutions, Ltd.          Business Vision on the Internet
http://www.netsight.co.uk                               +44 (0)117 9090901
Web Design | Zope/Plone Development and Consulting | Co-location | Hosting



More information about the python-uk mailing list