[CSHARP-585] Don't open and close a connection every 10 seconds Created: 01/Oct/12 Updated: 20/Mar/14 Resolved: 01/Jan/13 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.6 |
| Fix Version/s: | 1.8 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Robert Stam | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
The C# driver opens and closes a connection every 10 seconds to ping the health of the server(s) it is connected to. It does this so that pinging the server is not dependent on a connection being available in the connection pool. The bad thing is that it causes lots of noise in the server logs about connections opening and closing. A better solution would be to open a connection and keep reusing it. This would be a dedicated connection for pinging and would never be put in the connection pool. |
| Comments |
| Comment by auto [ 01/Jan/13 ] |
|
Author: {u'date': u'2013-01-01T16:54:53Z', u'email': u'robert@10gen.com', u'name': u'rstam'}Message: |
| Comment by Robert Stam [ 20/Dec/12 ] |
|
A variation on that when the connection pool doesn't already have a connection sitting there ready for immediate use is to wait a few seconds for one to show up before giving up and creating a new one. We're only polling for replica set status once every 10 seconds, so it probably makes no difference if that now and then stretches to 11 or 12 seconds. |
| Comment by Craig Wilson [ 20/Dec/12 ] |
|
Another solution would be to use a connection from the connection pool if one is available and only to open a new connection if one isn't. This would keep the number of connections on the server down when one is already opened. |