Skip to main content

Measuring Performance

The SDK provides methods to perform a TCP Ping and extended Speedtest to measure the performance of locations.

Pinging Locations

A TCP Ping will measure the time of establishing a TCP connection to an endpoint. We are not using regular ICMP pings as these type of pings are many times blocked in several networks.

warning

A TCP Ping only makes sense, if the user is currently not connected to the VPN, so that the ping result reflects the time it takes to send a TCP Ping packet from the user's location to the VPN server location. The SDK will prevent, that the ping method will be executed, if the user is currently connected to the VPN.

![](../../../.gitbook/assets/image (1).png)

ping_locations

This method will perform a single ping per instance per location and will then calculate the average ping for that location,

Parameters

NameTypeDescription
subscription_idStringID of the subscription which has a VPN entitlement. You can obtain that subscription id as described in Obtaining a VPN Subscription ID
callbackInstanceDiscoveryCallbackThis callback interface needs to be implemented by the app, to receive updates while the test is being conducted

Returns

Returns an array of LocationRatingResult where only the ping_rating is populated.

Speed Test

The speed test is an extended form of what the Smart Location algorithm is doing. It first pings all locations to determine the best endpoint which in the next step should be used to perform an HTTP up- and download test. Compared to the Smart Location algorithmn, it takes much more time, as the number of pings and the time to perform the up- and download is 10 seconds each. The reason for using a fixed time is, to have stable results independent of the capacity of the connection.

danger

We suggest, to warn the user when being in a cellular network, that an extended amount of data will be up- and downloaded!

execute_speedtest

This will start a speedtest and will return, once the results have been fetched.

Parameters

NameTypeDescription
subscription_idStringID of the subscription which has a VPN entitlement. You can obtain that subscription id as described in Obtaining a VPN Subscription ID
endpoint_selection_modeSpeedTestEndpointSelectionMode
pub enum SpeedTestEndpointSelectionMode {
/// This will pick an endpoint close to your current location (real or vpn location)
Automatic,
/// This will pick an endpoint close to a specific location
Manual { location_id: String },
}
callbackInstanceDiscoveryCallbackThis callback interface needs to be implemented by the app, to receive updates while the test is being conducted.

Returns

Returns an array of LocationRatingResult where only the ping_rating is populated.

Callback Notification Flow

While executing the speed test, you will encounter various callback types:

  1. Initially, you will receive several progress types labeled ping as the speed test identifies the optimal server. This process may take a few seconds.
  2. Once the final server instance for the speed test is selected, you will receive a progress type of SpeedTestInstanceSelected. This notification will also provide details on Jitter, Latency, and Packet Loss as part of the results.
  3. Subsequently, you will receive multiple progress types labeled SpeedTestDownload/SpeedTestUpload, which will inform you of the current down- or upload speed and progress.