[Spice-devel] [master PATCH 1/2] server: netstat: modify network bandwidth calculation

Yaniv Kaul ykaul at redhat.com
Tue Oct 18 14:53:37 PDT 2011


On 18/10/2011 19:20, Uri Lublin wrote:
> Currently spice-server network bandwidth estimation is:
>    send an empty ping packet to the client (and ignore it) ("warmup")

Useless. 'warmup' of what exactly? The TCP MSS and everything else is 
already set by the TCP handshake and the RED initial connection packets.
>    send an empty ping packet and calculate time till pong is received ("latency")

And now this can be dropped as well, if it's now used, right?
Y.

>    send a ping packet with data (256KB) and calculate time till pong  ("roundtrip")
>    bandwidth = datasize / (roundtip - latency)
>
> Many times (e.g. fast LAN), "(roundtrip - latency)" is very small.
> This results with a falsely very high bandwidth.
>
> This patch makes the bandwidth calculation be
>    bandwidth = datasize / roundtrip
>
> Suggested by Marc-André Lureau<marcandre.lureau at redhat.com>
> ---
>   server/main_channel.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/server/main_channel.c b/server/main_channel.c
> index 43c0f3f..a4db724 100644
> --- a/server/main_channel.c
> +++ b/server/main_channel.c
> @@ -812,7 +812,7 @@ static int main_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint
>                       break;
>                   }
>                   mcc->bitrate_per_sec = (uint64_t)(NET_TEST_BYTES * 8) * 1000000
> -                                        / (roundtrip - mcc->latency);
> +                                        / roundtrip;
>                   red_printf("net test: latency %f ms, bitrate %lu bps (%f Mbps)%s",
>                              (double)mcc->latency / 1000,
>                              mcc->bitrate_per_sec,



More information about the Spice-devel mailing list