Document docker resource limits (#25925)
* Document docker resource limits * No longer experimental on JVM10
This commit is contained in:
parent
40483a2506
commit
40649151d0
1 changed files with 28 additions and 1 deletions
|
|
@ -42,7 +42,34 @@ You can look at the
|
|||
@scala[@extref[Cluster with docker-compose example project](samples:akka-sample-cluster-docker-compose-scala)]
|
||||
to see what this looks like in practice.
|
||||
|
||||
For the JVM to run well in a Docker container, there are some general (not Akka specific) parameters that might need tuning. You may want to look into using [`-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap`](https://dzone.com/articles/running-a-jvm-in-a-container-without-getting-kille) options for your JVM later than 8u131, which makes it understand c-group memory limits.
|
||||
For the JVM to run well in a Docker container, there are some general (not Akka specific) parameters that might need tuning:
|
||||
|
||||
### Resource limits
|
||||
|
||||
Docker allows [constraining each containers' resource usage](https://docs.docker.com/config/containers/resource_constraints/).
|
||||
|
||||
#### Memory
|
||||
|
||||
You may want to look into using [`-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap`](https://dzone.com/articles/running-a-jvm-in-a-container-without-getting-kille) options for your JVM later than 8u131, which makes it understand c-group memory limits. On JVM 10 and later, the `-XX:+UnlockExperimentalVMOptions` option is no longer needed.
|
||||
|
||||
#### CPU
|
||||
|
||||
For multi-threaded applications such as the JVM, the CFS scheduler limits are an ill fit, because they will restrict
|
||||
the allowed CPU usage even when more CPU cycles are available from the host system. This means your application may be
|
||||
starved of CPU time, but your system appears idle.
|
||||
|
||||
For this reason, it is best to avoid `--cpus` and `--cpu-quota` entirely, and instead specify relative container weights using `--cpu-shares` instead.
|
||||
|
||||
## In Kubernetes
|
||||
|
||||
### Cluster bootstrap
|
||||
|
||||
To take advantage of the fact that your are running inside of Kubernetes while forming a cluster, you can use the [Akka Cluster Bootstrap](https://developer.lightbend.com/docs/akka-management/current/bootstrap/) module.
|
||||
|
||||
You can look at the
|
||||
@extref[Cluster with Kubernetes example project](samples:akka-sample-cluster-kubernetes-java)
|
||||
to see what this looks like in practice.
|
||||
|
||||
### Resource limits
|
||||
|
||||
To avoid CFS scheduler limits, it is best not to use `resources.limits.cpu` limits, but use `resources.requests.cpu` configuration instead.
|
||||
Loading…
Add table
Add a link
Reference in a new issue