The built-in selector, which splits units between arms by weight.
A selector is a function of one map and returns an arm keyword (or a promise of one):
{:experiment "asset-host"
:config {:revision 3 :weights {:cdn 20} :sticky :hashed}
:sticky-key "user:8f3a" ; may be nil
:supported-arms #{:default :cdn}
:context {...}} ; the decide request's context
Units fall into a space of 10,000 buckets. Each candidate arm, ordered by
name, owns a fixed slice of 10,000/n buckets and draws the first
weight*100 of them. Changing one arm's weight only moves units between that
arm and :default. Adding or removing a candidate changes every slice, so do that
with a new revision.
The built-in selector, which splits units between arms by weight.
A selector is a function of one map and returns an arm keyword (or a
promise of one):
{:experiment "asset-host"
:config {:revision 3 :weights {:cdn 20} :sticky :hashed}
:sticky-key "user:8f3a" ; may be nil
:supported-arms #{:default :cdn}
:context {...}} ; the decide request's context
Units fall into a space of 10,000 buckets. Each candidate arm, ordered by
name, owns a fixed slice of 10,000/n buckets and draws the first
weight*100 of them. Changing one arm's weight only moves units between that
arm and `:default`. Adding or removing a candidate changes every slice, so do that
with a new revision.(arm-for-bucket weights bucket)The arm whose drawn buckets contain bucket, else :default.
The arm whose drawn buckets contain `bucket`, else `:default`.
(bucket {:keys [experiment config sticky-key]})The bucket a request falls into: hashed when the experiment is hashed and
the request has a sticky key, otherwise random.
The bucket a request falls into: hashed when the experiment is `hashed` and the request has a sticky key, otherwise random.
(hash-bucket experiment revision sticky-key)The bucket for a sticky key in hashed mode.
The bucket for a sticky key in `hashed` mode.
(random-bucket)A uniformly random bucket, for none mode.
A uniformly random bucket, for `none` mode.
(slices weights)Each candidate's slice of the bucket space as [arm start end], where
[start end) are the buckets the arm draws. Candidates are ordered by name;
a weight is clamped to its slice width.
Each candidate's slice of the bucket space as `[arm start end]`, where `[start end)` are the buckets the arm draws. Candidates are ordered by name; a weight is clamped to its slice width.
(weighted-hash {:keys [config supported-arms] :as request})The built-in selector. If a unit's bucket belongs to an arm the client
doesn't support, the unit gets :default. It isn't moved to another
candidate, because that candidate would then get more than its weight.
The built-in selector. If a unit's bucket belongs to an arm the client doesn't support, the unit gets `:default`. It isn't moved to another candidate, because that candidate would then get more than its weight.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |