Liking cljdoc? Tell your friends :D

hive-compose.promote.resources

Pure: resource caps of a stack's instances, their budget and admission (hc-16a). See the Resource caps section of hive-compose.schema.

Caps of one consumer's view of an instance, per key, high to low: the stack's :stack/resources for the capability, the consumer's Need :resources, the Provide's :resources, :compose/default-resources. Levels are merged low to high; an :unbounded level clears every cap below it (a higher level may set caps again).

A shared instance serves several consumers, so it gets what each would have had alone, combined per key by the largest: :mem and :cpus are the maximum over the views that set them (a view with no cap has no opinion), :jvm? is true when one says so, and the instance is unbounded when one view is explicitly :unbounded. Hence a shared instance never sums above the private copies it replaces (budget is monotone under sharing).

Admission (admit) refuses with :compose/over-budget (data: schema/OverBudget) when the capped total exceeds :stack/budget, :compose/budget, or, for what is not yet running, the host's MemAvailable minus :compose/host-reserve. MemAvailable comes from the caller (port/IHostMemory), never read here.

Pure: resource caps of a stack's instances, their budget and admission
(hc-16a). See the Resource caps section of `hive-compose.schema`.

Caps of one consumer's view of an instance, per key, high to low: the
stack's `:stack/resources` for the capability, the consumer's Need
`:resources`, the Provide's `:resources`, `:compose/default-resources`.
Levels are merged low to high; an `:unbounded` level clears every cap
below it (a higher level may set caps again).

A shared instance serves several consumers, so it gets what each would
have had alone, combined per key by the largest: `:mem` and `:cpus` are
the maximum over the views that set them (a view with no cap has no
opinion), `:jvm?` is true when one says so, and the instance is unbounded
when one view is explicitly :unbounded. Hence a shared instance never
sums above the private copies it replaces (`budget` is monotone under
sharing).

Admission (`admit`) refuses with :compose/over-budget (data:
schema/OverBudget) when the capped total exceeds `:stack/budget`,
`:compose/budget`, or, for what is not yet running, the host's
MemAvailable minus `:compose/host-reserve`. MemAvailable comes from the
caller (port/IHostMemory), never read here.
raw docstring

admitclj

(admit b lims)
(admit b lims running)
(admit b lims running others-mem)

Result<Budget>: b (from budget) when its capped total fits every one of lims (from limits), else :compose/over-budget with schema/OverBudget data for the first limit it exceeds, in the order :stack, :budget, :host. :stack compares this stack's total; :budget is host-wide: others-mem (the capped memory of every other live run's instances this stack does not share, each counted once) plus this total. The host limit is compared with the memory of the instances not in running (ids already up take no new memory).

Result<Budget>: `b` (from `budget`) when its capped total fits every one
of `lims` (from `limits`), else :compose/over-budget with
schema/OverBudget data for the first limit it exceeds, in the order
:stack, :budget, :host. :stack compares this stack's total; :budget is
host-wide: `others-mem` (the capped memory of every other live run's
instances this stack does not share, each counted once) plus this total.
The host limit is compared with the memory of the instances not in
`running` (ids already up take no new memory).
sourceraw docstring

budgetclj

(budget settings stack needs resolution)

Budget (schema/Budget) of resolution for stack (or nil): the caps of each instance, the capped total (shared instances once), the total one private copy per consumer would have summed, what sharing saved, and the instances left out of the sum (unbounded or without a mem cap).

Budget (schema/Budget) of `resolution` for `stack` (or nil): the caps of
each instance, the capped total (shared instances once), the total one
private copy per consumer would have summed, what sharing saved, and the
instances left out of the sum (unbounded or without a mem cap).
sourceraw docstring

caps-lineclj

(caps-line id caps)

One line of compose plan for instance id with caps.

One line of `compose plan` for instance `id` with `caps`.
sourceraw docstring

combineclj

(combine views)

The caps of an instance shared by consumers whose own views are views (non-empty): the largest cap per key over the views that set one (a view without a cap has no opinion); one explicitly unbounded view unbounds it (see the ns doc). :jvm? is true when one view says true, false when every view says false, else absent (detected from the image).

