Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matsumotory/mruby-rcon
lightweight virtualization tool for linux processes module for mruby
https://github.com/matsumotory/mruby-rcon
Last synced: about 2 months ago
JSON representation
lightweight virtualization tool for linux processes module for mruby
- Host: GitHub
- URL: https://github.com/matsumotory/mruby-rcon
- Owner: matsumotory
- License: other
- Created: 2015-11-25T02:31:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T03:20:00.000Z (about 6 years ago)
- Last Synced: 2024-10-18T18:23:33.772Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 8.79 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mruby-rcon
mruby-rcon is a lightweight virtualization mrbgem for linux processes.
## build rcon
```
rake
```and create `rcon` binary into current directory.
## example
```ruby
# httpd.rb
Rcon.new({:command => "/usr/sbin/httpd -X",
:resource => {
# cgroup name
:group => "httpd",# cgroup root path
# centos "/cgroup" by default
# ubuntu "/sys/fs/cgroup"
:root => "/cgroup"# CPU [msec] exc: 30000 -> 30%
:cpu_quota => 30000,# IO [Bytes/sec]
:blk_dvnd => "202:0",
:blk_rbps => 10485760,
:blk_wbps => 10485760,# Memory [Bytes]
:mem => 512 * 1024 * 1024,
:oom => true,},
}).run
# callback memory limit event (default :oom)
# }).run_with_mem_eventfd do |ret|
# puts "OOM KILLER!!! > #{ret}"
# end# callback memory limit event for oom
# }).run_with_mem_eventfd(:oom) do |ret|
# puts "OOM KILLER!!! > #{ret}"
# end# callback memory limit event for usage(4MByte)
# }).run_with_mem_eventfd(:usage, 4 * 1024 * 1024) do |ret|
# puts "Usage Up or Down to threadshould !!! > #{ret}"
# end```
## run
```
sudo ./rcon httpd.rb
```### auto memory expansion example
```ruby
Virtualing.new({
#(snip)
:resource => {
#(snip)
:oom => false,
},
#(snip)
}).run_with_mem_eventfd_loop do |ret|
puts "OOM KILLER!!! current memory: #{mem}"
sleep 2
c = Virtualing::MEMORY.new group
mem = mem * 2
c.limit_in_bytes = mem
c.modify
puts "current memory expand to #{mem}"
end
```## License
under the MIT License:
- see LICENSE file