/rtt

Primary LanguagePHP

RTT

This little project is useful if you want to measure TCP RTT between a web client and
two or more sites.

On the remote sites you need nginx (tested with version >=1.2.0) which has the ability
to extract RTT information if the underlying OS supports it (for instance Linux 2.6 has
this information in the TCP_INFO struct).

BASIC IDEA

The basic idea is configure the remote nginx like this:

location /rtt {
  rewrite ^/rtt/(.*)$ http://central.site.com/rtt/singleMeasure.php?site=SITE_NAME&rtt=$tcpinfo_rtt;
}
        
When a client requests http://probe.site1.com/rtt/ it gets redirected back with SITE_NAME and RTT
information in the GET request.

If you have two remote sites you will configure them taking into account the location "/rtt" defined above,
for instance


'sites' => array (
	'mi' => array(
		'probeurl' => 'http://probe.site1.com/rtt/',
		),
	'rm' => array (
		'probeurl' => 'http://probe.site2.com/rtt/'),
		),
	),
				
Measure can be collected on the central site by using an invisible iframe

<iframe src="http://central.site/rtt/doMeasure.php?" style="display:none"></iframe>

If you want there is also a fancier page: doMeasureJs.php - which as some special effects
and can also display the measure.

INSTALLATION

Choose where you want to install rtt, then do

cd /path
git clone git://github.com/enricocavalli/rtt.git

This will clone rtt to /path/rtt/

I suggest to put /path/rtt/ outside the document root of your web site, and use an alias to refer to it.
In apache this can be as simple as

 Alias /rtt/ "/path/rtt/www/"
 
 
CREDITS

Thanks to the guys who developed simpleSAMLphp. Since I'm familiar with that project, I copied
the autoloader and some utilities from their project.

LICENSE

The code from simpleSAMLphp is licensed GNU Lesser GPL - see http://www.gnu.org/licenses/lgpl.html
Other code is licensed under the GPL - http://www.gnu.org/licenses/gpl-3.0.html