Skip to content

Commit 9518780

Browse files
committed
Enabled TCP NoDelay by default
We now enable TCP NoDelay by default to avoid delayed TCP ACK's. Our flushing behavior isn't ideal yet, but combining messages allows to reduce the number of TCP packets. [resolves #334][#138]
1 parent 092f59b commit 9518780

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ Mono<Connection> connectionMono = Mono.from(connectionFactory.create());
9090
| `sslCert` | Path to SSL certificate for TLS authentication in PEM format. _(Optional)_
9191
| `sslPassword` | Key password to decrypt SSL key. _(Optional)_
9292
| `sslHostnameVerifier` | `javax.net.ssl.HostnameVerifier` implementation. _(Optional)_
93-
| `tcpNoDelay` | Enabled/disable TCP NoDelay. Disabled by default. _(Optional)_
94-
| `tcpKeepAlive` | Enabled/disable TCP KeepAlive. Disabled by default. _(Optional)_
93+
| `tcpNoDelay` | Enable/disable TCP NoDelay. Enabled by default. _(Optional)_
94+
| `tcpKeepAlive` | Enable/disable TCP KeepAlive. Disabled by default. _(Optional)_
9595

9696
**Programmatic Configuration**
9797

src/main/java/io/r2dbc/postgresql/PostgresqlConnectionConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public static final class Builder {
345345

346346
private boolean tcpKeepAlive = false;
347347

348-
private boolean tcpNoDelay = false;
348+
private boolean tcpNoDelay = true;
349349

350350
@Nullable
351351
private LoopResources loopResources = null;

src/test/java/io/r2dbc/postgresql/PostgresqlConnectionConfigurationUnitTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void configuration() {
8787
.username("test-username")
8888
.sslMode(SSLMode.ALLOW)
8989
.tcpKeepAlive(true)
90-
.tcpNoDelay(true)
90+
.tcpNoDelay(false)
9191
.loopResources(loopResources)
9292
.build();
9393

@@ -102,7 +102,7 @@ void configuration() {
102102
.hasFieldOrPropertyWithValue("username", "test-username")
103103
.hasFieldOrProperty("sslConfig")
104104
.hasFieldOrPropertyWithValue("tcpKeepAlive", true)
105-
.hasFieldOrPropertyWithValue("tcpNoDelay", true)
105+
.hasFieldOrPropertyWithValue("tcpNoDelay", false)
106106
.hasFieldOrPropertyWithValue("loopResources", loopResources);
107107

108108
assertThat(configuration.getOptions())
@@ -131,7 +131,7 @@ void configurationDefaults() {
131131
.hasFieldOrPropertyWithValue("username", "test-username")
132132
.hasFieldOrProperty("sslConfig")
133133
.hasFieldOrPropertyWithValue("tcpKeepAlive", false)
134-
.hasFieldOrPropertyWithValue("tcpNoDelay", false)
134+
.hasFieldOrPropertyWithValue("tcpNoDelay", true)
135135
.hasFieldOrPropertyWithValue("loopResources", null);
136136

137137
assertThat(configuration.getOptions())

0 commit comments

Comments
 (0)