开发者

Scalable asynchronous image resizing

I'm considering a few options for the most scalable way of handling image resizing in a PHP (CodeIgniter) Web App. I need to resize an image into several sizes and then push them to Amazon S3. So here are the options I've come up with so far:

  1. When file is uploaded add it to a queue. Have a background PHP or Python (Apparently PHP is bad for long runnin开发者_开发技巧g processes) program constantly running which looks at and processes the queue then sleeps for x seconds.

  2. When file is uploaded spawn a new PHP process which processes that image then dies.

  3. Use a third party service like lightspun (They're not accepting customers at the moment. Are there other similar services?)

Perhaps there is a better option I haven't considered?


I'd go for your first choice, as it would be more reliable and means you could do work on the backend without taking the front end down.

It would also scale much more gracefully, as you could move it off to another server if the queue becomes extreme.


your first idea sounds good for reasons already stated, takes burden of processing time off of the user and you can add more image sizes etc without hurting user experience.i have had good results using command line image magick tools for image processing and have had some luck using php in long running processes using its fork abilty. http://php.net/manual/en/function.pcntl-fork.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