Documentation
¶
Overview ¶
Package flyaffinity routes relay connections so every connection for a given session lands on the same Fly machine (session-affinity sharding). Each machine's parley relay stays in-memory authoritative for its shard.
Ownership is by rendezvous (highest-random-weight) hashing over the live machine set, discovered from Fly internal DNS. HRW moves only ~1/N sessions when the machine set changes (vs ~all for modulo), and needs no coordination: every machine computes the identical owner from the same peer set with a fixed, seedless hash. The Route method plugs into parley's relay.Options.Router.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver answers ownership questions for one machine. Construct with New.
func New ¶
New builds a Resolver. app is FLY_APP_NAME, self is FLY_MACHINE_ID (empty when not running on Fly), ttl bounds how long a peer set is cached.