10x Increase in Sessions with Java Driver and Spring Upgrade

I recently upgraded the java driver in my application and my local session count went from a steady count of ~20 to steady count of ~200. I upgraded from mono-java-driver-2.14.3 (using spring-data-mongodb 1.10.12 ) to mongo-java-driver-3.11.2 (using spring-data-mongodb 2.2.12.RELEASE). The workload hasn’t changed and I don’t believe that anything else in the code base changed. Does anyone have any suggestions as to why the version upgrade would cause a 10x increase in local sessions?

1 Like

It’s not clear what you mean by “local session”. Can you elaborate? How are you measuring this number?

Thanks for responding. Also I’m running MongoDB 3.6.6

db.aggregate( [  { $listLocalSessions: { allUsers: true } } , {$count: "sessions"} ] )


This is probably due to the fact that the 2.14 driver doesn’t create sessions at all, whereas the 3.11 driver does. In particular, it creates sessions in order to support features such as retryable writes and cluster-wide kill ops.

For more details, you can look at the driver sessions specification here.