> ## Documentation Index
> Fetch the complete documentation index at: https://help.miyaip.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test proxy latency with curl on Windows, macOS, and Linux

> Measure proxy connection time, time to first byte, total request duration, and failures with curl, then compare them with a direct connection.

Measure direct and proxied requests to the same target from the machine that will run your task. Keep complete request timings and errors. [Source: MiyaIP latency guide](https://miyaip.com/blog/proxy-latency-test).

## Prepare a comparable test

<Steps>
  <Step title="Fix the configuration and target">
    Copy the generated host, port, username, and password. Record the gateway, requested exit location, protocol, session policy, and timestamp.

    The **[https://example.com/](https://example.com/)** URL below demonstrates syntax. Replace it in every command with the same actual test URL. Use a small response and consistent request and redirect behavior. These commands do not follow redirects or fetch page subresources.
  </Step>

  <Step title="Measure the direct baseline">
    Run the direct command for your platform first. **--noproxy '\*'** explicitly disables proxies for that request, preventing proxy environment variables from affecting the baseline.
  </Step>

  <Step title="Measure the proxy path">
    Choose the HTTP or SOCKS5 command matching your generated configuration. Replace every uppercase placeholder.

    An HTTP proxy and an HTTPS target are separate settings. Use an https\:// proxy scheme only when the dashboard explicitly supplies a TLS proxy listener. The SOCKS5 example uses socks5h:// for proxy-side destination DNS.
  </Step>

  <Step title="Repeat and keep failures">
    Run **5–10 sequential requests** for each configuration. Keep the device, network, target, response size, and session policy consistent. Record HTTP status, curl exit code, errors, and all three timings.

    Report the median, minimum, and maximum total time of successful requests, plus **failed requests / total requests**. Timeouts, authentication failures, and unexpected target errors are not zero-second successes. Reuse credentials for sticky comparisons; see [rotation and sessions](/guides/rotation-sessions).
  </Step>
</Steps>

## macOS or Linux

### Direct request

```bash theme={null}
curl --noproxy '*' --connect-timeout 10 --max-time 30 --output /dev/null --silent --show-error --write-out 'http=%{http_code} connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' --url 'https://example.com/'
printf 'curl_exit=%s\n' "$?"
```

### HTTP proxy

```bash theme={null}
curl --proxy 'http://PROXY_HOST:PROXY_PORT' --proxy-user 'PROXY_USERNAME:PROXY_PASSWORD' --noproxy '' --connect-timeout 10 --max-time 30 --output /dev/null --silent --show-error --write-out 'http=%{http_code} connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' --url 'https://example.com/'
printf 'curl_exit=%s\n' "$?"
```

### SOCKS5 proxy

```bash theme={null}
curl --proxy 'socks5h://PROXY_HOST:PROXY_PORT' --proxy-user 'PROXY_USERNAME:PROXY_PASSWORD' --noproxy '' --connect-timeout 10 --max-time 30 --output /dev/null --silent --show-error --write-out 'http=%{http_code} connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' --url 'https://example.com/'
printf 'curl_exit=%s\n' "$?"
```

`--noproxy ''` clears bypass exclusions for that request. `socks5h://` resolves the destination through the proxy; `socks5://` uses local resolution.

## Windows PowerShell

Use `curl.exe` to avoid the `curl` alias. Discard the response using `NUL`, rather than the Unix `/dev/null` path.

### Direct request

```powershell theme={null}
curl.exe --noproxy '*' --connect-timeout 10 --max-time 30 --output NUL --silent --show-error --write-out 'http=%{http_code} connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' --url 'https://example.com/'
"curl_exit=$LASTEXITCODE"
```

### HTTP or SOCKS5 proxy

```powershell theme={null}
$latencyProxy = 'http://PROXY_HOST:PROXY_PORT'
# For SOCKS5, use 'socks5h://PROXY_HOST:PROXY_PORT'
$latencyPreviousNoProxy = $env:NO_PROXY
try {
  $env:NO_PROXY = ''
  curl.exe --proxy $latencyProxy --proxy-user 'PROXY_USERNAME:PROXY_PASSWORD' --connect-timeout 10 --max-time 30 --output NUL --silent --show-error --write-out 'http=%{http_code} connect=%{time_connect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' --url 'https://example.com/'
  "curl_exit=$LASTEXITCODE"
} finally {
  $env:NO_PROXY = $latencyPreviousNoProxy
}
```

Set `$latencyProxy` according to the supplied protocol. The example temporarily clears and restores `NO_PROXY`, preventing bypass exclusions without depending on empty native arguments in older PowerShell versions.

## Read timings and errors

| Output | Meaning | Interpretation |
| - | - | - |
| `http` | Received HTTP status | Compare with the target's expected status; curl exit code 0 does not establish application success |
| `curl_exit` | curl process exit code | A nonzero value indicates a transfer error; inspect the error message |
| `connect` | Elapsed seconds until TCP connection establishment | Usually the client-to-entry connection for a proxied test |
| `ttfb` | Elapsed seconds until the first response byte | Includes connection setup, tunnel/TLS, and response waiting |
| `total` | Complete transfer duration | Also depends on response size and transfer speed |

These cumulative timings overlap; do not add them. A slow direct baseline calls for checking the local network and target. Slow connection setup suggests inspecting the entry path. Higher first-byte or total time needs examination alongside target behavior and transfer size. One timing cannot isolate every internal proxy hop.

A new curl process usually creates a new connection, while your application may reuse one. Diagnose with consistent commands, then test the actual application. See the [curl manual](https://curl.se/docs/manpage.html) for option and timing definitions.

## Optional ping checks only entry ICMP

Use the hostname alone, without a port, URL, or credentials.

Windows:

```powershell theme={null}
ping -n 10 PROXY_HOST
```

macOS or Linux:

```bash theme={null}
ping -c 10 PROXY_HOST
```

Ping does not authenticate to the proxy or request a destination through its exit. An ICMP timeout does not establish that the proxy service is unavailable. Successful ping does not establish valid credentials or protocol support.

## Separate online and local measurements

[MiyaIP Proxy Checker](https://miyaip.com/tools/proxy-checker) requests a fixed HTTPS target from the test service to inspect connectivity, protocol, and exit. [Proxy Speed Test](https://miyaip.com/tools/proxy-speed-test) performs repeated probes and downloads from the current MiyaIP test node.

Those measurements exclude your local Wi-Fi, carrier, and device-to-gateway route. Their fixed targets can also differ from your application's destination. The current Speed Test download phase uses about 8 MiB plus probe overhead and measures download rather than upload. Check the tool's current description for its probe details.

Verify the exit, compare timings, then repeat in the actual application. This guide provides no measured product benchmark. Choose acceptable duration and failure rate from your own workload's results.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.