WEB-160Optional
Send more in the first round trip
Let the server's first send carry the whole page. Raise the TCP initial congestion window. That is how much the server sends before waiting for a reply. Then the whole compressed HTML goes out without waiting.
How to do it
On Linux, run ip route change default via <gateway> dev <if> initcwnd 32 initrwnd 32 at boot, for example from a systemd unit. The first send grows from about 14 KB to about 46 KB. Keep the compressed HTML well under that. The usual default is 10 packets, from the experimental RFC 6928, so measure the gain on your own network first. Skip this rule on managed hosting or behind a CDN, where you cannot change the server's routes. Shrink the HTML first, as Compress every text response says.
Examples
Plain text example
# /etc/systemd/system/initcwnd.service
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c 'ip route change $(ip route show default | head -1) initcwnd 32 initrwnd 32'
[Install]
WantedBy=multi-user.target
How to check
ip route show lists initcwnd 32. In a lab with added delay, the HTML arrives after 3 round trips (TCP, TLS 1.3, request) instead of 4.
Measured
On a reference site in an earlier lab at a 100 ms round trip, HTML arrival went from 406 to 307 ms. First paint went from 446 to 345 ms.
Sources
Related rules
- WEB-46 Compress every text response in Website
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/hosting-and-network/tcp-initial-congestion-window">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.