MARTIMM / raku-mongodb-driver

MongoDB driver for Raku
Artistic License 2.0
18 stars 8 forks source link

Client class uses too many threads permanently #23

Closed MARTIMM closed 6 years ago

MARTIMM commented 7 years ago

A Client object needs a thread to check for new servers in case of replica set servers and others. This mostly does not change a lot when all servers are detected and this thread should stop then. Periodic checks should be sufficient later e.g. when requesting for a Server object.

The Server object created by the Client is also taking a thread to monitor a mongo server to see if it is still there or to monitor any changes. This means for every server there is one thread. This can all be done by one monitoring thread for all servers.

So in case of a master replica set server, two slave servers and an arbiter would take up 5 threads!