Skip to content

Conn cleanup is async, plus other startup tweaks - #381

Closed
roji wants to merge 1 commit into
npgsql:masterfrom
roji:async_conn_reset
Closed

roji wants to merge 1 commit into
npgsql:masterfrom
roji:async_conn_reset

Conversation

@roji

@roji roji commented Oct 12, 2014

Copy link
Copy Markdown
Member
  • Connector reset, which happens when the connector is returned to the pool (DISCARD ALL), now happens
    asynchronously - the user thread returns immediately, before the operation completes. Note that the
    IsValid() ping, which happens before returning a connector to the user, is still there.
  • Moved setting of ssl_renegotiation_limit to startup packet, was an additional roundtrip.
    This means that "DISCARD ALL" is sufficient to revert all params to their correct initial state.
  • Cleaned up an old pre-protocol3 flow

Fixes #268

@Emill, @franciscojunior, can you please take a look?

- Connector reset, which happens when the connector is returned to the pool (DISCARD ALL), now happens
  asynchronously - the user thread returns immediately, before the operation completes. Note that the
  IsValid() ping, which happens before returning a connector to the user, is still there.
- Moved setting of ssl_renegotiation_limit to startup packet, was an additional roundtrip.
  This means that "DISCARD ALL" is sufficient to revert all params to their correct initial state.
- Cleaned up an old pre-protocol3 flow

Fixes npgsql#268
@franciscojunior

Copy link
Copy Markdown
Member

Sure! I'll have a look at it.

While in the subject, I think we can start to think about removing the IsValid() ping. I think this is causing more trouble than helping. Or maybe make it optional.

@roji

roji commented Oct 12, 2014

Copy link
Copy Markdown
Member Author

It's a good question about the ping. I haven't yet understood exactly how MSSQL handles this issue, will reread the discussion with you and @Emill.

@Emill

Emill commented Oct 12, 2014

Copy link
Copy Markdown
Contributor

Mssql decided to not have any pings to avoid one round trip. They simply assume the socket will work. If not, an exception will be thrown when data is sent on the socket. I don't know what is the best... I would probably do some kind of periodic ping instead.

@jbcooley

Copy link
Copy Markdown
Contributor

I believe there are options in other providers to do pings that will help with high availability scenarios so that a failure is detected sooner.

Josh

@roji

roji commented Oct 14, 2014

Copy link
Copy Markdown
Member Author

I personally am for the ping, the idea of a user getting a connection from the pool, just to have it explode in their faces upon first use seems like a strange idea.

The slowdown in getting a new connection from the pool doesn't seem like such a high price to pay, but I may be underestimating it. @Emill's idea to implement periodic polling is interesting, but it would add extra load (both at the client and at the backend), and if the connection is broken at any point after the last periodic ping we're back to the exploding connections scenario...

@roji
roji force-pushed the master branch 2 times, most recently from e1d8c57 to 1f140e5 Compare January 14, 2015 02:37
@roji roji closed this Mar 13, 2015
@roji
roji deleted the async_conn_reset branch March 13, 2015 10:51
@roji
roji restored the async_conn_reset branch March 13, 2015 10:51
@roji
roji deleted the async_conn_reset branch March 26, 2015 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants