• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

comparision between loading images from servlet vs. from files

 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your server configuration? Is this Tomcat standalone, or what?
 
Joe Nguyen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic