diff --git a/derp/derp_server.go b/derp/derp_server.go index 422ae2cfb942b..46a3be2c3c988 100644 --- a/derp/derp_server.go +++ b/derp/derp_server.go @@ -70,7 +70,13 @@ func init() { } const ( - perClientSendQueueDepth = 32 // packets buffered for sending + // perClientSendQueueDepth is the number of packets to buffer for sending. + // CODER: We've modified this to 512, up from 32 in upstream Tailscale to improve DERP + // throughput. 32 is an understandable number for big, public DERP servers that Tailscale run, + // serving many thousands of connections, and where Tailscale is footing the bill. In Coder's + // use case, we are serving hundreds to low thousands of users and the user's own company is + // paying the bills. In testing, it increases DERP throughput up to 6x. + perClientSendQueueDepth = 512 writeTimeout = 2 * time.Second )