Hosting and network Optional
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 standard default is 10 packets (RFC 6928), so measure the gain on your own network first.
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.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/hosting-and-network/tcp-initial-congestion-window.