各位好!java
我想請教一下各位是否曾經研究過將海量的小文件存儲到mongodb所提供的GridFS中mongodb
目前我遇到的主要是兩個問題:測試
1 插入速度慢,單節點mongod插入速度還能夠(4000-8000每秒),可是集羣下面不管擴展多少個節點,速度始終保持在(2000-4000每秒)spa
2 使用shard分片存儲數據時,各個shard的存儲老是不能平均,致使集羣的寫入速度瓶頸卡在某一臺機器上線程
下面是我測試的環境orm
mongodb的版本是2.0.1server
host1 : mongos + config server
host2 : mongos + mongod + mongod (shard1)
host3 : mongos + mongod + mongod (shard2)
host4 : mongos + mongod + mongod (shard3)
host5 : mongos + mongod + mongod (shard4)
我在host1上面啓動了5個java-client,每一個client啓動50個線程訪問不一樣的mongos
下面是db.printShardStatus()的結果
--- Sharding Status ---
sharding version: { "_id" : 1, "version" : 3 }
shards:
{ "_id" : "s1", "host" : "shard1/dxud3c008:27017,dxud3c008:27018" }
{ "_id" : "s2", "host" : "shard2/dxud3c009:27017,dxud3c009:27018" }
{ "_id" : "s3", "host" : "shard3/dxud3c010:27017,dxud3c010:27018" }
{ "_id" : "s4", "host" : "shard4/dxud3c011:27017,dxud3c011:27018" }
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "test", "partitioned" : true, "primary" : "s1" }
test.fs.chunks chunks:
s2 592
s3 592
s4 654
s1 679
too many chunks to print, use verbose if you want to force print
test.fs.files chunks:
s2 87
s3 86
s4 86
s1 584
too many chunks to print, use verbose if you want to force printit