- freshet, flood
- a) a large number or amount<br>
b) a sudden or strong outburst rush
spate can scale services based on exposed Prometheus metrics. However, the foundations already have been layed for different types. Future versions will, for instance, be able to scale based on the CPU or memory usage.
$ docker service create \ --constraint 'node.role == manager' \ --mount 'type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock' \ mtneug/spate
spate sets the replica count via the Docker API and needs therefore access to the Unix socket of a manager node. Also, make sure to put
spate in the necessary networks so that it can poll data from the running containers is should scale. Prometheus metrics are exposed on port 8080.
spate is running a reconciliation loop constantly looks for changes in the Docker Swarm cluster. Autoscaling is entirely controlled through service labels. In this way users and scripts only have to directly interact with the Docker CLI client.
$ docker service create \ --name my-worker \ --network spate-demo \ --label "de.mtneug.spate=enable" \ --label "de.mtneug.spate.metric.load.type=prometheus" \ --label "de.mtneug.spate.metric.load.kind=replica" \ --label "de.mtneug.spate.metric.load.prometheus.endpoint=http://localhost:8080/metrics" \ --label "de.mtneug.spate.metric.load.prometheus.name=jobs_total" \ --label "de.mtneug.spate.metric.load.target=3" \ my/worker
In this example a
my-worker service is created. Each replica exposes the
jobs_total Prometheus metric on port 8080, which should count the number of jobs currently processed. It is the aim, that each replica, in average, processes three jobs. A metric is therefore added with the
de.mtneug.spate.metric.load labels. This way, if too many jobs are in the system,
spate automatically increase the replica count and vice versa.
spate is highly configurable. Have a look at the documentation for a complete list of options.
An example application is provided with spate-demo. Consult this repository's README for more information.
Apache 2.0 (c) Matthias Neugebauer