Mongodb sharding performance issue -
test :
- insert 200 images (300-800ko/img) using directly replica set
- insert 200 images (300-800ko/img) using same replica set shard.
i realize these operations have different execution time ...
- replica set : 200 pictures in around 30 sec.
- sharding : around 3sec./picture => around 7- 8 minutes these 200 pictures !!!
==> don't understand why these inserts slow sharding ... <==
conditions :
- php driver
- gridfs : fs.chunks sharded
- write concern : majority
- 1 thread : php, parse array contains path pictures, , store picture in mongodb using gridfs.
ressources :
(all servers openvz vm's on proxmox plate-form (all on same machine (for test)))
3 mongod : 6go ram (50% while inserting), 1cpu (99% idle while inserting...)
2 arbiters : 512mo ram (100mo used), 1cpu(100% idle ...)
1 config : 2go ram (200mo used), 1 cpu(100% idle ...)
1 mongos : 512mo ram (100mo used), 1cpu (98%idle while inserting...)
notes :
while inserting with sharding :
- ~1->5% cpu utilization mongod, mongos , config_svr instances
- ~5% ram utilization mongos/config_svr
- ~50% mongod
- network throughput (metrics taken on mongod): mongos <--> primary mongod : ~300kb/s
while inserting without sharding (replica set directly) :
- network throughput (metrics taken on mongod): hosting pictures server <--> primary mongod : ~30mb/s
php class : pastebin.com_[mongodb-class] (that contains code interact mongodb)
added @ top of class :
mongolog::setlevel(mongolog::all)
mongolog::setmodule(mongolog::all)
display_errors=1
error_reporting=-1
the client directly calls storefile() method of class...
result page here : pastebin.com_[resultpage]
documents inserted simple as: mongoid, picture_binaries_data
i've no meta-data, mongodb generates during storing process.
here's result of sh.status() on mongos :
mongos> sh.status() --- sharding status --- sharding version: { "_id" : 1, "version" : 3, "mincompatibleversion" : 3, "currentversion" : 4, "clusterid" : objectid("518372e807be4a15fb391fab") } shards: { "_id" : "rs0", "host" : "rs0/192.168.36.101:27017,192.168.36.102:27017,192.168.36.103:27017" } databases: { "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "test", "partitioned" : false, "primary" : "rs0" } { "_id" : "bepics_gallery", "partitioned" : false, "primary" : "rs0" } { "_id" : "bepics_images", "partitioned" : true, "primary" : "rs0" } bepics_images.fs.chunks shard key: { "files_id" : 1 } chunks: rs0 9 { "files_id" : { "$minkey" : 1 } } -->> { "files_id" : objectid("5183926028d40965190000ea") } on : rs0 { "t" : 1, "i" : 1 } { "files_id" : objectid("5183926028d40965190000ea") } -->> { "files_id" : objectid("5183a1be28d409051e000004") } on : rs0 { "t" : 1, "i" : 3 } { "files_id" : objectid("5183a1be28d409051e000004") } -->> { "files_id" : objectid("5183a2a728d409051e00008f") } on : rs0 { "t" : 1, "i" : 5 } { "files_id" : objectid("5183a2a728d409051e00008f") } -->> { "files_id" : objectid("5183b70328d409cc1e00008f") } on : rs0 { "t" : 1, "i" : 7 } { "files_id" : objectid("5183b70328d409cc1e00008f") } -->> { "files_id" : objectid("5183c6f728d409e526000037") } on : rs0 { "t" : 1, "i" : 9 } { "files_id" : objectid("5183c6f728d409e526000037") } -->> { "files_id" : objectid("5183c76028d409e526000076") } on : rs0 { "t" : 1, "i" : 11 } { "files_id" : objectid("5183c76028d409e526000076") } -->> { "files_id" : objectid("5183c7cb28d409ea2600001f") } on : rs0 { "t" : 1, "i" : 13 } { "files_id" : objectid("5183c7cb28d409ea2600001f") } -->> { "files_id" : objectid("5183c84e28d409ea2600006d") } on : rs0 { "t" : 1, "i" : 15 } { "files_id" : objectid("5183c84e28d409ea2600006d") } -->> { "files_id" : { "$maxkey" : 1 } } on : rs0 { "t" : 1, "i" : 16 } to connect cluster, use mysql table store servers configuration ip, port, priority, rs_name, ...
in repica set archi. => build connection-pool name of replica set, , 3 first servers, sorted priority.
in sharding archi. => build connection-pool all mongos.
(all adresses in connections-pool formatted ip:port)
can me solve or explain me ?
Comments
Post a Comment