simagix / keyhole

Survey Your Mongo Land - MongoDB Performance Analytics
Apache License 2.0
377 stars 62 forks source link

Support for multiple mongos #61

Closed caio-vinicius closed 3 years ago

caio-vinicius commented 3 years ago
➜  keyhole ./keyhole "mongodb://admin:1234@x:27017,x:27018"

2021-04-27T16:53:04-03:00 I MongoDB v4.4.5 community aed6234f3232 (Ubuntu) mongos sharded(1) 1 cores 978 mem
Begin a load test [y/N]: y
2021-04-27T16:53:22-03:00 I Duration in minute(s):5
2021-04-27T16:53:22-03:00 I Total TPS: 160 (20 tps/conn * 8 conns), duration: 5 (mins)
2021-04-27T16:53:24-03:00 I Sharding collection:_KEYHOLE_88800.__examples
2021-04-27T16:53:25-03:00 I splitting chunks...
2021-04-27T16:53:25-03:00 I moving chunks...
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/simagix/keyhole/sim.(*Runner).splitChunks(0xc00051a400, 0xf33b80, 0xc0000b6020)
    /go/src/github.com/simagix/keyhole/sim/runner.go:454 +0x1a6b
github.com/simagix/keyhole/sim.(*Runner).createIndexes(0xc00051a400, 0x0, 0x0, 0x0, 0x4, 0xc000418080)
    /go/src/github.com/simagix/keyhole/sim/runner.go:338 +0x5cb
github.com/simagix/keyhole/sim.(*Runner).Start(0xc00051a400, 0xc000200320, 0x50)
    /go/src/github.com/simagix/keyhole/sim/runner.go:190 +0x474
github.com/simagix/keyhole.StartSimulation(0xc00051a400, 0xc00019f800, 0x1)
    /go/src/github.com/simagix/keyhole/simulation.go:12 +0x2b
github.com/simagix/keyhole.Run(0xc0000c6860, 0x1f)
    /go/src/github.com/simagix/keyhole/keyhole.go:286 +0x1c0d
main.main()

When I try to run the executable with many connection in the connection string I got this error. Seems like something to do with the split used to parsing the connection string. This will be nice to be supported since MongoDB Shard Cluster with many mongos could be a scenario to test.

simagix commented 3 years ago

It failed at chunk moves and nothing related to the numbers of mongos. Fixed in https://github.com/simagix/keyhole/commit/9e29e8916919ac240437ba35bcb788f7b4ff91aa.