This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have noticed that loading memory image from serlvet are much slower than loading image from files. Theoretically, I think loading memory image must be faster because a) I call the servlet directly. b) I load images that have been cached in memory as byte arrays. On the other hand, loading images from a file as http://localhost:8080/myImage.gif requires to a) redirect my url to servlet. b) search and load myImage.gif file into memory. c) write byte array to response object. Would you provide some suggestions, comment? Thanks
What is your server configuration? Is this Tomcat standalone, or what?
Joined: Apr 20, 2001
William I am using IBM web sphere. For memory images: All images are kept in oracle db and load to servlet context when servlet engine is started. Servlet will set the content type and write the image byte array to the output stream. I have 15 images to display on a single page, so the above servlet will be invoked 15 times simutaneously.
Author and all-around good cowpoke
Joined: Mar 22, 2000
I would certainly expect that to be about as fast as reading a static file. There is some overhead with constructing the request and response objects that is not present when serving files directly. How much time difference are we talking about? You are writing the byte with as single write I assume. Bill