One of the most important but often overlooked criteria when choosing a hosting provider is the performance of its network. Poor network performance for any kind of online service leads to low customer satisfaction. What is the best way to measure network performance that most accurately simulates a customers experience with a network? We found this question to be an interesting idea to explore during a Leaseweb hackathon!
RIPE Atlas is the RIPE NCC’s main Internet data collection system. It’s a global network of devices, called probes and anchors, that actively measure Internet connectivity. Anyone can access this data via Internet traffic maps, streaming data visualizations, and an API. RIPE Atlas users can also perform customized measurements to gain valuable data about their own networks.
Due to the size and reach of the Atlas project, it’s one of the most important internet measurement initiatives internationally. What’s great is that the project is run by RIPE, but driven by the global community of RIPE members (and non-members!) who contribute some of their resources to help the project. This improves visibility into the inner-workings of the global Internet. It’s used by Internet professionals all over the world to improve quality of their network, debug issues, and learn. Leaseweb contributes to the RIPE Atlas by hosting 7 ‘anchors’ in various data centers all over the globe.
Since Leaseweb already contributes to RIPE Atlas with these anchors, it’s an obvious choice as a source of random probes to be used against those anchors and compared with other infrastructure providers’ anchors. (By the way, if you would like to do your own measurements and contribute to the RIPE Atlas project at the same time, you can request a probe for your home or office right here!). You can read more on the structure of the Atlas network (and how probes, anchors and the RIPE backend work together) in various posts on the RIPE labs pages.
The main elements needed to use RIPE Atlas are measurements, sources and targets. These elements all have their own function to facilitate experiments.
Getting The Data
Triggering one-off measurements and fetching the results of those measurements can be done using the RIPE Atlas API. RIPE-NCC also developed a wrapper around the RIPE Atlas API to allow anyone to communicate with the RIPE Atlas API using Python. It is maintained by RIPE Atlas developers and is therefore the best choice for consuming their API. Using it requires an API key. Wrapper is open-source and available on GitHub.
Installation is very simple using pip:
$ pip install ripe.atlas.cousteau
Included classes in the Python script:
from ripe.atlas.cousteau import ( Ping, Traceroute, AtlasSource, AtlasCreateRequest, AtlasLatestRequest )
RIPE Atlas offers several measurement types – Ping, Traceroute, DNS, HTTP, SSL, NTP, and WiFi. Creating a measurement allows you to specify a type of test (or ‘experiment’) to perform. Typically, these have something to do with latency for a service, but there are also options to check things like resolving a domain name and checking DNS propagation. These measurements can be one-off or recurring. For our Hackathon project we used one-off measurements.
Probes defined as sources are used to trigger the measurement. They can be defined explicitly or taken from a pool (area, country, prefix or AS number). Below, the defined source takes 50 random probes from Europe to be used as a source of measurement.
source = AtlasSource( type="area", value= "North-Central", requested=50 )
Targeted IPs that the measurements are run against. In this example, ping is run against one of Leaseweb’s anchors.
pingLSW = Ping( af=4, target="188.8.131.52", description="Ping nl-haa-as60781.anchors.atlas.ripe.net" )
Defining a request combines all of the elements together: measurements and sources. It also requires a start time, API key and – in this case – a one-off flag.
atlas_request = AtlasCreateRequest( start_time=datetime.utcnow(), key=ATLAS_API_KEY, measurements=[pingLSW, pingOVH, pingAzure, pingAWS, pingUni], sources=, is_oneoff=True )
To summarize what this request will do:
- We specify a number of ping tests to various endpoints
- We specify where we want to have those request come from and how many we want
- …and we bundle those tests into a single one-off request.
Calling RIPE Atlas API now is simple
response = atlas_request.create()
After calling this function, Atlas will launch tests towards 50 random probes in the area we designated, and will store the results.
Returned values, stored in response, are measurement counts. In this case, there are 5 values as there are 5 measurements defined. The actual results have to be retrieved separately, so the next step is fetching the measurement data. Here, class AtlasLatestRequest is used:
results = AtlasLatestRequest(msm_id=measurement_id).create()
The results variable now has stored all of the measurement details needed to calculate and compare latencies. It’s clear to see how powerful Atlas is. In a few simple lines we’ve generated latency information from 50 end points to multiple targets!
Visualizing data that was fetched from RIPE Atlas API was done with pygal Python library that supports various chart types and styles. For this Hackathon project pygal.Bar() was used to draw out the comparison results. (Pygal usage is out of the scope of this blog post). Two charts below show the data from measurements taken from Europe and from Russia.
Conclusion and Going Forward
This Hackathon project showed the basic features of RIPE Atlas and what it can accomplish. RIPE Atlas also maintains a parsing library name Sagan, available in GitHub, that handles format changes in measurement results and always returns a native Python object.
RIPE Atlas has a huge amount of functionality and can be easily used in your own experiments and measurements. Remember to always use the Atlas infrastructure responsibly.
Other tools for using permanent measurements, streaming data, and building dashboards are RIPE Prometheus exporter, working as a metric exporter of RIPE Atlas measurement results that exports collected metrics to Prometheus. Grafana is a common tool that works well with Prometheus to create dashboards with useful metrics, gathered from RIPE Atlas measurements.
Comments? Questions? Other ways to use RIPE Atlas and receive measurements? I’d love to hear your feedback!