Problem:
How can I limit CPU usage by agent in CentOs (Redhat)
Solution:
Below are the dependencies and the workflow to limit the CPU usage by agent:
Dependencies:
- Build-essentials - yum install make glibc-devel gcc patch git
- Having installed the agent using the oneliner solution or manually
Workflow:
- Download cpulimit: wget https://github.com/opsengine/cpulimit/archive/v0.2.tar.gz
- Unpack the tarball: tar xfz v0.2.tar.gz
- Go into the source directory: cd cpulimit-0.2/
- Build the binary: make
- Copy the program into your $PATH: cp src/cpulimit /usr/bin/
- Start the Instana agent: service instana-agent start
- Grab the agent’s PID: PID=$(cat /var/run/instana/agent.pid)
Limit the agent’s consumption to half a core: nohup cpulimit -l 50 -p $PID &
Comments