imagecache icon indicating copy to clipboard operation
imagecache copied to clipboard

Slow cache?

Open simplenotezy opened this issue 10 years ago • 23 comments

I just installed the library. Hitting the route:

{route}/{template}/{filename}

Is extremely slow. It takes 500ms or so, compared to direct image source which is 20ms or so.

I wonder if the image is even cached. I suspect not. Using memcached as driver on a Laravel 5 installation.. How to debug further?

simplenotezy avatar Feb 28 '15 22:02 simplenotezy

On a page with 10-20 images, they take 10-15 seconds to load, and some of them even fail, like this:

image

simplenotezy avatar Feb 28 '15 22:02 simplenotezy

I've made a comparison:

Using imagecache: image image

Using direct image source: image image

simplenotezy avatar Feb 28 '15 22:02 simplenotezy

I suggest to create a XDebug profile, to discover what is causing this delay.

olivervogel avatar Mar 01 '15 09:03 olivervogel

canflax. Have the same problem, its faster to load image full size then cache'em. Please reply here if you find an answer! same for me

ghost avatar Mar 26 '15 08:03 ghost

Facing same issue, almost extra 60-70ms in time latancy.

This is the code how I load the image at Route.php

Route::get('images/cars/{src}', function ($src){    
    $cacheimage = Image::cache(function($image) use($src){
        return $image->make("images/products/".$src);
    },1440);

    return Response::make($cacheimage,200, array('Content-Type'=>'image/jpg'));
});

In blade

<img src="{{ URL::asset('/images/cars/theimage.jpg' }}" alt="">

Any thought? Using laravel 4 btw.

DoubleTime avatar Mar 31 '15 08:03 DoubleTime

+1 is there any simple todo for real cache ? i mean create a real thumbnail with Intervention's library.

mehrdd avatar Apr 04 '15 21:04 mehrdd

+1 I am also facing this issue. I am using it this way. http://image.intervention.io/use/url

tshafer avatar Apr 09 '15 19:04 tshafer

I'm again suggesting to create a XDebug profile, to discover what exactly is causing this delay.

olivervogel avatar Apr 09 '15 19:04 olivervogel

Sorry about that.

Ill give it a try

tshafer avatar Apr 09 '15 19:04 tshafer

Yep, getting pics from cache are so slow! Slow like first resizing. http://c2n.me/3gUFhhr.jpg

mosh-tudor avatar Apr 28 '15 22:04 mosh-tudor

NOTE! Images from cache (I mean this script) have always HTTP status code 200, in normal situation images must have HTTP status code 304.

I hope olivervogel will fix this!)

mosh-tudor avatar Apr 29 '15 14:04 mosh-tudor

+1 Same issue with similar code.

jhellingman avatar May 30 '15 20:05 jhellingman

People, any thoughts on it?

rogerfn avatar Jun 08 '15 15:06 rogerfn

+1 same issue, even though it does create cached image files in the storage, and the Image::cache function is returning a CachedImage object.

nikita240 avatar Jul 15 '15 23:07 nikita240

The issue is that the entire framework needs to be loaded for each image being retrieved, and that action is actually slower than most image manipulations. Resolved by generating direct urls to generated images, and let the server pull them directly from the cache, without use of the framework. Since the types of manipulations I want are very limited, I can keep the URLs to them in my database and write them out to generated pages. My conclusion: I have no need for this framework.

jhellingman avatar Aug 05 '15 09:08 jhellingman

+1 - Seems a tad useless for now.

Loading 8 images is very slow for me on a regular digital ocean droplet It can sometimes take over 6 seconds to load a small group of images.

Sometimes the server hangs and loads all of the images at the same time. And i can see that the CPU spikes like crazy on the server, even though the images are cached.

I am going to just create a command in Laravel that creates the thumbs with intervention, and delegates the generated thumbs and different sizes to appropriate folders instead of relying on this for now...

aske-cph avatar Aug 13 '15 15:08 aske-cph

I also has same problem, see my cache image, actually slowly http://www.thanhmabo.com/post

thanhmabo avatar Aug 18 '15 13:08 thanhmabo

any update on this ?

cmnstmntmn avatar Sep 02 '16 14:09 cmnstmntmn

hello? always return 200, how to fix this?

wi-development avatar Oct 02 '16 12:10 wi-development

I agree. The caching is very much slower than loading the images directly. Is this problem going to be resolved or do we need to find another image caching solution?

sunnyjayjay avatar Oct 23 '16 16:10 sunnyjayjay

Still slow as fuck, don't use this package.

stephan-v avatar May 15 '19 20:05 stephan-v

it's been 4 years, and still slow 👎

hijaumuda avatar May 18 '19 00:05 hijaumuda

Have anyone found a solution or an alternative for this? @olivervogel

theprobugmaker avatar Dec 16 '19 17:12 theprobugmaker