Skip to content

Commit 3745841

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 f507c14 commit 3745841

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

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

9999
**Programmatic Configuration**
100100

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public static final class Builder {
369369

370370
private boolean tcpKeepAlive = false;
371371

372-
private boolean tcpNoDelay = false;
372+
private boolean tcpNoDelay = true;
373373

374374
@Nullable
375375
private LoopResources loopResources = null;

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

+3-3
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)