Skip to content

Commit ce29514

Browse files
committed
docs: add conntrack tuning guide for high-concurrency gateway deployments
1 parent 88b70e8 commit ce29514

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

docs/deployment.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,36 @@ The CID range conflicts with existing VMs.
524524
cid_pool_size = 1000
525525
```
526526

527+
### High-concurrency deployments: conntrack table full
528+
529+
When running Gateway with many concurrent connections (>100K), the host's conntrack table may fill up, causing silent packet drops:
530+
531+
```
532+
dmesg: nf_conntrack: table full, dropping packet
533+
```
534+
535+
Each proxied connection creates multiple conntrack entries (client→gateway, gateway→WireGuard→backend). The default `nf_conntrack_max` (typically 262,144) is insufficient for high-concurrency gateways.
536+
537+
**Fix:**
538+
539+
```bash
540+
# Check current limit
541+
sysctl net.netfilter.nf_conntrack_max
542+
543+
# Increase for production (persistent)
544+
echo "net.netfilter.nf_conntrack_max = 1048576" >> /etc/sysctl.d/99-dstack.conf
545+
echo "net.netfilter.nf_conntrack_buckets = 262144" >> /etc/sysctl.d/99-dstack.conf
546+
sysctl -p /etc/sysctl.d/99-dstack.conf
547+
```
548+
549+
Also increase inside bridge-mode CVMs if they handle many connections:
550+
551+
```bash
552+
sysctl -w net.netfilter.nf_conntrack_max=524288
553+
```
554+
555+
**Sizing rule of thumb:** Set `nf_conntrack_max` to at least 4× your target concurrent connection count (each connection may use 2-3 conntrack entries across NAT/bridge layers).
556+
527557
### Error: Operation not permitted when building guest image
528558

529559
Ubuntu 23.10+ restricts unprivileged user namespaces:

0 commit comments

Comments
 (0)