News for hackers. Stuff that matters.
Re:Mistakes Beginners Make When Working with Databases by brianwawok on Wednesday June 08, 2016 @01:47PM (#11864069)
So if you do this on a large site, what % of your DB load is going to be serving images?

If you put your images behind a CDN, you solve 98% of that.. but you still have a thundering herd problem if your cache gets cold and a bunch of people want to see a non-CDNed iamge.

IMHO it is way way way easier to just throw the image up on google cloud storage (or s3), and store the URL in your database. Or better yet, derive the path from the ID so nothing to store. You can handle millions of hits per second with no DB load.

Re:Mistakes Beginners Make When Working with Databases by olavgg on Wednesday June 08, 2016 @01:57PM (#11864145)
I use Varnish, so it is never a performance issue.
Re:Mistakes Beginners Make When Working with Databases by brianwawok on Wednesday June 08, 2016 @02:58PM (#11864666)
Does Varnish preload your images from cache?

What if 100 people hit the page at the same time for an uncached image?

I am not saying it can't be done, just having trouble figuring out the benefits.. its easier to store an image in cloud storage over in a database... and cheaper.. and less bug prone...

Re:Mistakes Beginners Make When Working with Databases by dalyons on Thursday June 09, 2016 @01:49AM (#11867772)
Varnish will actually hold those 100 connections open while it dispatches 1 single request to the backend. When that request returns (assuming the cache control headers allow it), it will serve that one response to all 100 requestors. It's a very powerfull tool for anything that's even slightly cachable.
Re:Mistakes Beginners Make When Working with Databases by brianwawok on Thursday June 09, 2016 @09:16AM (#11869133)
If your site has 1 varnish, if your site has 20 varnishes it would do 20 connections.