This is a design related question.
I have a java web application(connected to MySQL database) running on tomcat. It runs on both linux and windows machines separately(as of now). I should store files which come as input, whose size varies from 500 KB to 100 MB (max). The use of these files is to parse them and get required data. I can use the 'blob' in database schema to store files, access them to generate the required output and store them in MySQL db. Else, I can use file system to store the files in the windows or linux filesystem and use them to extract the data, store it in MySQL db. In any month I will be saving close to 200 files of varying length. I am unable to decide which implementation to choose?
The following are some pros and cons which I came up comparing filesystem vs database.
File-System:
- automated indexing of files by OS.
- easier to access files.
- MySQL database that I use for other tables doesn't store huge amounts of data (200 files * 50 MB average = 10GB data).
- Varying lengths of the files doesn't matter much to the DB( the typical blob sizes for MySQL is, TINYBLOB: 255 bytes BLOB: 65,535 bytes (64 KB) MEDIUMBLOB: 16,777,215 bytes (16 MB) LONGBLOB: 4 GB So if my file size is >16MB I should store it as a LONGBLOB. which means for the size range I should be using LONGBLOB to store 500 KB file or a 100 MB file.
MySQL:
- Faster access.
- Single place for all the data. Data extracted from files and files are stored in one location.
- ..