MongoDB-based gridfs Image Storage

Source: Internet
Author: User

It is a sub-module of MongoDB. gridfs can be used to store files persistently Based on MongoDB. it also supports distributed applications (File distributed storage and reading ). gridfs is a tool for users to store large objects in MongoDB. It has a size limit for data (document) Storage in MongoDB and bson format, up to 16 Mb. however, in actual system development, the function of uploading images or files is often available. These files may be of large size .. we can use gridfs to help manage these files.

The file table of Mongo GFS consists of the table name. Files and table name. Chunks. The former is the file information, and the latter is the file content. The two are associated with files_id through _ id.

Gridfs splits large file objects into multiple small chunks (File fragments), which are generally 256 k/number. Each Chunk is used as a document of MongoDB) stored in the chunks collection .. the gridfs module creates chunks and files information for each file. the actual content of each file is stored in chunks (binary data). The file-related meta data (filename, content_type, and custom attributes) will be stored in the files set. documents in the files set are in the bson format. You can use MongoDB indexes and other features. Of course, you can perform data analysis on files.

Use Cases: if your system has the following scenarios:

1) there are a large number of uploaded images (User uploads, System File releases, etc)

2) The magnitude of files is growing rapidly. It is possible that the file system query performance bottleneck of the single-host operating system may exceed the expansion range of the single-host hard disk.

3) file backup (not applicable to gridfs, which can be done by third parties, but not convenient), failover and repair of file system access ..

4) file indexing: in addition to the file itself, more metadata information needs to be associated (for example, not only files are stored, you also need to save the published author/release time/file tag attributes and other custom information of some files...

5) based on 4), the classification of files is fuzzy. If the file system of the operating system is used, the folder classification relationship is chaotic or cannot be classified ..

6) The current system is web-based, and the access to images is routed according to the URL rules .. (normal file systems can also)

7) the file size is small and large, and the file may be migrated/deleted ..

The following are two ppt files that describe MongoDB's gridfs, including the advantages of gridfs over traditional file system storage and Network File System storage. Although the content is similar, the introduction methods vary. We recommend it to you.

Gridfs and MongoDB

View more presentations from Mitch pirtle Grid FS

View more presentations from Chris powers MongoDB gridfs

View More PowerPoint from XUE WEI

Use MongoDB storage to upload physical files and perform squid acceleration (based on the ASPX page)

Performance testing of hundreds of millions of MongoDB data volumes

Topics on MongoDB data aggregation

Http://www.oschina.net/question/12_29127

MongoDB-based gridfs Image Storage

File storage policy based on MongoDB gridfs

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.