Buenas,
¿Sabéis como puedo medir la capacidad de transferencia del servidor? es decir, la velocidad de descarga y/o de subida?
He encontrado un script pero los resultados que me muestra no son del todo convincentes. Es el siguiente:
Código PHP:
Ver original<?php
// Initialize cURL with given url
$url = 'http://download.bethere.co.uk/images/61859740_3c0c5dbc30_o.jpg';
curl_setopt($ch, CURLOPT_USERAGENT
, 'Sitepoint Examples (thread 581410; http://www.sitepoint.com/forums/showthread.php?t=581410)');
// Time spent downloading, I think
$time = $info['total_time']
- $info['namelookup_time']
- $info['connect_time']
- $info['pretransfer_time']
- $info['starttransfer_time']
- $info['redirect_time'];
// Echo friendly messages
header('Content-Type: text/plain'); printf("Downloaded %d bytes in %0.2f seconds.\n", $info['size_download'], $time); printf("Which is %0.3f mbps\n", $info['size_download'] * 8 / $time / 1024 / 1024); printf("CURL said %0.3f mbps\n", $info['speed_download'] * 8 / 1024 / 1024);
foreach ($info as $label => $value)
{
printf("%-30s %s\n", $label, $value); }
Y subido este script al servidor me da el siguiente resultado.
Código:
Downloaded 6576848 bytes in 10.51 seconds.
Which is 4.774 mbps
CURL said 4.576 mbps
curl_getinfo() said:
---------------------------------------------------------------------------------------------
url http://download.bethere.co.uk/images/61859740_3c0c5dbc30_o.jpg
content_type image/jpeg
http_code 200
header_size 263
request_size 198
filetime -1
ssl_verify_result 0
redirect_count 0
total_time 10.965
namelookup_time 0.001
connect_time 0.002
pretransfer_time 0.002
size_upload 0
size_download 6576848
speed_download 599803
speed_upload 0
download_content_length 6576848
upload_content_length 0
starttransfer_time 0.45
redirect_time 0
Si un 1MB equivale a 8Mb
Downloaded 6576848 bytes in 10.51 seconds.
Which is 4.774 mbps
CURL said 4.576 mbps
Quiere decir que descargó la imagen a 4,774 / 8 = 0,596MB >> aprox. 596 KiloBytes es muy poco!!
Sabéis alguna otra de medirlo? el script falla? alguien lo puede probar y poner sus resultados?
Muchas gracias de antemano!