v0.0.0-...-989cebf Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: GPL-3.0 Imports: 7 Imported by: 0


latency experiments

have a look at a brief latency study I did while trying to answer good heuristics to distribute gateways according to a more realistic model of the internet.

TL;DR: great circle calculations are useless for the typical size and gateway pools of the providers we're interested in.

The topic complicates further if we want to introduce any notion of fairness allocation that takes the digital divide into account. I suspect this is what it was behind the "hemisphere" tagging in the legacy bonafide, something that has never been used in prractice.

lessons learned

  • empirical measurement of latency goes a long way (i.e., ping the less congested gateway on each region, use that).
  • consider developing a "preferential attachment" model. E.g., mark resources with a broad region tag, and make the probability of them being assigned to a client claiming to be outside of the region (i.e., assume a well-behaved client) as inversely proportional to the complement of the fractional load.



latency offers a way to lookup distance according to an empirical model of latency. This module should be considered experimental, since the dataset it is derived from is quite anecdotical. However, it might be the case it throws better a better distance metric than the naive spherical distance calculation. We're embedding data made public by wonderproxy, from a few hours of crossed pings between their servers:



This section is empty.


This section is empty.


This section is empty.


type Metric

type Metric struct {
	// contains filtered or unexported fields

func NewMetric

func NewMetric() (*Metric, error)

func (*Metric) Distance

func (m *Metric) Distance(from, to string) float64

Distance returns the average latency (measured in ms) between to given country codes.

func (*Metric) Keys

func (m *Metric) Keys() []string

Keys return all the known keys in this matrix (list of ISO-2 country codes)

func (*Metric) Len

func (m *Metric) Len() int

Len returns the number of keys known to this object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL