Traffic

What crossed the wire on behalf of one remote array or one Proxy, counted at the transport: every range read and every chunk, cumulative from the moment the source was built. Bytes are the half of the block-granularity trade that timing does not show – a slice that reads one block of a chunk and one that reads the whole chunk take about the same time on a fast link and differ by the compression ratio in traffic – so C2Array and Proxy each carry one under traffic. Take two readings and subtract, or Traffic.reset() between them.

class blosc2.Traffic[source]

What crossed the wire, counted where it crossed.

Bytes, not wall time, are what a shared uplink runs out of, and they are the half of the block-granularity trade that nothing else reports: a slice that reads one block of a chunk and one that reads the whole chunk take about the same time on a fast link and differ by the compression ratio in traffic. Whoever pays for the link is the one who needs to see that, so it is counted rather than inferred – and counted at the transport, so the frame index and the block offsets, which no caller ever asks for by name, are in it too.

What crosses the wire to carry data, which is every range read and every chunk: the one metadata call that opens a handle (api/info, a few hundred bytes, once) is not in it, being neither what a slice costs nor anything the block path can change.

Cumulative from the moment a source is built. Take two readings and subtract, or reset() between them.

Attributes:
nbytes
requests

Methods

reset()

Start counting again from zero.

requests: int

How many requests have carried data, cumulative.

One per range read and one per chunk, including the frame’s header, its index and the block offsets – everything the transport went out for.

nbytes: int

How many bytes those requests carried, cumulative.

Compressed bytes, as they crossed the wire, not what they decompress to.

reset() None[source]

Start counting again from zero.

nbytes: int

How many bytes those requests carried, cumulative.

Compressed bytes, as they crossed the wire, not what they decompress to.

requests: int

How many requests have carried data, cumulative.

One per range read and one per chunk, including the frame’s header, its index and the block offsets – everything the transport went out for.

charge is left out of the members above: reading a counter is what a caller does with one. It is not private, though – a transport of your own calls it from read_range() so that its reads are counted; see ByteRangeNDSource and the Your own transport section of the remote-arrays guide.

examples/c2array-traffic.py is a runnable walkthrough – what a corner slice of a remote array costs against the chunk holding it, and what the cache saves on the second read.