Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31486

bad httplib latency due to IPv6 use

From Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Newsgroups comp.lang.python
Subject bad httplib latency due to IPv6 use
Date 2012-10-17 09:55 +0200
Message-ID <1s42l9-9al.ln1@satorlaser.homedns.org> (permalink)

Show all headers | View raw


Hi!

I noticed yesterday that a single HTTP request to localhost takes 
roughly 1s, regardless of the actually served data, which is way too 
long. After some digging, I found that the problem lies in 
socket.create_connection(), which first tries the IPv6 ::1 and only then 
tries the IPv4 127.0.0.1. The first one times out after 1s, causing the 
long latency.

What I'm wondering is this:
1. The server only serves on IPv4, changing this to IPv6 would probably 
help. However, I wouldn't consider this a bug, or?
2. I don't even have any IPv6 addresses configured and I'm not using 
IPv6 in any way, so why does it try those at all?
3. Of course I can optimize the code for IPv4, but then I would be 
pessimizing IPv6 and vice versa...

Any other suggestions?

Uli


Notes:
  * Using 127.0.0.1 as host works without the delay.
  * I'm using Python 2.7 on win7/64bit

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

bad httplib latency due to IPv6 use Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-17 09:55 +0200
  Re: bad httplib latency due to IPv6 use Hans Mulder <hansmu@xs4all.nl> - 2012-10-17 11:37 +0200
    Re: bad httplib latency due to IPv6 use Chris Angelico <rosuav@gmail.com> - 2012-10-17 20:44 +1100
    Re: bad httplib latency due to IPv6 use Laszlo Nagy <gandalf@shopzeus.com> - 2012-10-17 11:58 +0200
  Re: bad httplib latency due to IPv6 use Roy Smith <roy@panix.com> - 2012-10-17 08:17 -0400
  Re: bad httplib latency due to IPv6 use Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-17 14:40 +0200
    Re: bad httplib latency due to IPv6 use Chris Angelico <rosuav@gmail.com> - 2012-10-18 00:32 +1100
    Re: bad httplib latency due to IPv6 use Roy Smith <roy@panix.com> - 2012-10-17 20:28 -0400
      Re: bad httplib latency due to IPv6 use Chris Angelico <rosuav@gmail.com> - 2012-10-18 14:42 +1100

csiph-web