Joe Enzminger
Joe Enzminger

Reputation: 11190

What is the purpose of the MaxConnectionLifeTime setting

The Mongo C Sharp Driver (at least the 1.9.2 version) has a setting for MaxConnectionLifeTime. From looking at the code, it looks like connections are removed from the pool when their age exceeds that lifetime. The default is set to 30 minutes.

Why?

Do connections somehow degrade in performance the more times they are used?

Upvotes: 0

Views: 2396

Answers (1)

Robert Stam
Robert Stam

Reputation: 12187

We have received anecdotal reports that in some scenarios connections die after a certain amount of time. This is presumably because some firewall/router along the way is periodically dropping connections that have reached a certain age.

By having the driver periodically close connections and open new ones we can avoid being affected by this.

Most users are not affected by this and could use any value they want for this setting.

Upvotes: 2

Related Questions