GridFS uses the file name as an index

I am currently working on a "simple" mongoDB photosystem using a replica set and GridFS.

The principle is simple, I put a lot of photos using GridFS, the client knows the file name and from the file name I can get the file.

Is GridFS using file name as indexes? Hopefully, yes, I could not find it in any official document.

My statistics:

     {
        "ns" : "photos.socialphotos.files",
        "count" : 758086,
        "size" : 168295128,
        "avgObjSize" : 222.00004748801587,
        "storageSize" : 220647424,
        "numExtents" : 15,
        "nindexes" : 2,
        "lastExtentSize" : 43311104,
        "paddingFactor" : 1,
        "flags" : 1,
        "totalIndexSize" : 125084624,
        "indexSizes" : {
            "_id_" : 22925504,
            "filename_1_uploadDate_1" : 102159120
        },
        "ok" : 1
    }

EDIT : According to the reIndex () collection, I won 30 Go, but it's still too tall.

My indices:

{
    "v" : 1,
    "key" : {
        "_id" : 1
    },
    "ns" : "photos.socialphotos.files",
    "name" : "_id_"
},
{
    "v" : 1,
    "key" : {
        "filename" : 1,
        "uploadDate" : 1
    },
    "ns" : "photos.socialphotos.files",
    "name" : "filename_1_uploadDate_1"
}

Index Size:

"keysPerIndex" : {
    "photos.socialphotos.files.$_id_" : 758086,
    "photos.socialphotos.files.$filename_1_uploadDate_1" : 758086
}

I never use _id_, because I do not store it, is it right to delete it? The index size is 125084624, which means that I should have almost all of my photos in RAM, which is a bit strange?

Additional questions:

  • : mongostats - , , ?

  • : LOT ( 100 ), , ... ?

  • Connecion Pool JAVA/Tomcat: Tomcat Webapp MongoDB, mongoDB ( , ) singleton Mongo (, Holder) , ?

!

+5
2

:

1) GridFS Java, .files .chunks.

2) MongoDB , "_id" "_id" . "_id" 12 - .

: http://www.mongodb.org/display/DOCS/Object+IDs

3) "filename_1_uploadDate_1" index. - . , .

:

4) , MMS, 10gen. : https://mms.10gen.com/help/

5) . MongoDB , , , .

: http://docs.mongodb.org/manual/faq/storage/

6) Java MongoDB . , , , Mongo .

+4

, _id "" :

http://www.mongodb.org/display/DOCS/Object+IDs

, , MongoDB BsonObjectId, . , Mongo . ... , , + dateupload _id Mongo .

, ... 125084624 , _id. .. 125 .
, , .. , 64-. 32-, DB 2 . - .

, , , singleton. , . , Jmeter:

http://jmeter.apache.org/

+2

All Articles