a laptop and server names

Behind the Scenes: How PureVPN Connects You to the Most Optimal VPN Servers in a Jiffy

5 Mins Read

PUREVPNAt PureVPNBehind the Scenes: How PureVPN Connects You to the Most Optimal VPN Servers in a Jiffy

From the instance the PureVPN app is launched until you disconnect your VPN session, there are a lot of gears and cogs operating under the hood bringing you a smoother VPN experience.

The brilliant minds at PureVPN have squeezed all those complex functionalities into a single container that is visualized to the end user as the Connect button, allowing you to browse the Internet safely or binge-away your favorite TV shows with just one click. The complexity of the behind-the-scenes execution behind the Connect button, however, is something we’re proud of sharing. 

Are you curious to know how it all works?

Gladly. In this essay, we’ll share a bit about how PureVPN connects you to its most optimal VPN servers with just a click of your mouse or a tap of a finger.


Before moving on, we’ll need to share the following technical terms to ensure that the entire VPN connection process makes more sense to you.


API is the acronym for Application Programming Interface. It is an intermediary software that allows two different applications to communicate with each other. Think of it as a messenger. Suppose that you want to send a message to a recipient whom you can’t contact directly.

You would ask an intermediary, or a messenger in this case, to forward your message to that recipient and bring their response back to you.


Ping is a software utility that is used to check the presence of other host machines on an IP network, which could be a local network or the Internet. You may think of a ping like a sonar system that emits sounds to detect underwater objects.

In our case, Ping sends a signal (network packet) to detect available hosts on any network. The lower the ping value, the better its connection is (in terms of proximity, speed, and reliability).


JSON is the acronym for JavaScript Object Notation. JSON is an open-standard file format that stores data (values, parameters, etc.) in human-readable text form. The file is used by not only applications but also web servers.

Data Center (DC)

A Data Center (DC) is a dedicated space for keeping an extensive network of servers, which are ultimately used for data distribution or processing.

In PureVPN’s case, we have thousands of Data Centers spread across the globe. It should be noted that a country may have one or more Data Centers. For instance, PureVPN has multiple Data Centers in the US alone since we have VPN servers in 12 states.

Failover Grid

In computing terminology, failover means to switch to an alternate or backup server in the event an existing server couldn’t be connected.

The failover grid, on the other hand, is a network of redundant Domain Name Servers (DNS).

Tagged Protocols

Protocols are a set of rules that allow two or more machines to communicate with each other. The rules may include the type of data, how it is transmitted, or the commands that are used to transfer it.

At PureVPN, our developers use a proprietary testing tool that continuously checks all the protocols in real-time. The tool behaves like a user, connects to the app, and tests if it can connect to the protocols.

In case of no connectivity, we tag the protocol so that it is not offered to our users.

PureVPN Connection Process

Connecting to a VPN seems like a straightforward process:

  1.       You first launch the PureVPN app
  2.       You select the country and click Connect to establish the VPN connection

However, there is a complete set of different processes behind those apparently simple steps.

When the App is Launched:

The app downloads a JSON file to your local drive. Don’t worry. It doesn’t take more than a few bytes of space on your drive. The JSON file includes the most current list of countries, cities, Grid DNS (which is dialed when the API fails to communicate with our Database), as well as the list of our Data Centers’ host IDs.

Once the app has downloaded the JSON file, it sends a ping to all our Data Centers to check for their availability and saves the ping results.

When a User Clicks Connect:

As soon as you click Connect, the app compiles a set of values assigned against your desired preferences (parameters) such as Mode (security, or privacy), protocols (IKEv2, TCP, or UDP), country, city, and purpose (streaming, safe browsing, etc.)

Once all the values are compiled, the app communicates to the database via the API. Now, there are three different methods that the app uses to establish the VPN connection.

  1.       DC (Data Center) Method
  2.       LL (Latitude, Longitude) Method
  3.       FO (Failover) Method

The app may switch to the next method in the queue if the primary method fails.

#1 DC Method

In the DC method, the app searches for and shortlists a maximum of 3 DC servers while keeping into consideration your specified parameters (your desired preferences).

The app starts by detecting the top 3 DC hosts with the lowest ping. It extracts the ping status of the hosts from the ping results saved when the app was launched.

The desired preferences of the user as well as the data center information is then forwarded to our database where our algorithms further look into the data center hosts to shortlist servers that meet our specific set of criteria.

The app gets the 3 best servers for VPN connection. In case the app fails to establish connection with the 1st server, it switches to 2nd server and then to 3rd. Again, the primary purpose of having 3 attempts is to ensure that the connection is established in any way possible.

Sometimes, certain protocols are blocked by ISPs or firewalls. In such a case, the VPN connection would deem to fail. To overcome this problem, our app uses a set of multiple protocols to establish the VPN connection.

Local Failover Grid

In case the app fails to establish a VPN connection with any servers or the API fails to return any three servers, it establishes a connection with the Local Failover Grid. That is a list of redundant DC hosts that are extracted from the same JSON file, created at the launch of the app.

#2 LL Method

The Latitude and Longitude method immediately activates when the DC method fails to retrieve any three servers due to a connection failure or a non-responsive host.

As the name suggests, the method chooses the set of best servers based on the geolocation of your IP address, apart from the other parameters discussed above. The API compiles a list of all servers and sorts them on the basis of the Data Center.

The API then looks for cities where the data centers are located and shortlists hosts that are located near your region. This is calculated by comparing your IP’s geographical coordinates with our servers’ latitude and longitude coordinates.

Of course, we don’t store any of this information as we strictly comply with our Zero-log policy.

The API then takes into account the same criteria as the DC method to shortlist a maximum of three servers and return it to the app, so a successful VPN connection is made.

#3 FO Method

The failover method is triggered when the API fails to retrieve servers via the DC and LL methods. In the case of the local failover grid method, which is mentioned above, the app shortlists servers from the JSON file stored in your local drive.

However, in the FO method, the app skims through the grid list, which is saved in our database. Keep in mind that every grid is made up of multiple VPN servers, and we assign grids against every country or city on our network.

Once the grid is accessed, the app then looks for alternate servers through the round-robin process.

Our dev team has done a marvelous job in engineering algorithms that go through the entire process within microseconds. More importantly, the reason behind creating contingency methods is to make sure that you are always connected to our VPN—regardless of whatever type of network you’re on, whatever setup you have and protocol you may require, and wherever you are on the planet—once you click Connect.




June 20, 2023


1 year ago

PureVPN is a leading VPN service provider that excels in providing easy solutions for online privacy and security. With 6000+ servers in 65+ countries, It helps consumers and businesses in keeping their online identity secured.

Have Your Say!!

Join 3 million+ users to embrace internet freedom

Signup for PureVPN to get complete online security and privacy with a hidden IP address and encrypted internet traffic.