Get started syriaproxy The first proxy made for Syria

Proxy speed: latency and throughput

Proxy speed is not one number but three: latency, throughput and time to first byte. A proxy adds distance to your connection's path, which raises latency, and its throughput is capped by the slowest link in the chain. You can measure each phase separately with a single curl command.

Three different measures

Web pages and small requests depend mostly on latency. Downloading a large file is governed by throughput.

What happens before the first byte

This is the sequence for an HTTPS request through an HTTP proxy on a fresh connection:

  1. Your device opens a TCP connection to the proxy: one round trip between you and the proxy.
  2. It sends a CONNECT with the site's name. The proxy resolves the name, opens a connection to the site, then replies with success. That is one round trip to the proxy plus one between the proxy and the site. The method is explained in HTTPS proxies and CONNECT.
  3. The TLS handshake between you and the site runs through the tunnel. TLS 1.3 needs one round trip over the whole path, as in RFC 8446; TLS 1.2 needs two.
  4. The request itself: another round trip over the whole path, plus the server's processing time.

A worked example: if the round trip between you and the proxy is 80 ms and between the proxy and the site 20 ms, the whole path is 100 ms. The first byte arrives after about 380 ms plus server time: 80 for the connection, 100 for CONNECT, 100 for TLS and 100 for the request.

With SOCKS5 only the second step changes. RFC 1928 defines an exchange to choose the authentication method, then authentication if there is any, then the request to connect to the site. On a connection that is already open, the first three steps disappear and only the request remains.

Why your own line speed is not enough

Throughput through a proxy cannot exceed the slowest link: your line, the path to the proxy, the proxy's own line, and the path on to the site. Latency matters here too, not just for the first byte.

RFC 6349 explains why: TCP will not send more than its window before an acknowledgement comes back. Maximum throughput is therefore the window size times 8, divided by the round-trip time. The amount of data that must be "in flight" to fill the line is the bandwidth times the round-trip time, the bandwidth-delay product (BDP).

For example, a 64 KB window with a 200 ms round trip caps a single connection at about 2.6 Mbit/s, however fast the line is. To fill a 12 Mbit/s line over the same round trip you need a window of at least 300 KB. That is why a distant proxy downloads more slowly than a nearby one, even on equal lines. Packet loss, common on wireless networks, lowers throughput further.

What is different about mobile exits

On a mobile network the path gains a wireless segment between the device and the cell. Its latency varies with signal strength and the number of users on the same cell. Measurements on a mobile exit therefore vary more than on a server in a data center.

When a large download fills the line, packets queue in buffers along the path and latency rises for every other connection. If a download is running in the background, expect pages to slow down with it. Upload speed on mobile networks is also usually lower than download speed.

Measuring with curl timings

curl's -w option prints the timing of each phase when the request finishes:

curl -s -o /dev/null -x http://HOST:PORT --proxy-user USER:PASS \
  -w 'connect   %{time_connect}\ntls       %{time_appconnect}\nfirstbyte %{time_starttransfer}\ntotal     %{time_total}\n' \
  https://example.com/

All values are in seconds, and all are counted from the start of the request, not from the end of the previous phase. This is what each one means according to the curl manual:

VariableWhat it measuresNote with a proxy
time_namelookupUntil name resolution completedThe proxy resolves the site's name, so this covers the proxy's name only
time_connectUntil the TCP connect to the remote host or proxy completedHere it is the connection to the proxy, i.e. your distance to it
time_appconnectUntil the TLS handshake with the remote host completedIncludes opening the tunnel and the proxy's connection to the site
time_starttransferUntil the first byte was receivedThis is your TTFB
time_totalThe whole operationIncludes the full transfer
speed_downloadAverage download speed in bytes per secondMultiply by 8 for bits per second

The gaps between the values show where the delay is:

To measure throughput, download a large file, say a hundred megabytes, and print %{speed_download}. Small files are not enough, because TCP starts slowly and grows its window gradually.

How to get measurements you can trust

  1. Repeat every measurement at least ten times and take the median, not the mean, since one outlier skews the mean.
  2. Run the same command without -x. The difference between the two results is the cost of the proxy.
  3. Separate fresh connections from reused ones; the first pays for every handshake.
  4. Test at different times of day, against the site you will actually use.

How to make it faster

With syriaproxy your traffic exits from the Syriatel 4G network inside Syria, at speeds up to 12 Mbit/s. Latency includes the path from you to Syria and then on to the site. Syrian sites and services therefore respond faster than sites far from Syria.

FAQ

Why does a speed test look fast while pages feel slow?

Speed tests measure throughput with large files. Pages are made of many small requests, and every new connection among them pays for its round trips, so latency rules.

What is the difference between Mbit/s and MB/s?

A byte is eight bits. So 12 Mbit/s is about 1.5 MB/s, which is what download managers usually show.

Is an HTTP proxy faster than SOCKS5?

Usually the difference is small. SOCKS5 with authentication needs slightly more exchanges when opening a connection, but after that it moves data at the same speed. Distance to the proxy matters more than the protocol.

Why is the first measurement slower than the rest?

Because the first request pays for everything: name resolution, the connection and the handshakes. Later requests benefit from cached names, and may resume an earlier TLS session or reuse the same connection.

Measure your proxy's latency with the free proxy checker, no command line needed.