The size section
The size section describes how much of primary resources a component instance must receive. Its definition is this:
#ComponentSize: {
bandwidth: #ResourceAmount & {kind: "bandwidth"}
minbandwidth: *bandwidth.size | (number & >= 0 & <= bandwidth.size)
mincpu: #ResourceAmount & {kind: "cpu"} // Should be at least the sum of the mincpu's of the containers
}
Note that fields in the size
section can be made to depend on configuration parameters from
the config
section, making use of CUE reference facilities. As an example, assume
a configuration parameter mentions a large
boolean parameter. This could be used as
follows:
if config.parameter.large {
size: {
mincpu: {size: 1000, unit: "m"}
}
}
Container sizes
Most vertical resource parameters must be specified at the level of the containers declared for a component.
For each container in the code section, a size
field can be specified like this:
#ContainerSize: {
cpu: #ResourceAmount & {kind: "cpu", unit: _ | *""}
mincpu: *cpu.size | (number & >= 0 & <=cpu.size) // Same Units as cpu
memory: #ResourceAmount & {kind: "ram"}
}
No minmemory can be specified. Memory should be completely allocated. |
As for the component size, the values can be derived from the configuration, mainly from the scale
part
of the configuration.
The size section should be used by the component developer to code those resource parameters that fit the execution characteristics of the code in the component.