1

My app requires lot of thumbnail images to be rendered and I usually render 20 each page.. It's a live scroll and it works fine. I mean I do not see any delay in loading the images. I'm using express, jade, gzippo (for compression).. In one page when I had to load around 300 thumbnail images at one shot, the response time was quite bad, several seconds.

Is there any better mechanism available to serve the static files in node.js express framework ?

user644745
  • 5,673
  • 9
  • 54
  • 80

2 Answers2

0

You've got to use StaticCache here. Given you're rendering the images on the fly, I would definitely prime the cache before the request. Also, don't forget to adjust the maxObjects (default is 128) and maxLength (default is 256kB) options to values that make sense for your app.

Dave
  • 2,409
  • 3
  • 22
  • 28
  • Thanks. what if I store my images to amazon s3 ? is there any github repo for static cache ? – user644745 Mar 03 '12 at 01:05
  • StaticCache is part of Connect (https://github.com/senchalabs/connect). The s3 part is a larger architectural question. Are you rendering on the fly or are you going to pre-render and store in s3? Totally depends on your application. – Dave Mar 04 '12 at 23:15
0

I have heard it mentioned that traditional webservers such as Nginx are better at serving static files than node.js (they are faster). I am assuming that images would be considered static files. Perhaps you could investigate this avenue. Why do we need apache under Node.js express web framework?

Community
  • 1
  • 1
Benjen
  • 2,835
  • 5
  • 28
  • 42