It's not a secret anymore!
The moose likes Servlets and the fly likes Providing dynamic content from separate web/app servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Providing dynamic content from separate web/app servers" Watch "Providing dynamic content from separate web/app servers" New topic

Providing dynamic content from separate web/app servers

Rick Crawford
Ranch Hand

Joined: Aug 17, 2001
Posts: 34
Hello all. I wasn't sure whether to post this in this forum or whether this is more of a Apache/Tomcat issue. But here goes.
I am converting a Microsoft IIS website to Apache/Tomcat/Java. One of the applications within the web pulls images from a database, stores the contents into a dynamically-generated .jpg file, then returns a dynamically-generated HTML page with an IMG SRC= tag pointing to the image file name. In the current configuration (the IIS one), the web server and the application server are on the same physical machine. So all the application has to do is retrieve the image data, convert and store it into a .jpg file, then stage the .jpg file in a directory on the machine that is one of the web server's virtual directories, then return the HTML.
One of the major differences between the old and new webs' configurations is that the new version has the application servers (Tomcat) running on different machines than the web servers (running Apache.) There will be two load balanced web servers connected to two load balanced Java application servers. I know how to do convert nearly everything, at least conceptually, that this piece of the functionality currently does. The retrieval from the database and the generation of dynamic HTML isn't a problem. Where I'm stuck is determining how to copy the files onto the web servers from the application servers once the image data is retrieved and the .jpg file is built.
To restate the question, if you have separate web and application servers, and the web server provides dynamic content
that must be accessible in a virtual directory on the web machine, how's the best way to move the data? FTP, sockets, etc.? Furthermore, with this sort of application am I going to have to propagate the dynamically created image across all my
web servers? When the dynamically-generated HTML reaches the browser, and the browser requests the embedded image, will the request for the image 'automagically' be routed back to the server where the request originated? Does Apache/Tomcat provide some sort of 'affinity' that tries to keep a web browser coming back to a particular web server?
Thanks for any info,
Rick <><

[This message has been edited by Rick Crawford (edited December 03, 2001).]
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

We accomplish something like this at work (on Solaris boxes) using an NFS file mount.

It makes a directory on a remote machine appear as 'local' to another box.
I agree. Here's the link:
subject: Providing dynamic content from separate web/app servers
It's not a secret anymore!