Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9048 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2011-07-08 04:26 +1000 |
| Last post | 2011-07-08 07:18 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: making socket.getaddrinfo use cached dns Chris Angelico <rosuav@gmail.com> - 2011-07-08 04:26 +1000
Re: making socket.getaddrinfo use cached dns Nobody <nobody@nowhere.com> - 2011-07-08 07:18 +0100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-07-08 04:26 +1000 |
| Subject | Re: making socket.getaddrinfo use cached dns |
| Message-ID | <mailman.757.1310063200.1164.python-list@python.org> |
On Fri, Jul 8, 2011 at 4:18 AM, high bandwidth <widebandwidth@gmail.com> wrote: > I use cached dns lookups with pdnsd on my ubuntu machine to speed up web > access as regular lookups can take 15-30 seconds. However, python's > mechanize and urllib etc use socket.getaddrinfo, which seems not to be using > dns cacheing or taking a long time because of ipv6 lookups. In either case, > I subsequent access to the same site to be fast and not require lengthy > calls to getaddrinfo. How can I get python to correctly use cached dns > lookups and ipv4 only (at least in those cases where it is appropriate). One solution would be to do your own DNS lookups and then pass urllib an IP address. Is pdnsd set up to be your computer's primary resolver? (Is /etc/resolv.conf pointing to localhost?) If not, that might help. I've generally done my DNS caching using BIND, so I can't help with pdnsd specifically. ChrisA
[toc] | [next] | [standalone]
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Date | 2011-07-08 07:18 +0100 |
| Message-ID | <pan.2011.07.08.06.18.35.391000@nowhere.com> |
| In reply to | #9048 |
On Fri, Jul 8, 2011 at 4:18 AM, high bandwidth <widebandwidth@gmail.com> wrote: >> I use cached dns lookups with pdnsd on my ubuntu machine to speed up >> web access as regular lookups can take 15-30 seconds. However, python's >> mechanize and urllib etc use socket.getaddrinfo, which seems not to be >> using dns cacheing or taking a long time because of ipv6 lookups. In >> either case, I subsequent access to the same site to be fast and not >> require lengthy calls to getaddrinfo. How can I get python to correctly >> use cached dns lookups and ipv4 only (at least in those cases where it >> is appropriate). To only query IPv4 addresses, pass socket.AF_INET as the third argument (family) to socket.getaddrinfo(). The default is AF_UNSPEC (= 0), which will return both IPv4 and IPv6 addresses.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web