Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:skip:s 10': 0.07; 'string': 0.09; 'lookup': 0.09; 'skip:/ 10': 0.09; 'slow.': 0.09; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:slow': 0.16; 'two.': 0.16; 'wrote:': 0.18; 'things.': 0.19; 'header:User-Agent:1': 0.23; 'comparing': 0.24; 'server.': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'subject:) ': 0.29; 'addresses': 0.33; 'subject:from': 0.34; 'subject: (': 0.35; 'machine.': 0.36; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'checks': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'email addr:gmail.com': 0.63; 'different': 0.65; 'subject:skip:g 10': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Sat, 31 Aug 2013 23:06:43 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) References: <48c8f8ca-d8c1-4a60-ba7f-8e8b00993f15@googlegroups.com> In-Reply-To: <48c8f8ca-d8c1-4a60-ba7f-8e8b00993f15@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378012017 news.xs4all.nl 15988 [2001:888:2000:d::a6]:52751 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53398 On 08/31/2013 10:51 PM, anntzer.lee@gmail.com wrote: > It is the call to gethostbyname_ex that is very slow. The call to > gethostname is quick (and returns the same string as > /usr/bin/hostname). What gethostbyname_ex and /usr/bin/hostname do are very different things. gethostbyname_ex does a DNS lookup against a server. /usr/bin/hostname just checks a local computer setting. I don't see why you are comparing the two. /usr/bin/hostname is not going to help you find a list of IP addresses that point to a machine.