[peerdist] Add "peerstat" command for reporting peer statistics

Each PeerDist-encoded downloaded file typically results in several
thousand individual block downloads, each of which may end up being
attempted as a classic retrieval from a discovered peer, a retrieval
from an optimistically assumed peer, a retrieval from a hosted cache
server, a read from a local filesystem cache, and/or a raw range
request from the origin server.

The sheer volume of activity and the number of errors expected in
normal operation (e.g. for blocks missing from a particular peer) make
it difficult to use debug messages to gain insights into behaviour,
since per-event debug messages are either too rare to be informative
or so frequent that the overhead of printing the messages alters the
overall behaviour.

Gather error statistics separately for each category of individual
block download and for each discovery address family, along with the
most useful summary counts (e.g. for total blocks, total number of
discovery attempts, etc).

Estimate the total number of peers as being the highest number of
peers ever discovered for a segment within a single address family.
(We count per address family to avoid double-counting a single peer
that advertises itself using both IPv4 and IPv6 addresses.)

Report the number of discovery attempts independent of address family
(i.e. one discovery attempt means N transmitted packets, one sent via
each of the N supported address families), since that number is then
meaningfully comparable against the total number of blocks.

Report second and subsequent discovery attempts separately from
initial discovery attempts, so that the number of discovery attempts
can be compared against the number of blocks to determine how many
discoveries were elided completely.

Separate the discovery reply statistics by address family, not because
there is anything useful in knowing whether a particular error
happened for IPv4 versus IPv6, but because it avoids the need to
reason about whether or not a displayed result needs to be mentally
halved in order to be compared against the corresponding discovery
attempt statistic.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
12 files changed
tree: 96ca516b9df41143d152951b51eb12d6f2fe488d
  1. .claude/
  2. .github/
  3. contrib/
  4. src/
  5. AGENTS.md
  6. CHANGELOG.md
  7. CLAUDE.md
  8. CONTRIBUTING.md
  9. COPYING
  10. COPYING.GPLv2
  11. COPYING.UBDL
  12. README.md
  13. RELEASE.md
  14. RELNOTES.tmpl.md
  15. SECURITY.md
README.md

iPXE network bootloader

Build Coverity Release

iPXE is the leading open source network boot firmware. It provides a full PXE implementation enhanced with additional features such as:

  • boot from a web server via HTTP or HTTPS,

  • boot from an iSCSI, FCoE, or AoE SAN,

  • control the boot process with a script,

  • create interactive forms and menus.

You can use iPXE to replace the existing PXE ROM on your network card, or you can chainload into iPXE to obtain the features of iPXE without the hassle of reflashing.

iPXE is free, open-source software licensed under the GNU GPL (with some portions under GPL-compatible licences).

You can download the rolling release binaries (built from the latest commit), or use the most recent stable release.

For full documentation, visit the iPXE website.