mogabr / ndt

Automatically exported from code.google.com/p/ndt
Other
0 stars 0 forks source link

Non-random Test Data risks compression #161

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Reading the source, I noticed that the data that NDT sends in S2C and C2s tests 
is nonrandom.

From the Flash client:
      // Prepare the data to send to the server.
      for (var i:int = 0; i < NDTConstants.PREDEFINED_BUFFER_SIZE; i++) {
        _dataToSend.writeByte(i);
      }
https://code.google.com/p/ndt/source/browse/trunk/flash-client/src/TestC2S.as#16
8

From the C client:
    // ....Fill buffer upto NDTConstants.PREDEFNED_BUFFER_SIZE packets
    pkts = 0;
    k = 0;
    for (i = 0; i < (64*KILO_BITS); i++) {  // again buffer sizes differ.
      // Since the actual transmitted byte count is timed, it doesn't appear
      // that it is causing specific problems.
      while (!isprint(k & 0x7f))
        k++;
      buff[i] = (k++ % 0x7f);
    }
https://code.google.com/p/ndt/source/browse/trunk/src/test_c2s_clt.c#141

Because we're sending buffers of sequential bytes (and in the case of the C 
client, only printable ASCII characters), there is a risk that boxes on the 
network will compress the data and skew measurements.

We should modify the code for data generation so that we use a pseudorandom 
number generator with a periodicity of at least 64k, then take the last byte of 
each generated number as the next byte to place in the send buffer.

Original issue reported on code.google.com by mtly...@google.com on 6 Oct 2014 at 9:06