Skip to content

perf: enable tcpNoDelay by default#2495

Merged
davecramer merged 1 commit intopgjdbc:masterfrom
obourgain:enable_tcpNoDelay_by_default
Apr 21, 2022
Merged

perf: enable tcpNoDelay by default#2495
davecramer merged 1 commit intopgjdbc:masterfrom
obourgain:enable_tcpNoDelay_by_default

Conversation

@obourgain
Copy link
Copy Markdown
Contributor

@obourgain obourgain commented Apr 20, 2022

In #2341 the option to
configure tcpNoDelay was added, with a default value of false.

The previous value of this setting was true, as set in
PGStream.changeSocket(Socket) with the following code:

    // Submitted by Jason Venner <[email protected]>. Disable Nagle
    // as we are selective about flushing output only when we
    // really need to.
    connection.setTcpNoDelay(true);

changeSocket() is called from the PGStream constructor, which is
called in ConnectionFactoryImpl, and then later we overwrite the value
with the one from the properties.

We had a performance issue when upgrading from 42.2.24 to 42.3.3, and we suspected the
issue in 42.3.2 and confirmed that by passing the property tcpNoDelay=true to the driver,
the performance issue was fixed.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Existing Features:

  • Does this break existing behaviour? If so please explain.
    no breaking change
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
    no need
  • Have you successfully run tests with your changes locally?

In [pgjdbc#2341](pgjdbc#2341) the option to
configure tcpNoDelay was added, with a default value of false.

The previous value of this setting was true, as set in
PGStream.changeSocket(Socket) with the following code:
```
    // Submitted by Jason Venner <[email protected]>. Disable Nagle
    // as we are selective about flushing output only when we
    // really need to.
    connection.setTcpNoDelay(true);
```

`changeSocket()` is called from the `PGStream` constructor, which is
called in `ConnectionFactoryImpl`, and then later we overwrite the value
with the one from the properties.

We had a performance issue when upgrading from 42.2.24 to 42.3.3, and we suspected the
issue in 42.3.2 and confirmed that by passing the property `tcpNoDelay=true` to the driver,
the performance issue was fixed.
@davecramer davecramer merged commit c144392 into pgjdbc:master Apr 21, 2022
@obourgain obourgain deleted the enable_tcpNoDelay_by_default branch April 21, 2022 09:32
obourgain added a commit to obourgain/pgjdbc that referenced this pull request Apr 21, 2022
davecramer pushed a commit that referenced this pull request Apr 21, 2022
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.

2 participants