各位好!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