I have been checking several questions here in stackoverflow + some posts where people exposes examples of of how to manage sessions with mgo golang lib .
The point is that all the examples I've seen doesn't run too much concurrent queries at the same time. Increasing the number of concurrent operations ends in closed sockets. Here you can find the code I ran in order to reproduce this behaviour.
Concurrent queries to MongoDB using mgo ends in closed sockets.
Note that I'm just running 200 of concurrent queries, opening a new socket for each one. 200 is not a big number.
The errors I see are:
read tcp 127.0.0.1:59583->127.0.0.1:27018: read: connection reset by peer
Closed explicitly
How should I deal with this? I want to keep this concurrency level, even increase it at some point.