I am working on a content management application in which the data stored in the database is extremely versatile. In this particular case, the container has many resources, and these resources are mapped to some kind of digital asset, be it an image, a movie, a downloaded file, or even plain text.
I’ve been arguing with a colleague for a week, because in addition to storing images, etc. - they would like to store text assets in the file system and have an application looking for the file location (from the database) and read in a text file (from the file system) before contacting the client application.
Common sense seemed to yell at me that it was ridiculous, and if we try to look for something from the database, we could also save the text in the database column and serve it along with the row lookup. Database Search + File IO seemed sound uncontrollably slower than just database search. After some time back and forth, I decided to run some tests and found the results a bit surprising. There seems to be very little coherence when it comes to benchmark times. The only clear winner in the tests was pulling a large set of data from the database and repeating the results to display a text asset, however pulling objects out of one database and displaying their textual content seems like a neck and a neck.
Now I know the limitations of running tests, and I'm not sure that I even use “tests” correctly (for example, entries in the file system are ridiculously faster than entries in the database did not know this!). I think my question is for confirmation. Is file I / O comparable with repository / text search in a database? Did I miss part of the argument here? Thanks in advance for your opinions / advice!
Quick work on what I'm using: This is a Ruby on Rails application using Ruby 1.8.6 and Sqlite3. I plan on moving the same code base to MySQL tomorrow and see if the benchmarks are the same.
source share