connecting to Apache Tomcat locally w/o using network
My issue is this:
I have just moved to a new work environment with a very slow, very limited network. I am connecting to Apache Tomcat and receiving back a String-encoded bit of JSON (< 200 characters)
I am testing this thru a URL / URLConnection and via Node/Request, all running on the same (Mac) machine (ie localhost)
My requests are taking 450 to 2000 ms to respond fully, again for < 200 characters. In the meantime, the query I'm making to redis (a local call) thru node is returning in 1-3 ms.
Given the great performance of redis, I am guessing that it is connecting locally and using local bus to transmit information. I am wondering if it is possible to connect to tomcat in a similar way.
I suspect DNS or other lookups are occurring (and timing out and/or failing) and that's what's taking up all your time. Make sure you don't have enableLookups set to true in any of your <Connector>s. If you don't, then it's time to look at other places in your configuration that might be attempting to log client hostnames instead of their IP addresses.
If you are desperate, you can try using something like Wireshark to snoop any unwanted network traffic that might be happening.
Something is very fishy. The localhost name should be bound to a loopback IP address, and hence to the loopback pseudo-device. That should go nowhere near the physical network interface or the physical network.
The chances are that something in your requests involves going off-machine. Perhaps your machine's networking routing is incorrectly configured. Perhaps what you are doing requires off-host DNS lookup.