Skip to content

Commit 0b67a80

Browse files
authored
network docs (#36)
1 parent d1b3ecd commit 0b67a80

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
icon: material/network
3+
---
4+
5+
# Network
6+
7+
PgDog speaks the Postgres protocol which, underneath, uses TCP. Optimal TCP settings are necessary to quickly recover from database incidents. For example:
8+
9+
```toml
10+
[tcp]
11+
keepalives = true
12+
time = 60_000
13+
interval = 60_000
14+
retries = 3
15+
user_timeout = 5_000
16+
```
17+
18+
To be consistent with the rest of PgDog documentation, units of time are in milliseconds. However, many TCP implementations only support seconds. Consider using round units, e.g., `1_000` milliseconds = 1 second.
19+
20+
!!! note "Support for keep-alives"
21+
Not all networks support or play well with TCP keep-alives. If you see an increased number of dropped connections after enabling these settings, you may have to disable them.
22+
23+
### `keepalives`
24+
25+
Enable TCP keep-alives. When enabled, idle client & server connections will send keep-alive packets to make sure the TCP connections are healthy.
26+
27+
Default: **`true`** (enabled)
28+
29+
### `time`
30+
31+
Configures the `TCP_KEEPALIVE` TCP socket option. Amount of time after which the connection is declared "idle" and keep-alive messages are sent to maintain it.
32+
33+
Default: **none** (system default: 2 hours)
34+
35+
### `interval`
36+
37+
Controls the value of the `TCP_KEEPINTVL` socket setting. Amount of time between keep-alive messages.
38+
39+
Default: **none** (system default)
40+
41+
### `retries`
42+
43+
Controls the value of the `TCP_KEEPCNT` socket setting. How many times to retry a failed keep-alive message until the connection is terminated.
44+
45+
Default: **none** (system default)
46+
47+
### `user_timeout`
48+
49+
Controls the value of the `TCP_USER_TIMEOUT` socket setting. Amount of time data in the socket can be unacknowledged by the peer before the connection is closed. Protects against dead networks / black holes.
50+
51+
Default: **none** (disabled)

0 commit comments

Comments
 (0)