Harry
Harry

Reputation: 13329

Django sorl thumbnail Crash - Lots of Large images

When ever I have lots of large images, like 800x650 etc in a template, Django just crashes. It works on my Mac locally but not on my Linode production server. Could one do sort of a batch process where it does a few, then stops then does a few again?

Im doing the thumbnailing in a {% for %} loop in my template, creating a small and a large image in each pass.

Upvotes: 3

Views: 791

Answers (2)

Andrew Louis
Andrew Louis

Reputation: 390

Think we solved your problem here.

There is a thing like Engine in Sorl-Thumbnail. Default is Pil and it bugs with large images.

Upvotes: 0

Chris Pratt
Chris Pratt

Reputation: 239360

I had the same thing going on as you do, I think. When a view is first accessed, sorl-thumbnail does it's thing, checking which thumbnails on the page need to be generated, and of course generating those that do. At the point of generating thumbnails, you're dropping to file I/O which is slow, like really slow compared to every other part of the web request.

If you have a ton of images, this can take quite a while (I saw upwards of 30 secs for the first load on some extremely image heavy pages). In my case, I was getting internal server errors; I'm not sure if that's the same as what you mean by "crashing". In reality, it's not really falling down, the problem is that the request timeout is usually set pretty low, I simply need to up my timeout to give the server longer to finish processing the request. It was still slow on first load, but after that, it's instantaneous and no more issues.

Upvotes: 1

Related Questions