This blog was co-authored by Jason Poole, Principal Product Marketing Manager at Citrix.

Citrix Intelligent Traffic Management (ITM) continuously tests the performance of the internet with real user measurement (RUM) to create a digital user-experience map. This helps Citrix ITM to detect internet outages and service degradations immediately. Citrix Radar takes measurements from about 900 million users across 50,000 ISP networks, resulting in 15 billion data points every day, which enables our customers to ensure their content and applications are always available and their users receive the best experience.

What do we mean by real user measurements? How do we achieve this on such a scale? How does the browser of each user actually take these measurements?

The answers lie with “tags” and “objects”. This blog will cover the basics of how Citrix Radar works and show you how to set your site to be part of the community using Citrix ADC.

An Overview of Tags and Objects

Community members have placed objects (small .gif files) in the platforms monitored by Citrix ITM. Users retrieve these objects to measure the reachability, latency, and throughput to each platform.

Tags are small pieces of JavaScript that are embedded in web sites. When the page is downloaded, the code is run and tells the browser to retrieve various objects, take measurements about the performance, and send that telemetry to Citrix Radar. These bits of embedded code are instrumental to the whole process. But how does a tag get onto the web sites and how does know where to test?

How the Radar Process Works

The Radar measurement process is simple and follows four basic steps:

  1. When users visit community sites across the internet and download a web page, they receive a small JavaScript tag.
  2. When the page has finished loading, the tag “wakes up” and asks Citrix ITM what it would like it to test. ITM calculates the data it needs from the user’s region and responds with a number of platforms to test (public clouds, CDNs, private data centers, etc.). The tag initiates requests to each of the platforms, where it retrieves the small radar objects to determine reachability, latency, and, where appropriate, throughput.
  3. The data is sent to the Citrix ITM platform.
  4. The data is anonymised and collated in the real-time Radar database.

Citrix does considerable processing on the raw data before it gets used (see Radar Live), but this is, effectively, how Citrix ITM maintains a real-time understanding of the state of the internet.

Implementing Radar Tags

JavaScript tags are normally embedded in a web-page itself. Yes, you need to take care to ensure that it does not disrupt web operations and that updates carry the tag forward. But this is the simplest way to get up and running.

Sometimes the team responsible for site performance – the network team – is forbidden to modify the site content

The radar tag and objects can be served directly from a Citrix ADC with a few simple commands and some cutting and pasting (keep reading to see how). Once this is complete, you become a fully fledged member of the Radar community.

Radar tag injection

Radar tags can be injected from a Citrix ADC using a rewrite policy and action. This will add the JavaScript tag before the closing ‘body’ tag of the html pages served by the ADC. These steps can be done via the command line or GUI.  The mechanism for doing this is laid out below

Create a Rewrite action

add rewrite action radar_tag_action insert_after HTTP.RES.BODY(HTTP.RES.CONTENT_LENGTH).BEFORE_STR(“</body>”) ‘\”<script> if (typeof window.addEventListener === \\”function\\”) { window.addEventListener(\\”load\\”, function() { if (window.cedexis === undefined) { var radar = document.createElement(\\”script\\”); radar.src = \\”//radar.cedexis.com/1/<customer_id>/radar.js\\”; document.body.appendChild(radar); } }); } </script>\”‘

Please note that the <customer_id> in the above configuration should be replaced with your customer id. In the ITM portal, navigate to Radar –> Javascript Tag to retrieve the customer id.

Create a Rewrite policy

add rewrite policy radar_tag_policy HTTP.RES.HEADER(“Content-Type”).TO_LOWER.CONTAINS(“text/html”) radar_tag_action

Bind Rewrite policy to VPN Vserver, LB Vserver or CS Vserver

bind vpn vserver <name_of_vserver> -policy radar_tag_policy -type RESPONSE -priority 10

bind cs vserver <name_of_vserver> -policyName radar_tag_policy -type RESPONSE -priority 10

bind lb vserver <name_of_vserver> -policyName radar_tag_policy -type RESPONSE -priority 10

Radar object deployment

The Radar object can be deployed on the Citrix ADC using a responder policy and action. Responder action and policy serves a 43-byte single pixel image whenever a URL with the extension ‘r20.gif’ is requested by the end-user’s browser

Please note that prior to configuring the responder policy and action, these steps need to be performed on the Citrix ADC.

Run the below command, if ADC has a Single Packet Engine:

nsapimgr -ys arg1=1 -ys call=ns_pi_set_char_is_byte

Run the below command, if ADC has Multi-Packet Engines:

nsapimgr_wr.sh -ys arg1=1 -ys call=ns_pi_set_char_is_byte

To ensure that the configuration will persist through a reboot and is applied in the right order, run the commands below

For a single Packet Engine,

echo “nsapimgr -ys arg1=1 -ys call=ns_pi_set_char_is_byte” >> /nsconfig/nsbefore.sh

For Multi Packet Engines,

echo ” nsapimgr_wr.sh -ys arg1=1 -ys call=ns_pi_set_char_is_byte” >> /nsconfig/nsbefore.sh

Create a Responder action

add responder action itm-radar-test-object-action respondwith q{“HTTP/1.1 200 OK\r\n” +”Date : ” + SYS.TIME + “\r\n” + “Cache-Control: no-cache\r\n” + “Pragma: no-cache\r\n” + “Expires: 0\r\n” + “Timing-Allow-Origin: *\r\n” + “Content-Type: image/gif\r\n” + “Content-Length: 43” + “\r\n\r\n” +  “\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00\x21\xf9\x04\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b”} -comment “itm radar test image object”

Create a Responder policy

add responder policy itm-radar-test-object-policy “HTTP.REQ.URL.PATH.GET_REVERSE(0).EQ(\”r20.gif\”)” itm-radar-test-object-action -comment “itm radar test image object”

Bind Responder policy Globally

bind responder global itm-radar-test-object-policy 100