Advantages and disadvantages of file systems and databases

If you choose to upload the best way to save a file server hesitant, if you are used to store files in the file system and file system are considered in order to save the file created, or if you do not worry about some the advantage of using the database to save the file in the case, it's time to rethink your choice.

File system

The advantages of file system
performance may be better than when executed in the database. To prove this, if in the database, you may reduce the performance of large-scale file storage, file system, file access is very simple, light weight. Save the file and download it to the file system is much simpler than in the database, simply because the "Save As" function can help you. Files can be saved by using the URL address position to complete the download. Migrating data is a simple process. You can copy files to a folder and paste it to the desired destination, while ensuring write permission for the target.

Disadvantage filesystem
1) loosely packed. Relational mapping is not ACID (atomicity, consistency, isolation, durability) operation, which means you can not guarantee. Consider a situation, you manually or delete your files from the hands of hackers through some guy. You may not know whether the file exists.


2) low security. Since your files can be saved in your offer should write access to a folder, so it is prone to security issues and cause trouble, such as hacker attacks. If you can not make compromises in terms of safety, it is best to avoid stored in the file system.

 

database

The advantages of database
ACID consistency, including a rollback in the update files are stored in an external database. Files are synchronized with the database, can not be isolated, which prevailed at the time of tracking the transaction. Automatic backup file contains the binary files. Than it saved in the file system more secure.


The shortcomings of the database
may have to convert the file to blob to store them in the database. Database backup will be more heavy and heavy. Typically, the RDBMS is driven by a RAM, all data must first enter the RAM. When the RDBMS must find and sort data what will happen? RDBMS tracks each data page - even if the amount of data read and write least - it must keep track of whether it is in memory, on disk or whether it is, or has been indexed on whether or not the classification of physics.

Guess you like

Origin www.cnblogs.com/raysync0704/p/11134182.html