elastic / elastic/elastic-agent
[elastic-agent] support resource limitations on child processes
- Dominant language
- Go
- Stars
- 275
- Forks
- 264
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 303
Description
**Summary**
When the elastic agent installs a new input, it starts a new process or restarts an existing process with additional input configuration. The agent does not apply any resource limits to the created subprocesses, potentially leading to the processes competing for available resources. This can become an issue when multiple processes run with high load, reaching the limit of available resources. We need a solution for limiting resource usage per subprocess.
It becomes especially important when the resources for the elastic agent are already restricted, which will be the case for the hosted elastic agent.
There is currently no concept available for how the memory/cpu shares available to the elastic agent should be distributed between processes. Most probably we would not want to limit the subprocesses by default, but only if configured. For hosted agents the orchestrator should pass a configuration to the container where the agent is running.
**TODO**
- [ ] Do we need a solution for non-containerized environments which are not supporting `cgroups`?
- [ ] Where should the configuration for resource limitations live?
- [ ] Does the configuration need to be validated, e.g. sum of shares needs to be <=100% of available resources
- [ ] how to retrieve available resources by the elastic agent, e.g. use ENV for passing in overall restrictions
- [ ] define supported limitations (e.g. CPU period/quota)
- [ ] do we need concrete limits, or is setting process priorities already enough?
- [ ] privileges the elastic agent needs for applying resource limitations to the subprocesses (most probably not an issue, as it already has privileges to start the processes as root)
Contributor guide
Assessment
This issue has not been assessed yet.