Web applications usually handle uploaded files in two different ways: store them on disk, or store them in a database as BLOB or CLOB. In this assignment, you are going to conduct some experiments to evaluate the pros and cons of these two approaches.
[Application] (30pt)Write a web application that allows a user to upload a file, and store the file either on disk, or as CLOB or BLOB in a database, as shown below. When the application receives a file, it performs the following operations:
Please upload a file: | |
Store the file as: | |
Note that the application does not have to be complex (in fact, one servlet should be enough). However, it has to be a "complete" application that follows the directory structure discussed in class, and include all the supporting files such as libraries, SQL scripts, and Ant build files.
[Experiments and Analysis] (30pt)
Create text files of size 1KB, 10KB, ..., 100MB, and upload them to the application you developed in the previous exercise. Record the time it takes to upload these files in the following table. Note that you have to perform the experiments with both MySQL and PostgreSQL as the backend database system.
File Size | MySQL | PostgreSQL | ||||
CLOB | BLOB | Disk File | CLOB | BLOB | Disk File | |
1KB | ||||||
10KB | ||||||
100KB | ||||||
1MB | ||||||
10MB | ||||||
100MB |
Based on the experimental results, discuss the pros and cons of the two ways of storing the uploaded files. Include the results, your analysis, and other information about the experiments, e.g. hardware and software platform, versions of the DBMS and the JDBC drivers etc., in a file results.html.