This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 60800
    
  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...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Different behavior, remote vs. local
 
Similar Threads
Unable to connect a remote server from a servlet using HttpsUrlConnection
Why remote? I don't get it?
connection hangs
Connection Factory
Hibernate with JSF: missing database updates