Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   netstat performance (http://www.linux-archive.org/debian-user/546104-netstat-performance.html)

ChadDavis 06-29-2011 04:15 PM

netstat performance
 
I notice that the following two invocations of netstat have
drastically different execution times:

netstat

netstat -n


When you just use numerical addresses, it executes almost instantly,
but with the domain names and whatever you call those logical names
for the port numbers, such as 'www', it takes quite while ( 5-10
seconds).

Not a big deal, but just made me think. Surely the name resolution
isn't that costly is it?


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTi==1biom+qm_EbR0jL+MMk4oAF10g@mail.gmail.com ">http://lists.debian.org/BANLkTi==1biom+qm_EbR0jL+MMk4oAF10g@mail.gmail.com

ChadDavis 06-29-2011 04:15 PM

netstat performance
 
I notice that the following two invocations of netstat have
drastically different execution times:

netstat

netstat -n


When you just use numerical addresses, it executes almost instantly,
but with the domain names and whatever you call those logical names
for the port numbers, such as 'www', it takes quite while ( 5-10
seconds).

Not a big deal, but just made me think. Surely the name resolution
isn't that costly is it?


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTi==1biom+qm_EbR0jL+MMk4oAF10g@mail.gmail.com ">http://lists.debian.org/BANLkTi==1biom+qm_EbR0jL+MMk4oAF10g@mail.gmail.com

Camaleón 06-29-2011 05:16 PM

netstat performance
 
On Wed, 29 Jun 2011 10:15:58 -0600, ChadDavis wrote:

> I notice that the following two invocations of netstat have drastically
> different execution times:
>
> netstat
>
> netstat -n
>
>
> When you just use numerical addresses, it executes almost instantly, but
> with the domain names and whatever you call those logical names for the
> port numbers, such as 'www', it takes quite while ( 5-10 seconds).
>
> Not a big deal, but just made me think. Surely the name resolution
> isn't that costly is it?

That's normal... yes, resolving names takes some time :-)

Another example:

sm01@stt008:~$ time /sbin/route
(...)

real 0m5.018s
user 0m0.000s
sys 0m0.000s

sm01@stt008:~$ time /sbin/route -n
(...)

real 0m0.001s
user 0m0.000s
sys 0m0.000s

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2011.06.29.17.16.38@gmail.com">http://lists.debian.org/pan.2011.06.29.17.16.38@gmail.com

William Hopkins 06-29-2011 05:51 PM

netstat performance
 
On 06/29/11 at 10:15am, ChadDavis wrote:
> I notice that the following two invocations of netstat have
> drastically different execution times:
>
> netstat
>
> netstat -n
>
>
> When you just use numerical addresses, it executes almost instantly,
> but with the domain names and whatever you call those logical names
> for the port numbers, such as 'www', it takes quite while ( 5-10
> seconds).
>
> Not a big deal, but just made me think. Surely the name resolution
> isn't that costly is it?

Depends on latency and distance to your DNS server, how long it takes the DNS
server to perform the recursive query or forward to a server which does,
whether you have the answer cached locally or at any of the servers along the
way, etc. So it can vary wildly.. 5 seconds seems high to me, it takes about 1
for me and I have a lot of active connections.

--
Liam

Glenn English 06-29-2011 06:22 PM

netstat performance
 
On Jun 29, 2011, at 11:51 AM, William Hopkins wrote:

> On 06/29/11 at 10:15am, ChadDavis wrote:
>> Not a big deal, but just made me think. Surely the name resolution
>> isn't that costly is it?
>
> Depends on latency and distance to your DNS server, how long it takes the DNS
> server to perform the recursive query or forward to a server which does,
> whether you have the answer cached locally or at any of the servers along the
> way, etc. So it can vary wildly.

Exactly. If you keep a well populated /etc/hosts, it'll be snappy as hail -- it's a disk hit (if your resolver is configured to go to hosts first, and you keep hosts updated). If your computer has to go to your ISP for cached info, that's a 'Net hit, and can take some time, depending on your latency and bandwidth. If your ISP doesn't have the lookup cached, there are several 'Net hits involved.

If you have a cacheing DNS server locally, you can save significant time on DNS lookups -- cached stuff is (best case) a RAM hit, worst case, Ethernet.

For a good time, 'apt-get install bind' :-)

--
Glenn English



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1CE428AF-0FF0-42C4-B216-9F606D431D4E@slsware.com">http://lists.debian.org/1CE428AF-0FF0-42C4-B216-9F606D431D4E@slsware.com

Brian 06-29-2011 07:08 PM

netstat performance
 
On Wed 29 Jun 2011 at 12:22:26 -0600, Glenn English wrote:

> For a good time, 'apt-get install bind' :-)

For an even better time (and to escape the monoculture)

apt-get install unbound

:-)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110629190816.GA15615@desktop">http://lists.debian.org/20110629190816.GA15615@desktop

William Hopkins 06-29-2011 07:27 PM

netstat performance
 
On 06/29/11 at 08:08pm, Brian wrote:
> On Wed 29 Jun 2011 at 12:22:26 -0600, Glenn English wrote:
>
> > For a good time, 'apt-get install bind' :-)
>
> For an even better time (and to escape the monoculture)
>
> apt-get install unbound

Monoculture is one thing, but that is not a comparable product. Unbound is for
recursive-only, so you can't have your own zone.

Also, the Debian package name for ISC BIND is bind9.

--
Liam


All times are GMT. The time now is 01:29 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.