The caps of an instance shared by consumers whose own views are `views`
(non-empty): the largest cap per key over the views that set one (a view
without a cap has no opinion); one explicitly unbounded view unbounds it
(see the ns doc). `:jvm?` is true when one view says true, false
when every view says false, else absent (detected from the image).
sourceraw docstring

consumer-capsclj

(consumer-caps settings stack needs consumer provider cap)

InstanceCaps consumer consumer alone would give the instance of cap from provider. needs is {consumer Needs} (as resolved), stack the Stack or nil.

InstanceCaps consumer `consumer` alone would give the instance of `cap`
from `provider`. `needs` is {consumer Needs} (as resolved), `stack` the
Stack or nil.
sourceraw docstring

freed-memclj

(freed-mem runs rid)

{:bytes n :unknown? bool}: what taking run rid of runs ({run {:plan StackPlan :budget Budget}}) down frees: the capped memory (closure included) of its instances no other run binds; a shared instance another run holds stays up. :unknown? when one of the released instances has no mem cap (or the run recorded no budget), so it may free memory nobody counted.

{:bytes n :unknown? bool}: what taking run `rid` of `runs` ({run {:plan
StackPlan :budget Budget}}) down frees: the capped memory (closure
included) of its instances no other run binds; a shared instance another
run holds stays up. :unknown? when one of the released instances has no
mem cap (or the run recorded no budget), so it may free memory nobody
counted.
sourceraw docstring

human-memclj

(human-mem bytes)

bytes as a short binary size: 1073741824 => "1g", 1610612736 => "1.5g".

`bytes` as a short binary size: 1073741824 => "1g", 1610612736 => "1.5g".
sourceraw docstring

inst-memclj

(inst-mem c)

Bytes InstanceCaps c takes: its own mem cap plus its closure services' (:closure {service bytes}, private instances, see with-closure).

Bytes InstanceCaps `c` takes: its own mem cap plus its closure services'
(`:closure` {service bytes}, private instances, see `with-closure`).
sourceraw docstring

instance-capsclj

(instance-caps settings stack needs inst)

InstanceCaps of Instance inst: combine over its consumers' views.

InstanceCaps of Instance `inst`: `combine` over its consumers' views.
sourceraw docstring

java-image?clj

(java-image? image)

True when image names a JVM image (openjdk, eclipse-temurin, corretto, clojure, maven, gradle, semeru, zulu, graalvm, liberica, or a jdk/jre tag).

True when `image` names a JVM image (openjdk, eclipse-temurin, corretto,
clojure, maven, gradle, semeru, zulu, graalvm, liberica, or a jdk/jre tag).
sourceraw docstring

java-tool-optionsclj

source

jvm-flagclj

source

jvm?clj

(jvm? caps image)

Whether the JVM flag goes into a service with caps running image: an explicit :jvm? decides; else the image is detected.

Whether the JVM flag goes into a service with `caps` running `image`: an
explicit `:jvm?` decides; else the image is detected.
sourceraw docstring

limitsclj

(limits settings stack available)

The memory limits a plan is admitted against, in bytes: :stack from :stack/budget, :budget from :compose/budget, and :host the host's available (MemAvailable, nil when unknown) minus :compose/host-reserve (0 when unset), floored at 0. Absent limits are left out.

The memory limits a plan is admitted against, in bytes: `:stack` from
`:stack/budget`, `:budget` from `:compose/budget`, and `:host` the host's
`available` (MemAvailable, nil when unknown) minus `:compose/host-reserve`
(0 when unset), floored at 0. Absent limits are left out.
sourceraw docstring

merge-jvm-optionsclj

(merge-jvm-options defaults own)

