Git Product home page Git Product logo

rcon's Introduction

rcon Build Status

rcon is a lightweight resource virtualization tool for linux processes. rcon is one-binary.

demo

build

build on vagrant

vagrant up
vagrant ssh
cd rcon/
rake
cp -p mruby/bin/rcon /path/to/bin-dir/.

build packages and release

Create release binary considering glibc versions using Docker.

Require: golang docker

I build and release rcon on macOS.

rake package
ls -l pkg/
GITHUB_TOKEN=`cat ~/.github_token` rake release

usage

 ./rcon --help
Usage: rcon [options] --user username --command "yes >> /dev/null"
    --cpu VAL
      default: 30 (%)
    --memory VAL
      default: 512000000 (Byte)
    --read VAL
      default: 10485760 (Byte/sec)
    --write VAL
      default: 10485760 (Byte/sec)
    --group VAL
      default: rcon
    --dev VAL
      default: 8:0
    --pids VAL
      default: nothing
    --version

cpu example

no limit

  • command
yes >> /dev/null
  • cpu usage
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
27577 matsumot  20   0 98.5m  608  520 R 100.0  0.0   0:01.95 yes 

limitting cpu 10%

  • command
sudo ./rcon --user matsumotory --command "yes >> /dev/null" --cpu 10
  • cpu usage limitted 10% by rcon
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
23941 matsumot  20   0 98.5m  604  520 R  9.6  0.0   0:00.63 yes

limitting already running process to cpu 30%

  • command
yes >> /dev/null &
yes >> /dev/null &
sudo ./rcon --pids "`pgrep yes`"
  • cpu usage
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND 
22531 vagrant   20   0 98.5m  612  524 R 15.6  0.0   0:16.16 yes
22532 vagrant   20   0 98.5m  612  524 R 14.3  0.0   0:15.47 yes

Notice: pids optsion don't delete groups after running process was finished

io example

no limit

  • command
dd if=/dev/zero of=tempfile bs=1M count=1000 oflag=direct
  • io usage
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
27569 be/4 matsumot    0.00 B/s   22.09 M/s  0.00 % 95.93 % dd if=/dev/zero of=tempfile bs=1M count=1000 oflag=direct

limitting write io 1MByte/sec

  • command
sudo ./rcon --user matsumotory --command "dd if=/dev/zero of=tempfile bs=1M count=1000 oflag=direct" --write 1024000
  • io usage limitted 1MByte/sec by rcon
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
24676 be/4 matsumot    0.00 B/s  995.77 K/s  0.00 % 99.99 % dd if=/dev/zero of=tempfile bs=1M count=1000 oflag=direct  
  • find io dev id (--dev)
$ ls -l /dev/xvda | awk '{print $5 $6}' | sed 's/,/:/'
202:0

for --dev option. default 8:0.

rcon's People

Contributors

ekqry1 avatar matsumotory avatar pyama86 avatar rrreeeyyy avatar tehzeno avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.