mongodb存储海量小文件的问题

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

各位好!

我想请教一下各位是否曾经研究过将海量的小文件存储到mongodb所提供的GridFS中

目前我遇到的主要是两个问题:

1 插入速度慢,单节点mongod插入速度还可以(4000-8000每秒),但是集群下面无论扩展多少个节点,速度始终保持在(2000-4000每秒)

2 使用shard分片存储数据时,各个shard的存储总是不能平均,导致集群的写入速度瓶颈卡在某一台机器上

下面是我测试的环境

mongodb的版本是2.0.1

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 print

转载于:https://my.oschina.net/timtech/blog/38036

你可能感兴趣的:(mongodb存储海量小文件的问题)