wood burning stoves*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Different behavior, remote vs. local" Watch "Different behavior, remote vs. local" New topic
Author

Different behavior, remote vs. local

Trevor Price
Greenhorn

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
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Trevor Price
Greenhorn

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: http://aspose.com/file-tools
 
subject: Different behavior, remote vs. local
 
Similar Threads
Why remote? I don't get it?
Hibernate with JSF: missing database updates
Connection Factory
connection hangs
Unable to connect a remote server from a servlet using HttpsUrlConnection