Networking Forums

Networking Forums > Computer Networking > Linux Networking > 0.020 ms ping time to localhost is slow?!

Reply
Thread Tools Display Modes

0.020 ms ping time to localhost is slow?!

 
 
simpleton_programmer@yahoo.com
Guest
Posts: n/a

 
      11-03-2005, 02:45 PM
On a mandrake linux P4 2.8 GHZ, 512 MB machine with 100% idle, not
running X, I do "ping localhost" and I get response times that are on
average 0.020 ms. This seems slow to me. I believe that what is going
on is as follows:

1. ping makes system call to send data into kernel space
2. task switch to kernel
3. kernel handles data from ping and makes response available to user
4. task switch back to ping
5. ping gets the data and outputs time

I would have thought a couple of task switches and a little data
processing and data copying would take less than 0.020 ms. Am I
missing some steps in the above? Can anyone assign times to the task
switches or other steps?

Thanks,
Doug

 
Reply With Quote
 
 
 
 
Bit Twister
Guest
Posts: n/a

 
      11-03-2005, 03:17 PM
On 3 Nov 2005 07:45:58 -0800, (E-Mail Removed) wrote:
> On a mandrake linux P4 2.8 GHZ, 512 MB machine with 100% idle, not
> running X, I do "ping localhost" and I get response times that are on
> average 0.020 ms. This seems slow to me.


Me too. ping -c 13 localhost snippet
--- localhost ping statistics ---
13 packets transmitted, 13 received, 0% packet loss, time 11998ms
rtt min/avg/max/mdev = 0.097/0.099/0.103/0.011 ms

Maybe you have not disabled ipv6. Do a
service network stop
Add the NETWORKING_IPV6=no followed by a carriage return. Example:
$ cat /etc/sysconfig/network
HOSTNAME=wb.home.invalid
NETWORKING=yes
NETWORKING_IPV6=no <=========
GATEWAYDEV=eth0
GATEWAY=192.168.2.1

Then do a
service network start
and try your ping again.

My system stats from a top snippet

top - 10:09:58 up 17:52, 3 users, load average: 0.05, 0.07, 0.09
Tasks: 117 total, 1 running, 116 sleeping, 0 stopped, 0 zombie
Cpu(s): 38.6% us, 1.0% sy, 0.7% ni, 59.2% id, 0.4% wa, 0.0% hi, 0.0% si
Mem: 742988k total, 733012k used, 9976k free, 102328k buffers
Swap: 1044184k total, 44k used, 1044140k free, 412324k cached

Running KDE on
model name : Celeron (Coppermine)
cpu MHz : 1103.000
cache size : 128 KB

$ head -4 /etc/hosts
127.0.0.1 localhost
192.168.2.1 fw.home.invalid fw
192.168.2.10 wb.home.invalid wb
192.168.2.12 wb1.home.invalid wb1

$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:A0:CC:E6:82:E9
inet addr:192.168.2.10 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47292 errors:0 dropped:0 overruns:0 frame:0
TX packets:46994 errors:2 dropped:0 overruns:0 carrier:4
collisions:0 txqueuelen:1000
RX bytes:26142674 (24.9 MiB) TX bytes:5916995 (5.6 MiB)
Interrupt:10 Base address:0xcc00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:10112 errors:0 dropped:0 overruns:0 frame:0
TX packets:10112 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1072024 (1.0 MiB) TX bytes:1072024 (1.0 MiB)

 
Reply With Quote
 
simpleton_programmer@yahoo.com
Guest
Posts: n/a

 
      11-03-2005, 04:05 PM
you are seeing the same things that I am seeing I believe. I've been
doing some more research and it seems that the context switches might
be chewing up the time taking up maybe 0.010 ms or more. Can't find
benchmarks for task switches on my system P4 2.8 GHz but still looking,
must be out there or some easy way to measure it.

 
Reply With Quote
 
David Schwartz
Guest
Posts: n/a

 
      11-03-2005, 06:45 PM

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...

> On a mandrake linux P4 2.8 GHZ, 512 MB machine with 100% idle, not
> running X, I do "ping localhost" and I get response times that are on
> average 0.020 ms. This seems slow to me. I believe that what is going
> on is as follows:


What speed would you think it should be?

DS


 
Reply With Quote
 
simpleton_programmer@yahoo.com
Guest
Posts: n/a

 
      11-04-2005, 01:18 AM
David Schwartz wrote:
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
>
> > On a mandrake linux P4 2.8 GHZ, 512 MB machine with 100% idle, not
> > running X, I do "ping localhost" and I get response times that are on
> > average 0.020 ms. This seems slow to me. I believe that what is going
> > on is as follows:

>
> What speed would you think it should be?
>
> DS


Good question! I'm not really sure. So I think a couple of task
switches are involved and if we assume that the internals are pretty
quick, say 2 microsec?, and the two task switches are taking about 5
microsecs each which from the search I have done is what a task switch
took on a machine more than 4 years ago (
http://cs.nmu.edu/~benchmark/index.php?page=context ) and I was
thinking it would have improved with processor speed, ram speed, bus
bandwidth, etc. Is there anyway to do some timing to see where the
time is spent, task switching, user mode, kernel mode, etc.

You make a good point though, at 0.020 ms maybe I should be saying
"whoa, that is awesome" but unfortunately I am in a situation where I
need more speed and every fraction of a ms counts. I'm trying to
quantify this stuff. For example, if I moved it all into the kernel
and had to do no task switching how much of an improvement would that
be? Would my pings go from being 0.020 ms to 0.019 ms or would it go
to 0.001 or 0.0001 ms?

Some docs I read on kernel mode linux suggested that system calls are
like 30 times slower from user space than they are from kernel space (
obviously depends on call etc ) but if that were the case my times
would go from 0.020 to 0.001 which, in my world, would be a significant
and meaningful improvement and would justify spending time to move
stuff into the kernel.

 
Reply With Quote
 
Unruh
Guest
Posts: n/a

 
      11-04-2005, 03:47 AM
(E-Mail Removed) writes:

>David Schwartz wrote:
>> <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>>
>> > On a mandrake linux P4 2.8 GHZ, 512 MB machine with 100% idle, not
>> > running X, I do "ping localhost" and I get response times that are on
>> > average 0.020 ms. This seems slow to me. I believe that what is going
>> > on is as follows:

>>
>> What speed would you think it should be?
>>
>> DS


>Good question! I'm not really sure. So I think a couple of task
>switches are involved and if we assume that the internals are pretty
>quick, say 2 microsec?, and the two task switches are taking about 5
>microsecs each which from the search I have done is what a task switch
>took on a machine more than 4 years ago (
>http://cs.nmu.edu/~benchmark/index.php?page=context ) and I was
>thinking it would have improved with processor speed, ram speed, bus
>bandwidth, etc. Is there anyway to do some timing to see where the
>time is spent, task switching, user mode, kernel mode, etc.


>You make a good point though, at 0.020 ms maybe I should be saying
>"whoa, that is awesome" but unfortunately I am in a situation where I
>need more speed and every fraction of a ms counts. I'm trying to
>quantify this stuff. For example, if I moved it all into the kernel
>and had to do no task switching how much of an improvement would that
>be? Would my pings go from being 0.020 ms to 0.019 ms or would it go
>to 0.001 or 0.0001 ms?


>Some docs I read on kernel mode linux suggested that system calls are
>like 30 times slower from user space than they are from kernel space (
>obviously depends on call etc ) but if that were the case my times
>would go from 0.020 to 0.001 which, in my world, would be a significant
>and meaningful improvement and would justify spending time to move
>stuff into the kernel.


Why in the world do you want fast pings? pings do not actually accomplish
anything. I think what you may be interested in is fast network transfers,
and timing a ping is not a good way of optimising network transfers.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exceptionally slow ping times, slow DNS lookup and slow download on router Martin Underwood Broadband 1 01-24-2007 12:05 AM
Can not ping LOCALHOST:( lioh Windows Networking 1 11-23-2005 01:21 PM
Can not ping localhost -- all looks correct... Ringo Langly Linux Networking 6 11-08-2004 05:18 PM
Can't ping gateway but localhost Manoj Kumar Reddy Linux Networking 1 08-04-2003 08:24 PM
Cannot ping localhost or own IP. maddman Linux Networking 4 08-04-2003 12:15 PM



1 2 3 4 5 6 7 8 9 10 11