From f279aaa300c850608f10f6e864d44d62bd483d2e Mon Sep 17 00:00:00 2001 From: David Kilfoyle <41695641+kilfoyle@users.noreply.github.com> Date: Fri, 25 Aug 2023 08:39:18 -0400 Subject: [PATCH] Add docs for gomaxprops option (#416) * Add docs for gomaxprops option * Update command description wrt Beats CPU * Fixup * Link to Filebeat max_procs; clarify must be integer * Update setting description * Update docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc Co-authored-by: Denis * Update GOMAXPROCS description * touchup * touchup * Update docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc Co-authored-by: Craig MacKenzie * Update docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc Co-authored-by: Craig MacKenzie * Update docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc * touchup * touchup --------- Co-authored-by: Denis Co-authored-by: Craig MacKenzie --- .../install-elastic-agent.asciidoc | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc b/docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc index abb5ca138..c0f3eadde 100644 --- a/docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc +++ b/docs/en/ingest-management/elastic-agent/install-elastic-agent.asciidoc @@ -65,3 +65,30 @@ The {agent} used the default policy, running the system integration and self-mon | **RSS Mem Size** | 400 MB |=== Adding integrations will increase the memory used by the agent and its processes. + +[discrete] +=== Limiting CPU usage + +If you need to limit the amount of CPU consumption you can use the `agent.limits.go_max_procs` configuration option. This parameter limits the number of operating system threads that can be executing Go code simultaneously in each Go process. The `agent.limits.go_max_procs` option accepts an integer value not less than `0`, which is the default value that stands for "all available CPUs". + +The `agent.limits.go_max_procs` limit applies independently to the agent and each underlying Go process that it supervises. For example, if {agent} is configured to supervise two {beats} with `agent.limits.go_max_procs: 2` in the policy, then the total CPU limit is six, where each of the three processes (one {agent} and two {Beats}) may execute independently on two CPUs. + +This setting is similar to the {beats} {filebeat-ref}/configuration-general-options.html#_max_procs[`max_procs`] setting. For more detail, refer to the link:https://pkg.go.dev/runtime#GOMAXPROCS[GOMAXPROCS] function in the Go runtime documentation. + +To enable `agent.limits.go_max_procs`, run a <> request from the {kib} {kibana-ref}/console-kibana.html[Dev Tools console] to override your current {agent} policy and add the `go_max_procs` parameter. For example, to limit Go processes supervised by {agent} to two operating system threads each, run: + +[source,shell] +-- +PUT kbn:/api/fleet/agent_policies/ +{ + "name": "", + "namespace": "default", + "overrides": { + "agent": { + "limits": { + "go_max_procs": 2 + } + } + } +} +--