File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Different behavior, remote vs. local Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Different behavior, remote vs. local" Watch "Different behavior, remote vs. local" New topic

Different behavior, remote vs. local

Trevor Price

Joined: May 19, 2006
Posts: 16
I am using ehcache to store a complicated object in memory the first time somebody hits the servlet. It takes almost 20 seconds to build.

When I do local testing, any return hits to the servlet pull the object out of cache instantly. However, when I upload the WAR file to a remote server, the server spends a long time doing who knows what, then it dishes out the HTML. My object appears to be pulled from the cache, but it just takes about 40 sec.

Strangly enough, if I use this remote server directly (ie, I am physically at the machine), the object is pulled from the cache instantly as it should.

Why is this behaving differently on a remote connection as opposed to a local connection?

I'm using Tomcat, btw.
[ June 22, 2006: Message edited by: Trevor Price ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63837

Sounds as if your code is making some assumption that is true when the server and client systems are the same system, but not when they are different systems. What that might be, I have no way of knowing, but it's something for you to start with...

[Asking smart questions] [About Bear] [Books by Bear]
Trevor Price

Joined: May 19, 2006
Posts: 16
Found the problem by setting timers all over the place. The cache had nothing to do with it. I had set a very small response buffer size and was outputting lots and lots of code, which takes a long time over an Internet connection.

Which leads me to another question...
I agree. Here's the link:
subject: Different behavior, remote vs. local
It's not a secret anymore!