Varnish Enterprise

Transfer rate limiting (tcp)


Socket pacing is a Linux method for rate limiting TCP connections in a network friendly way.

When running on systems with the necessary kernel support, Varnish can now artificially slow down sending of response bodies to requesting clients.

VCL example

VCL code:

import std;
import tcp;

sub vcl_recv {
	# Limit all clients to 1000 KB/s.
	# In 4.0:
	# std.set_socket_pace(1000);


Rate limiting is available starting from Varnish Enterprise 4.0.3r1.

Kernel support is needed for this feature to work. Ubuntu 14.04 (trusty) (Linux kernel 3.13) and later is known to work.


Rate limiting is built into Varnish Enterprise and does not need specific installation.

Servers utilizing socket pacing must change their network scheduler. This can be done with:

tc qdisc add dev eth0 root handle 1: fq

This change should be persisted across reboots, for example via /etc/rc.local.