JAVA_TOOL_OPTIONS of defaults (flag strings) merged under own (the service's own value, nil when unset): per flag, own wins, its order kept, defaults it does not set appended first.

JAVA_TOOL_OPTIONS of `defaults` (flag strings) merged under `own` (the
service's own value, nil when unset): per flag, `own` wins, its order
kept, defaults it does not set appended first.
sourceraw docstring

parse-memclj

(parse-mem v)

Bytes of MemSize v (an int of bytes, or "512m", "2g", "64kb" ..), nil when v is nil or no MemSize.

Bytes of MemSize `v` (an int of bytes, or "512m", "2g", "64kb" ..),
nil when `v` is nil or no MemSize.
sourceraw docstring

parse-meminfoclj

(parse-meminfo text)

MemAvailable in bytes from /proc/meminfo text (MemAvailable: 123 kB), nil when absent.

MemAvailable in bytes from /proc/meminfo text (`MemAvailable: 123 kB`),
nil when absent.
sourceraw docstring

parse-xmxclj

(parse-xmx opts)

Bytes of the last -Xmx in JVM options opts, nil when none.

Bytes of the last -Xmx in JVM options `opts`, nil when none.
sourceraw docstring

pressure-victimclj

(pressure-victim settings runs now {:keys [claim-ttl-ms idle-ms]})

The run the pressure guard stops, nil when none qualifies. A candidate of runs ({run {:stack/id :claims {agent {:seen ms}} :last-touch ms :idle-action .. :plan :budget}}) is IDLE: no claim seen within claim-ttl-ms of now, untouched for at least idle-ms, and not :idle-action :none; and taking it down frees memory (freed-mem: some bytes, or an uncapped release). Among them the one whose stack has the lowest :stack/priority (default 0), then the longest idle, then the smallest run id.

The run the pressure guard stops, nil when none qualifies. A candidate of
`runs` ({run {:stack/id :claims {agent {:seen ms}} :last-touch ms
:idle-action .. :plan :budget}}) is IDLE: no claim seen within
`claim-ttl-ms` of `now`, untouched for at least `idle-ms`, and not
`:idle-action :none`; and taking it down frees memory (`freed-mem`: some
bytes, or an uncapped release). Among them the one whose stack has the
lowest `:stack/priority` (default 0), then the longest idle, then the
smallest run id.
sourceraw docstring

service-overrideclj

(service-override caps jvm? own-opts)

The compose override entries of one capped service: "mem_limit" (bytes) and "cpus" from caps, and, when jvm? AND a mem_limit is written, "environment" {JAVA_TOOL_OPTIONS ..} merged with the service's own value own-opts. Without a mem_limit the JVM keeps its default heap (25% of the host): 75% of an uncapped host would be worse. {} when nothing applies.

The compose override entries of one capped service: "mem_limit" (bytes)
and "cpus" from `caps`, and, when `jvm?` AND a mem_limit is written,
"environment" {JAVA_TOOL_OPTIONS ..} merged with the service's own value
`own-opts`. Without a mem_limit the JVM keeps its default heap (25% of
the host): 75% of an uncapped host would be worse. {} when nothing applies.
sourceraw docstring

summaryclj

(summary b)

The budget block of compose plan: one line per instance, then the total with what sharing saved, then the uncapped instances.

The budget block of `compose plan`: one line per instance, then the total
with what sharing saved, then the uncapped instances.
sourceraw docstring

under-pressure?clj

(under-pressure? settings available)

True when the host's available bytes (nil: unknown, never pressure) is below :compose/host-reserve (unset: no guard).

True when the host's `available` bytes (nil: unknown, never pressure) is
below `:compose/host-reserve` (unset: no guard).
sourceraw docstring

with-closureclj

(with-closure b settings sp facts)

Budget b with the depends_on closure of every PRIVATE instance of StackPlan sp (:instance/needs beyond :instance/services) counted: each closure service at its own compose mem_limit (facts {instance-id {service {:mem-limit ..}}}) or, when it has none, at :compose/default-resources :mem; a service with neither stays uncounted. They land under the instance's :closure and in the totals. An unbounded instance gets none. A shared instance's closure runs from its provider's own files and is left out.

Budget `b` with the depends_on closure of every PRIVATE instance of
StackPlan `sp` (`:instance/needs` beyond `:instance/services`) counted:
each closure service at its own compose mem_limit (`facts` {instance-id
{service {:mem-limit ..}}}) or, when it has none, at
:compose/default-resources :mem; a service with neither stays uncounted.
They land under the instance's `:closure` and in the totals. An unbounded
instance gets none. A shared instance's closure runs from its provider's
own files and is left out.
sourceraw docstring

xmx-warningsclj

(xmx-warnings b facts)

Lines warning of a service whose own -Xmx exceeds the mem_limit it gets: b a Budget, facts {instance-id {service {:java-tool-options}}}.

Lines warning of a service whose own -Xmx exceeds the mem_limit it gets:
`b` a Budget, `facts` {instance-id {service {:java-tool-options}}}.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close