[thelist] Implementing a Content Delivery Network

Bojan Tesanovic btesanovic at gmail.com
Fri Apr 11 21:18:55 CDT 2008


Ah thats the biggest problem you have there, this is no no :d
Generating images every time is one of the worst CPU enemies.
In my company we have 2 servers under balancer that is used just for  
that
but we have ~ 10 M images, we are caching them but new ones always  
come in
for resizing and the server load is always > 4. (we have around 50  
requests / second )

But as you mentioned  that you have around 2K images it can be served  
from an tetris console ;)

So the thing to do is have a script that caches thumbnails once  
created , you can have 2 or more thumbs for same image.
1. Browsers requests  /imageCreate?id=123456
2. if file exist in /cache/12/34/56.220x140.jpg  fpassthru()  image  
[ http://www.php.net/fpassthru ]
3. if it doesn't  exist make a thumb save it to disk and output the  
image

Don't be confused you can have lot of images on disk  and the Server   
will not slowdown I guarantee ;)


Also once a month you should have a cron script that goes through  
cache directory and clears images older than eg 3 months


On Apr 11, 2008, at 5:29 PM, Randal Rust wrote:

> On Fri, Apr 11, 2008 at 11:24 AM, Hassan Schroeder
> <hassan.schroeder at gmail.com> wrote:
>
>>  Are the images being served directly from  the file system or via an
>>  intervening process?
>
> there is an intervening process, which is to use getimagesize() so
> that we can accurately reduce the size of an image to a thumbnail.
>
>>  I would seriously try to analyze this in depth before reaching the
>>  conclusion that your current platform can't support your app.
>
> absolutely.
>
> -- 
> Randal Rust
> R.Squared Communications
> www.r2communications.com
> -- 
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !

Bojan Tesanovic
http://www.carster.us/ Used Cars







More information about the thelist mailing list