Should web application store images in Database or File system?

As a web developer storing images in the file system would be the easiest and it is the best way. If the images are stored in the database then below are its disadvantages

  1. On request, the specified file has to be retrieved from database and temp file should be created, which would be referenced in the generated html. This is a time consuming task and it will delay the page load.
  2. In database, the image data would be stored as BLOB or IMAGE. If a particular record doesnot have any image then also it will consume certain space. To avoid this images should be stored in separate table and it should be accessed via foreign key.
  3. In shared hosting environment, where the database, disk space, web servers and other tools would be provided by the service provider, the database space would be very much limited and it is good option to utilize the file system. In case virtual private hosting this may not be an issue.
There are also some advantages to store the images in Database.
  1. If multiple servers are required for load balancing then if the images are available in database then it would be easy to take backup or replicate the data.
  2. Databases are helpful to keep multiple versions of the images.
  3. It provides some security as against storing all the image files in the file system.
What is the best solution? You need to pick based on your requirement. If it is a single server then I would recommend to store images in file system. If you scale then store the images in database but cache it in file system. For first time the images will be loaded from database and after that the images are loaded from file system. This would be difficult as to ensure both database and cache are in sync.

See also:
http://www.findbestopensource.com/tagged/database
http://www.findbestopensource.com/tagged/cache

Please post your feedback.



Bookmark and Share          1166



comments powered by Disqus


Related Articles

Open Source products used in Facebook

Facebook a leading social networking website predominantly uses open source technologies to build its application. Here is the list of open source products used and contributed by Facebook.

Read more

Open Source Technology Stack used in Opentaps ERP

opentaps Open Source ERP + CRM, is a fully integrated application suite that supports eCommerce, Customer Relationship Management, Warehouse and Inventory Management, Supply Chain Management, and Financial Management to Business Intelligence and mobility integration out-of-the-box. This article discusses about the open source software used to build Opentaps ERP.

Read more

Simple Mail Stack for Linux Hosted Environment

Email is the primary way of communication. Small organization which hosts their website / any other application from a third party hosting service providers may require this email stack.

Read more

Open source projects used to in Wikipedia

Wikipedia is a multilingual, collaboratively edited encyclopedia. It is one of the busiest site in the world. It has more than 8 million articles and accessed by millions of users around the world. This article briefly discuss about the open source software used in Wikipedia.

Read more

Zimbra - Enterprise Email Server Stack

Zimbra is a Enterprise messaging and collaboration software. It is a good alternative to Microsoft Exchange server. Zimbra is a Email Server but they have not written anything related to SMTP server, rather they have integrated well know open source email server in to its package. Zimbra is a system of well connected / integrated multiple open source software which delivers enterprise quality to it. This article explains most important components which helps to build the enterprise product.

Read more

Open source products used in Twitter

Twitter uses many open source products and also contributes most of the code to open source. Here is the list of open source products used by Twitter. This list does not include the projects sponsored by twitter.

Read more

Hadoop + HBase + Solr = Lily

Lily currently offers an open source content repository. It is the first cloud-scalable repository for social content applications. It is built from ground up using Big Data and NOSQL technology. Its technology stack includes Hadoop, HBase and Solr.

Read more

Open Source Technology Stack used in Magnolia CMS

Magnolia CMS is one among popular java based CMS. It has support of CMS, DMS, Wiki, Forum and lot more features. This article discusses about the open source software used to build Magnolia CMS.

Read more

Open source projects used in LinkedIn

LinkedIn is a social network for professionals. LinkedIn handles millions of searches as well as hundreds of thousands of updates daily. They sponsored many projects to open source. Here are the list of open source products used by LinkedIn.

Read more

Complete Email Solution for SMB

Email is most important in any organization. Lot of business are happening via Email. This article discusses about the end to end complete Email solution for an organization. What an organization requires? Email spam filtering, Email Server, Email Archiving and Email client. If all are open source then complete solution could be achieved free of cost.

Read more

Follow feeds Follow bestopensource on Twitter Follow bestopensource on Facebook

Enter your email address:

Delivered by FeedBurner



Open source products are scattered around the web. Please provide information about the open source projects you own / you use. Add Projects.