New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cpu limit #3912

Open
wants to merge 2 commits into
base: development
from

Conversation

2 participants
@deanrather

deanrather commented Sep 14, 2018

Adds support for an optional cpu_limit option on applications defined in the environment.config.js file.

eg:

// environment.config.json
module.exports = {
  apps: [{
      script: './heavy-service.sh',
      args: ['--port=1111', '--name=service1'],
      cpu_limit: 1
    },
    {
      script: './heavy-service.sh',
      args: ['--port=2222', '--name=service2'],
      cpu_limit: 1
    },
    {
      script: './heavy-service.sh',
      args: ['--port=3333', '--name=service3'],
      cpu_limit: 1
    },
    {
      script: './heavy-service.sh',
      args: ['--port=4444', '--name=service4'],
      cpu_limit: 10
    }, {
      script: './heavy-service.sh',
      args: ['--port=5555', '--name=service5'],
      cpu_limit: 10
    }
  ]
};
#!/bin/bash
# heavy-service.sh

example_arg1=$1
example_arg2=$2

# this will use up all available CPU

while true; do
  echo "heavy-service running with example_arg1: $example_arg1, example_arg2: $example_arg2"
  # sleep 0.000001
done
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR https://github.com/pm2-hive/pm2-hive.github.io/pulls
@CLAassistant

This comment has been minimized.

Show comment
Hide comment
@CLAassistant

CLAassistant Sep 14, 2018

CLA assistant check
All committers have signed the CLA.

CLAassistant commented Sep 14, 2018

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment