You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Saravanan Bellan <SB...@jareva.com> on 2002/07/23 01:11:42 UTC

localhost vs IP address in the URL

Windows 2000
Tomcat 3.2.3

If I try to upload a file using the regular HTML/HTTP, there is a 20x
difference in performance 
between using localhost vs the IP address in the Web Server URL. Ofcourse
I'm running the browser 
on the same machine where tomcat is installed. Using localhost is 20 times
slower than using IP address.

Doesnt make a difference if I use Apache/AJP/Tomcat or Direct to Tomcat web
server.

Can somebody throw some light on this.


Thanks,


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: localhost vs IP address in the URL

Posted by Denis Haskin <De...@HaskinFerguson.net>.
I'm not a networking guru, (and this is sort of OT for Tomcat) but I'm not
convinced by M.Schwartz's response that this is due solely to DNS name
resolution.  I don't think that would account for such a big difference in
time--once the name was resolved to the IP address, behavior should be the same,
no?

Saravanan, you say there's a 20x difference but what's the magnitude?  Are we
talking 10 ms vs. 200 ms. or 1 second vs 20 seconds?  By "IP address" do you mean
"127.0.0.1" or the IP address of the computer?

My pet theory is that the TCP/IP stack is recognizing the IP address as being of
the local box and is "shortcutting" packets from transmit queues to receive
queues in memory, without actually getting the NIC involved or anything.  Or
maybe the NIC is doing this.

Many years ago when I did hardware testing, we first ran into TCP/IP stacks that
had this optimization.

The other thought is that for some reason different maximum packet sizes are
being used with these different connections?

Of course, this is just a theory.  Someone with a little more knowledge might be
able to speak more authoritatively <grin>.

dwh


Saravanan Bellan wrote:

> Windows 2000
> Tomcat 3.2.3
>
> If I try to upload a file using the regular HTML/HTTP, there is a 20x
> difference in performance
> between using localhost vs the IP address in the Web Server URL. Ofcourse
> I'm running the browser
> on the same machine where tomcat is installed. Using localhost is 20 times
> slower than using IP address.
>
> Doesnt make a difference if I use Apache/AJP/Tomcat or Direct to Tomcat web
> server.
>
> Can somebody throw some light on this.
>
> Thanks,
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: localhost vs IP address in the URL

Posted by "Power-Netz (Schwarz)" <sc...@power-netz.de>.
> on the same machine where tomcat is installed. Using localhost is 20 times
> slower than using IP address.

names -> ip resolves take time . not caching the name -> ip result will take
MUCH MORE TIME :))

>
> Doesnt make a difference if I use Apache/AJP/Tomcat or Direct to
> Tomcat web
> server.

If you had a Unix system i would say your resolve.conf is messed,
normaly a system looks FIRST to your local hosts.conf AND THAN
asks a nameserver for the IP to a given name ( localhost ).

I guess your system asks the nameserver first and looks then locally for
localhost ip. Check your TCP/IP settings .


M.Schwarz


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>