How about to set correct headers and make the images cached on user side
instead
of wasting memchached resources?
If you are serving tons of thumbs multiple times I bet that the traffic will
be bigger problem
than the time it took for these images to be read from disk.

Check this post ->
http://ilian.i-n-i.org/caching-web-sites-and-web-applications/ there you
can see which headers you need to set to tell the client browser to cache a
resource.


On Thu, Sep 15, 2011 at 4:51 PM, Thomas Weholt <thomas.weh...@gmail.com>wrote:

> Good point Cliff! I just assumed serving static content would benefit
> from caching, but perhaps my effort is more well spent focusing on
> other aspects of my app right now.
>
> Thanks :-)
>
> Thomas
>
>
> On Thu, Sep 15, 2011 at 3:42 PM, J. Cliff Dyer <j...@sdf.lonestar.org>
> wrote:
> > What is your goal in doing this?  You are unlikely to see any
> > performance gains from this effort.
> >
> > It won't render any faster for your users.  Sending bytes over the
> > network is far slower than reading them off disk, so it's not likely to
> > be a bottleneck in terms of page loading.
> >
> > Your filesystem is likely caching commonly read items for you already.
> > Trying to outsmart this system is likely to just waste memory and slow
> > things down by caching the wrong things.
> >
> > Have you determined that this is actually a bottleneck in your app?  It
> > seems unlikely that serving static thumbnails is actually the thing
> > slowing your app down.
> >
> > Cheers,
> > Cliff
> >
> >
> > On Thu, 2011-09-15 at 15:24 +0200, Thomas Weholt wrote:
> >> Ok, this might sound a bit off-topic but bear with me.
> >>
> >> I got a templatetag in an app that generates thumbnails (
> >> django-photofile ). In my templates it might look like this
> >>
> >> <img src="{% generate_thumbnail photo 100x100 %}">
> >>
> >> It will generate a thumbnail of the photo in 100x100 in a folder
> >> served by nginx for all static content and return an url pointing to
> >> the thumbnail, for instance
> >> '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'.
> >>
> >> This all works nice and dandy, but I want to cache the static photos
> >> using memcache, so that when the page is rendered and the templatetag
> >> returns the url '/static/thumb/4432lkj432kl5k4l26k_100x100.jpg'
> >> nginx will look for it on disk, cache it using memcache and return it
> >> so that the next time the page is rendrered it will be read from the
> >> cache and not from disk.
> >>
> >> I got a folder served by nginx with all my static content (js, css,
> >> images ), including the thumbnails and I want to cache it all ( using
> >> the assigned amount of ram to memcache of course, but I hope this is
> >> handled by memcache ).
> >>
> >> I've read through a few articles about nginx, memcache etc, but still
> >> haven't a clue on how to do this.
> >>
> >> NB! The reason I think/hope this is on topic is the fact I use a
> >> templatetag to generate the url etc. Sorry if it's still of topic.
> >>
> >> --
> >> Mvh/Best regards,
> >> Thomas Weholt
> >> http://www.weholt.org
> >>
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: http://ilian.i-n-i.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to