Hi all,
I am reading an awful lot about the problems with blob and most feel having files is better for images, but what are the pro's and conns of both?
If you are storing content in a database server, my recommendation is generally that you store images in files on the server's filesystem and the names of the files in the database. This reduces overall complexity of your site and allows your web server to do the serving of images without having to invoke a PHP script.
This question has been asked loads on this forum, sleipnir always argues files, I agrue database for scaliability reasons. I dont think there is a correct answer.Have a search and read the various comments
Hiya,
Yes I have seen many an article about how to work both solutions but no distinctive advise on which one to use or why (as far as I have found going through at least 50 postings)?
Anyway it seems most people end up using files, so why do you agrue blob?
Basicly I've spent a lot of my life creating scaleable solutions, web being no different. If you use files you are limited to one server and so if you run out of steam on the server you can't simply roll a new one in (scaling out). You also have to create some kind of index system as unix and windows have limits on how many files you can have in a directory. A DB on the other hand does all this stuff itself.
If you did want to spread flles around servers you would have to know which one it was on and be able to retrieve it over a network (not hard but you would have to do it).
I could go on for ages (and have done elsewhere !) but in MY opinion the performance hit you will get by using a DB (even then if it's a common image it may get cached) is ofset by the programming ease and ulitmate maintenance issues of using the file system.
Final point I dont think that mysql is a good db to store images in and store then gziped !
On the other hand, in order to stream the images out of the database, your site requires greater code complexity (to write scripts to fetch the data from the database) and more server resources (to run the database, to run the script and to stream the data from the database server then to the connection).
It really depends on how large your system is going to be. The filesystem limits for Linux's ext3 filesystem is 32768 files in a directory. I suppose if your image library were expected to grow larger than that, storing the files in a database would look attractive.
But you could accomplish the same workaround by simply calculating subdirectory names using a hash.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.