Choosing storage place for Images

9 10 2008



Choosing storage place for Images


In this article I have jotted down various pros and cons for choosing the best storage place for images used in our web based applications.


There are two basic approaches for storing the images that are used in our web application

  1. File System
  2. Database


Below are some comparisons between the two:


Ease: One can easily configure the path of an image from a directory on the web server containing images while from database one needs to create custom logic for reading Image data (eg .ashx handler for image)



Flexibility: It is always easy to store a new image file on the web server while in case of database new column needs to be created. 



Maintenance: Using simple file operations for storing the image on web server is very trivial task while in case of database one might need to create a complex query or business logic.



Caching: IIS can be easily configured to cache images stored in file system while images in database needs some further complex IIS configuration



Size: As the web directory in which our application is hosted can be easily scaled in terms of size for storing more images as a when needed while in database the size of database goes on increasing affecting the overall database performance.



Compatibility: Images are stored on file system with basic file operations while in case of database during migration process to some other database vendor their may be some Data Type compatibility problem



Performance: File operations are less costly in resource utilization while database operations are more costly in terms of resources.






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: