Comments on: Image storage: Database or File system? https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/ building stuff on the web with Josh Fraser Thu, 14 May 2015 16:56:11 +0000 hourly 1 By: Shawn https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-1671 Mon, 03 Jan 2011 23:50:21 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-1671 I need display 1000 small images, in, and only in, a fixed sequence, i.e., image1, image2, image3…,

It's easy for FS; it's fast for FS because of the sequential access instead of SQL quering.

It's fast for DB if I have a "good cache at front of DB"; It is fast for DB because there're no many images.

So… which one has a tiny advantage?

Thanks in advance!

]]>
By: Josh Fraser https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-1275 Wed, 27 Oct 2010 06:20:55 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-1275 In reply to Hendry.

On second thoughts, search is pretty irrelevant to this discussion. In either case, you're probably searching the meta data for the image and not the actual image itself. Meta data is easier to search if it's stored in a database, but that's another topic.

]]>
By: Hendry https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-1274 Wed, 27 Oct 2010 06:11:40 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-1274 In reply to Josh Fraser.

Isn't it easier to search if you chuck the file in the filesystem? You can easily use indexing engine to crawl these files, whereas if you stored them in the database, it wouldnt be that easy

]]>
By: Harry https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-641 Tue, 18 Aug 2009 23:36:57 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-641 In reply to Josh Fraser.

I'm glad that you clear my doubt, really thank you, thank you and thank you again…..you really a great guy…

]]>
By: Josh Fraser https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-639 Tue, 18 Aug 2009 19:30:49 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-639 In reply to Harry.

It's a series of trade-offs. How many files do you have? Do you need to be able to search them? Do you have meta-data that needs to be stored with them? My bias is usually towards sticking data in the database because it makes them easier to search, sort and connect meta-data. That said, if you don't need that ability or if you have more than a few thousand files, the filesystem might be the way to go.

]]>
By: Harry https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-637 Tue, 18 Aug 2009 09:55:15 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-637 In reply to Josh Fraser.

Thanks for your information. But I have another question, what if I'm storing large text document? file system or database system storage is better?

]]>
By: Josh Fraser https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-636 Tue, 18 Aug 2009 08:30:50 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-636 In reply to Harry.

The biggest caveat I would add since writing this is that a good caching system (like memcache) is absolutely essential if you are going to be storing images in the database. If you have good caching, storing smaller images in the database is not a bad option. If you're going to serving up millions of images, you might want to go ahead and use the filesystem to avoid having to shard your database later on to keep it fast. The filesystem is also a better option for storing larger images.

]]>
By: Harry https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-635 Tue, 18 Aug 2009 08:09:57 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-635 Hello, can you explain on what the differences between file storage and database storage? as in how these two storage format are used….Im kind a confused with these two…Hope you would clear my doubt…
Thank you in advance….

]]>
By: Josh Fraser https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-239 Tue, 07 Oct 2008 13:16:30 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-239 KPS,

You're totally right. I really should write a follow-up post on this. The big caveat for me is memcache. It's okay to store profile pics in a DB, but don't do it unless you have a really good caching system up front.

Josh

]]>
By: KPS https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/comment-page-1/#comment-238 Tue, 07 Oct 2008 03:32:59 +0000 https://onlineaspect.com/2007/07/10/image-storage-database-or-file-system/#comment-238 Interesting tests, but it doesn't really give you an acurate idea of what would happen in a 'real word' environment.

Testing the speed of 1 'user' getting 1 image from a database and/or file system containing 3 images, or 1 'user' getting 1 images from a database/file system containing 120,000 images doesn't really make a difference, because it's still only 1 user makming 1 connection to retirve 1 image.

Try testing 1,000 users getting 1,000 images from your database / file system, better still try 1,000 users getting the SAME image fro your database / file system. I think then you'll see slightly different results!

And never use a DB to store your images if you plan on having thousands or millions of images! For each entry in your DB you could be multiplying the space used 10 fold by having images cluttering up the DB, and even though DBs can cope with terabytes of storage, there is the danger that one day you WILL discover the edge of the Universe!

With file storage you simply slap another 10 Terabytes onto your stroage and off you go again! 😀

]]>