{"id":5427,"date":"2015-07-20T22:23:20","date_gmt":"2015-07-20T13:23:20","guid":{"rendered":"http:\/\/www.vincentina.net\/?p=5427"},"modified":"2015-07-20T22:23:20","modified_gmt":"2015-07-20T13:23:20","slug":"mruby-cgroup%e3%82%92%e6%9c%89%e5%8a%b9%e3%81%ab%e3%81%97%e3%81%a6apache%e3%81%ae%e3%83%aa%e3%82%bd%e3%83%bc%e3%82%b9%e3%82%92%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.vincentina.net\/?p=5427","title":{"rendered":"mruby-cgroup\u3092\u6709\u52b9\u306b\u3057\u3066Apache\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3059\u308b\u8a71\u3000\u305d\u306e\u58f1"},"content":{"rendered":"<p>\u524d\u56de\u306fmod_mruby\u3092\u5c0e\u5165\u3057\u3066\u7c21\u5358\u306aRuby\u30b9\u30af\u30ea\u30d7\u30c8\u3067Apache\u306e\u6319\u52d5\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u3084\u308a\u307e\u3057\u305f\u3002\u7d9a\u3044\u3066\u4eca\u56de\u3082mruby\u306e\u8a71\u3067\u3001Cgroup\u3092\u6709\u52b9\u306b\u3057\u3066\u305d\u306e\u52b9\u679c\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3053\u307e\u3067\u3084\u308d\u3046\u304b\u306a\u3063\u3068\u601d\u3044\u307e\u3059\u3002\u30bb\u30df\u306e\u58f0\u3092\u805e\u304d\u306a\u304c\u3089\u90e8\u5c4b\u3067\u30b4\u30ed\u30b4\u30ed\u3057\u3066\u3044\u308b\u3068\u6c17\u5206\u3060\u3051\u306f\u590f\u4f11\u307f\u6c17\u5206\u306b\u306a\u308b\u306d\u301c\u3002\u6c17\u5206\u3060\u3051\u306d\u3002<\/p>\n<h3>cgroup\u3063\u3066\u4f55\u3065\u3089\uff1f<\/h3>\n<p>LinuxKernel\u306e\u6a5f\u80fd\u306e\uff11\u3064\u3067\u3001\u5229\u7528\u65b9\u6cd5\u306f\u3044\u308d\u3044\u308d\u3068\u3042\u308a\u307e\u3059\u3002\u304c\u3001\u96e3\u3057\u3044\u8a71\u306f\u30b9\u30eb\u30fc\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\ncgroup\u3092\u7565\u3055\u305a\u306b\u66f8\u304f\u3068\u30b3\u30f3\u30c8\u30fc\u30eb\u30b0\u30eb\u30fc\u30d7\u3067\u3001\u4f55\u306e\u30b3\u30f3\u30c8\u30fc\u30eb\u304b\u3068\u3044\u3046\u3068\u30ea\u30bd\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\u30ea\u30bd\u30fc\u30b9\u3063\u3064\u3046\u3068\u3001CPU\u3001\u30e1\u30e2\u30ea\u3001\u30c7\u30a3\u30b9\u30afI\/O\u3068\u304b\u3067\u3059\u306a\u3002<br \/>\n\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3068\u8a00\u3063\u3066\u3082\u8272\u3005\u3042\u308a\u305d\u3046\u3060\u3057\u8aac\u660e\u6587\u306b\u3059\u308b\u3068\u3084\u3084\u3053\u3057\u304f\u306a\u308a\u305d\u3046\u306a\u306e\u3067\u3001Wikipedia\u304b\u3089\u629c\u7c8b\u3057\u3066\u7b87\u6761\u66f8\u304d\u306b\u3057\u3066\u307f\u307e\u3059\u3068\u3002<\/p>\n<ul>\n<li>\u30ea\u30bd\u30fc\u30b9\u5236\u9650<\/li>\n<li>\u512a\u5148\u9806\u4f4d<\/li>\n<li>\u3069\u308c\u3060\u3051\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u304b\u8a08\u4e0a<\/li>\n<li>\u9694\u96e2<\/li>\n<li>\u4e00\u6642\u505c\u6b62\u30fb\u518d\u958b\u306a\u3069<\/li>\n<\/ul>\n<p>\u306a\u3069\u306a\u3069\u3002<br \/>\n\u3053\u3046\u3057\u3066\u66f8\u304d\u51fa\u3057\u305f\u3060\u3051\u3067\u3082\u8272\u3005\u306a\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3060\u306a\u3041\u3068\u3002<br \/>\n\u305f\u3060\u4eca\u56de\u306e\u76ee\u7684\u306f\u307e\u305a\u306fApache\u306b\u5bfe\u3057\u3066CPU\u306e\u5229\u7528\u309250\uff05\u306b\u3057\u307e\u3041\u30fc\u3059\u3002\u3059\u308b\u3063\u3066\u30fc\u3068\u3001\u53c2\u8003\u30b5\u30a4\u30c8\u306e\u307e\u307e\u3067\u3059\u304c\u6319\u52d5\u306e\u78ba\u8a8d\u306a\u306e\u3067\u826f\u3057\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>Cgroup\u3058\u305f\u3044\u306f\u4ee5\u524d\u306b\u3082\u5c11\u3057\u89e6\u3063\u3066\u3066\u3002<\/p>\n<p>\u95a2\u9023\u8a18\u4e8b<br \/>\n<a href=\"http:\/\/www.vincentina.net\/?p=4098\">C\u3067\u30b5\u30fc\u30d0\u30fc\u76e3\u8996\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u307f\u3088\u3046\u3000\u305d\u306e4<\/a><\/p>\n<p>\u3082\u30461\u5e74\u4ee5\u4e0a\u3082\u524d\u306b\u306a\u308b\u3093\u3067\u3059\u306a\u3041\u3001\u306a\u3064\u304b\u3057\u3084\u3002<\/p>\n<h3>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>\u307e\u305a\u306fcgroup\u3092\u6709\u52b9\u306b\u3059\u308b\u306b\u306fmod_mruby\u3082\u30ea\u30d3\u30eb\u30c9\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002<br \/>\n\u3084\u308b\u3079\u304d\u3053\u3068\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u5916\u3059\u3060\u3051\u3067\u306f\u306a\u304f\u3066\u8272\u3005\u5fc5\u8981\u306a\u306e\u3067\u3057\u305f\u3002<br \/>\n\u307e\u305a\u306fCgroup\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066Apache\u304c\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306a\u30b0\u30eb\u30fc\u30d7\u3092\u4f5c\u6210\u3057\u3068\u304d\u307e\u3059\u3002<\/p>\n<pre>\n# yum install -y libcgroup libcgroup-devel\n# chkconfig cgconfig on\n# service cgconfig start\n# mkdir \/cgroup\/cpu\/apache\n# chown -R apache:apache \/cgroup\/cpu\/apache\n# ls -l \/cgroup\/cpu\/apache\/\n\u5408\u8a08 0\n--w--w--w-. 1 apache apache 0  7\u6708 19 23:02 2015 cgroup.event_control\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cgroup.procs\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cpu.cfs_period_us\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cpu.cfs_quota_us\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cpu.rt_period_us\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cpu.rt_runtime_us\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cpu.shares\n-r--r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 cpu.stat\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 notify_on_release\n-rw-r--r--. 1 apache apache 0  7\u6708 19 23:02 2015 tasks\n<\/pre>\n<p>\u7d9a\u3044\u3066mod_mruby\u306e\u30ea\u30d3\u30eb\u30c9\u3002<br \/>\n\u5e38\u306b\u65b0\u3057\u304f\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u308b\u306e\u3067git pull\u3057\u3066\u304a\u3044\u3066\u826f\u3044\u304b\u306a\u3068\u601d\u308f\u308c\u3002<\/p>\n<pre>\n# cd mod_mruby\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\n# git pull\n# git submodule init\n# git submodule update\n# vim build_config.rb\nmruby-cgroup.git #\u3053\u306e\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3092\u5916\u3057\u3066\u6709\u52b9\u5316\u3057\u307e\u3059\u3002\n# cd mruby\n# rake CFLAGS=\"-fPIC\"\n# cd ..\n# .\/configure\n# make\n# make install\n<\/pre>\n<p>\u3053\u308c\u3067\u591a\u5206\uff08\u691c\u8a3c\u3067\u8272\u3005\u3068\u52d5\u304b\u3057\u3066\u3044\u305f\u306e\u3067\u591a\u5206\u3063\u3066\u3053\u3068\u3067\u3002\u3082\u3057\u304b\u3057\u305f\u3089\u4f55\u304b\u629c\u3051\u3066\u308b\u304b\u3082\u3057\u308c\u3093\u3002\uff09<br \/>\n\u52d5\u304f\u306f\u305a\u3002<br \/>\n\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7528\u610f\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u3066\u3001cgroup::CPU\u3067\u4f7f\u3048\u308b\u30e1\u30bd\u30c3\u30c9\u304c\u8868\u793a\u3055\u308c\u3066\u308c\u3070OK\u3067\u3059\u3002<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">\r\nc = Cgroup::CPU.new(&quot;apache\/mod_mruby_group&quot;)\r\nApache.echo c.methods\r\n<\/pre>\n<p>\u3061\u306a\u307f\u306b\u3061\u3083\u3093\u3068\u52d5\u3044\u3066\u3044\u308b\u3068\u6307\u5b9a\u3055\u308c\u3066\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u3067\u304d\u3066\u307e\u3059\u3002<br \/>\n\u305f\u3076\u3093\u52d5\u3044\u3066\u308b\u304b\u3082\uff1f\uff1f\u3068\u3044\u3046\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\uff57\uff57<\/p>\n<pre>\n# ls \/cgroup\/cpu\/apache\/mod_mruby_group\/\ncgroup.event_control  cpu.cfs_period_us  cpu.rt_period_us   cpu.shares  notify_on_release\ncgroup.procs          cpu.cfs_quota_us   cpu.rt_runtime_us  cpu.stat    tasks\n<\/pre>\n<h3>\u3053\u3053\u3067\u4e00\u606f<\/h3>\n<p>\u305d\u306e\u3046\u3061\u3084\u308b\u3067\u3042\u308d\u3046\u52d5\u7684\u306a\u30b3\u30f3\u30c8\u30fc\u30eb\u306b\u5099\u3048\u3066\u3001Apache::Scoreboard\u3092\u4f7f\u3063\u3066\u307f\u305f\u6642\u306e\u8a71\u3067\u3082\u3057\u307e\u3059\u304b\u3002<br \/>\n\u307e\u305a\u306f\u6700\u521d\u306f\u5168\u304f\u52d5\u304b\u306a\u304f\u3066\u3001\u30d5\u30c3\u30af\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u304c\u826f\u304f\u306a\u3044\u306e\u304b\uff1f\u3068\u304b\u3068\u304b\u601d\u3063\u3066\u8272\u3005\u8a66\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3084\u3089<\/p>\n<p>ExtendedStatus On<\/p>\n<p>\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u3088\u3046\u3060\u3002<br \/>\n\u30fb\u30fb\u30fb\u3050\u306c\u306c\u3002<br \/>\n\u521d\u6b69\u7684\u306a\u554f\u984c\u306a\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n<p>\u4e0a\u624b\u304f\u30c7\u30fc\u30bf\u304c\u3068\u308c\u3066\u3044\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8868\u793a\u304c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre>\n- idle worker     = 6\n- busy worker     = 2\n<\/pre>\n<p>\u5b9f\u9a13\u306e\u305f\u3081\u306bMPM\u306e\u8a2d\u5b9a\u3092\u6975\u7aef\u306b\u5909\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre><code>\n# httpd.conf\u3000prefork.c\nStartServers       1\nMinSpareServers    1\nMaxSpareServers   20\nServerLimit      256\nMaxClients       256\nMaxRequestsPerChild  4000\n<\/code><\/pre>\n<p>ApacheBench\u3067\u3064\u3093\u3064\u304f\u3064\u3093\u3068\u7a81\u3063\u3064\u3044\u3066\u5909\u5316\u3092\u898b\u3066\u307f\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306f\u5b9f\u884c\u524d\u3067\u3059\u3002<\/p>\n<pre>\n- idle worker     = 0\n- busy worker     = 1\n<\/pre>\n<p>ApacheBench\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\n\u9014\u4e2d\u7d4c\u904e\u3067\u3059\u304c\u30c9\u30ab\u30c9\u30ab\u3063\u3068\u5897\u3048\u3066\u6e1b\u3063\u305f\u3068\u3053\u3002<\/p>\n<pre>\n- idle worker     = 60\n- busy worker     = 65\n<\/pre>\n<p>\u7d42\u308f\u3063\u305f\u5f8c\u3067\u3059\u3002<br \/>\n\u3053\u306e\u3042\u3068MaxSpareServers\u306e\u8a2d\u5b9a\u5024\u307e\u3067\u6e1b\u3063\u3066\u3044\u304f\u306f\u305a\u3002<\/p>\n<pre>\n- idle worker     = 94\n- busy worker     = 2\n<\/pre>\n<p>\u7d42\u4e86\u3060\u3002<\/p>\n<pre>\n- idle worker     = 19\n- busy worker     = 1\n<\/pre>\n<p>\u5fae\u5999\u306b\u9577\u304f\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u3067\u4e0a\u624b\u304f\u30c7\u30fc\u30bf\u306f\u3068\u308c\u3066\u3044\u308b\u3053\u3068\u306f\u5206\u304b\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3057\u304b\u3057\u30b9\u30ec\u30c3\u30c9\u6570\u3068\u304b\u306f\u3061\u3083\u3093\u3068\u53d6\u308c\u3066\u308b\u306e\u306b\u3001\u30ed\u30fc\u30c9\u30a2\u30d9\u30ec\u30fc\u30b8\u304c\u53d6\u308c\u306a\u3044\u306e\u306f\u3069\u3053\u304b\u30df\u30b9\u3063\u3066\u308b\u306e\u3060\u308d\u3046\u304b\u3002\u3002<br \/>\n\u3067\u306f\u672c\u984c\u306b\u623b\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>mruby-cgroup\u306e\u5b9f\u9a13<\/h3>\n<p>\u53c2\u8003\u30b5\u30a4\u30c8<br \/>\n\u4eba\u9593\u3068\u30a6\u30a7\u30d6\u306e\u672a\u6765<br \/>\n<a href=\"http:\/\/blog.matsumoto-r.jp\/?p=3852\" target=\"_blank\">\u30ea\u30af\u30a8\u30b9\u30c8\u5358\u4f4d\u3067Apache\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306emruby\u3092\u4f7f\u3063\u305f\u5236\u5fa1DSL\u30b3\u30fc\u30c9\u306e\u7d39\u4ecb<\/a><\/p>\n<p>\u5358\u7d14\u306b\u5168\u3066\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092CPU50%\u306b\u5236\u5fa1\uff01\u3068\u3044\u3046\u306e\u3092\u3084\u3063\u3066\u307f\u307e\u3059<br \/>\n\u4ee5\u524d\u4f5c\u3063\u3066\u3044\u305f\u5186\u5468\u7387\u8a08\u7b97CGI\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u6319\u52d5\u3092\u898b\u3066\u307f\u308b\u3002<\/p>\n<pre>\n  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\n 2726 apache    20   0 38660 7720 2052 R 99.7  0.8   0:07.01 index.cgi\n<\/pre>\n<p>\u5b9f\u884c\u30b9\u30d1\u30fc\u30f3\uff01<span style=\"font-size: 14pt;\">\u3053\u308c\u3067\u6210\u529f\u3067\u3059\uff01<\/span><\/p>\n<pre>\n  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\n 4165 apache    20   0 38660 7716 2052 R 49.9  0.8   0:14.88 index.cgi\n<\/pre>\n<p><span style=\"font-size: 16pt;\">\u3044\u3084\u3041\u3001\u5206\u304b\u308a\u3065\u308c\u301c\uff01(^_^\u30e1)<\/span><\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067<\/p>\n<h3>suexec\u74b0\u5883\u3067\u8a66\u3057\u3066\u307f\u308b<\/h3>\n<p>\u5c11\u3057\u306f\u308f\u304b\u308a\u3084\u3059\u304f\u306a\u308b\u304b\u3068\u601d\u3046\u306e\u3067\u3001take\u3001jiro\u3001sayo\u306e3\u4eba\u306b\u8a66\u3057\u3066\u3044\u305f\u3060\u304f\u3068\u3057\u3088\u3046\u3002<br \/>\n\u8a2d\u5b9a\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u4f55\u3067\u3082Ok\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;Directory \/home\/*\/public_html&gt;\r\n  Options All\r\n  AllowOverride All\r\n  AddHandler cgi-script .cgi .pl .php\r\n&lt;\/Directory&gt;\r\n\r\n&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/home\/take\/public_html\r\n  ServerName  take.example.com\r\n  SuexecUserGroup take take\r\n&lt;\/VirtualHost&gt;\r\n\r\n&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/home\/jiro\/public_html\r\n  ServerName  jiro.example.com\r\n  SuexecUserGroup jiro jiro\r\n&lt;\/VirtualHost&gt;\r\n\r\n&lt;VirtualHost *:80&gt;\r\n  DocumentRoot \/home\/sayo\/public_html\r\n  ServerName  sayo.example.com\r\n  SuexecUserGroup sayo sayo\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>\u3068\u3053\u308d\u304c\u3069\u3063\u3053\u3044\u3067\u3001\u3053\u3053\u3067\u3072\u3068\u3064\u554f\u984c\u304c\u767a\u751f\u3001suexec\u306eDocroot\u304c\/var\/www\u3067\u3057\u305f\u3002<br \/>\n\u30b0\u30b0\u3063\u3066\u307f\u308b\u3068\u3069\u3046\u3084\u3089\u30ea\u30d3\u30eb\u30c9\u306f\u4e0d\u8981\u3067\u3001\u30d0\u30a4\u30ca\u30ea\u3067\u7de8\u96c6\u3057\u305f\u3089\u5909\u66f4\u3067\u304d\u308b\u3089\u3057\u3044\u306e\u3067\u3001\u751f\u307e\u308c\u3066\u521d\u3081\u3066emacs\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u751f\u307e\u308c\u301c\u3066\u301c\u3001\u306f\u3058\u3081\u301c\u3066\u301c\u3002<\/p>\n<p>\u7de8\u96c6\u524d<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# \/usr\/sbin\/suexec.org -V\r\n -D AP_DOC_ROOT=&quot;\/var\/www&quot;\r\n -D AP_GID_MIN=100\r\n -D AP_HTTPD_USER=&quot;apache&quot;\r\n -D AP_LOG_EXEC=&quot;\/var\/log\/httpd\/suexec.log&quot;\r\n -D AP_SAFE_PATH=&quot;\/usr\/local\/bin:\/usr\/bin:\/bin&quot;\r\n -D AP_UID_MIN=500\r\n -D AP_USERDIR_SUFFIX=&quot;public_html&quot;\r\n<\/pre>\n<p>\u7de8\u96c6\u5f8c<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;root@testcentos sbin]# suexec -V\r\n -D AP_DOC_ROOT=&quot;\/home&quot;\r\n -D AP_GID_MIN=100\r\n -D AP_HTTPD_USER=&quot;apache&quot;\r\n -D AP_LOG_EXEC=&quot;\/var\/log\/httpd\/suexec.log&quot;\r\n -D AP_SAFE_PATH=&quot;\/usr\/local\/bin:\/usr\/bin:\/bin&quot;\r\n -D AP_UID_MIN=500\r\n -D AP_USERDIR_SUFFIX=&quot;public_html&quot;\r\n<\/pre>\n<p>\u3058\u3083\u3058\u3083\u30fc\u3093\u3002\u6210\u529f\u3057\u307e\u3057\u305f\u3002<br \/>\n\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3082\u623b\u3055\u306a\u3044\u3068\u3001\u52d5\u304b\u306a\u3044\u306e\u301c\u3088\u301c\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# chmod 4755 \/usr\/sbin\/suexec\r\n# ls -la \/usr\/sbin\/suexec\r\n-rwsr-xr-x. 1 root apache 13984  7\u6708 20 01:17 2015 \/usr\/sbin\/suexec\r\n<\/pre>\n<p>\u3053\u308c\u3067take\u3068jiro\u306b\u5186\u5468\u7387\u8a08\u7b97CGI\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u305b\u3046\u3002<\/p>\n<pre>\n  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\n 4866 take      20   0 38660 7720 2052 R 24.9  0.8   0:01.67 index.cgi\n 4868 jiro      20   0 38660 7716 2052 R 24.9  0.8   0:01.04 index.cgi\n<\/pre>\n<p>\u3053\u308c\u304c\u7d50\u679c\u3067\u3059\u304c\u3001\u5408\u8a08\u306750\uff05\u306a\u306e\u30672\u4eba\u306750\uff05\u3067\u3061\u3083\u3093\u3068\u52d5\u3044\u3066\u3044\u308b\u3063\u3066\u306e\u304c\u3055\u3063\u304d\u3088\u308a\u306f\u5206\u304b\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n3\u4eba\u7528\u610f\u3059\u308b\u5fc5\u8981\u3082\u306a\u304b\u3063\u305f\u308f\u3051\u3067\u3059\u304c\u307e\u3041\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u4f59\u8ac7\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u5186\u5468\u7387\u8a08\u7b97\u3082\u306a\u304b\u306a\u304b\u30ea\u30bd\u30fc\u30b9\u304c\u5fc5\u8981\u306a\u3088\u3046\u3067\u3053\u306e\u7d50\u679c\u306f\u3053\u3046\u306a\u3063\u3061\u3083\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/www.vincentina.net\/wp-content\/uploads\/2015\/07\/ab01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.vincentina.net\/wp-content\/uploads\/2015\/07\/ab01-300x99.png\" alt=\"ab01\" width=\"300\" height=\"99\" class=\"alignnone size-medium wp-image-5440\" srcset=\"https:\/\/www.vincentina.net\/wp-content\/uploads\/2015\/07\/ab01-300x99.png 300w, https:\/\/www.vincentina.net\/wp-content\/uploads\/2015\/07\/ab01.png 551w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><\/p>\n<p>\u3068\u307e\u3041\u3001\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u30e6\u30fc\u30b6\u30fc\u6bce\u306b\u5236\u9650\u3092\u3057\u3066\u307f\u307e\u3059\u304b\u3002<br \/>\n\u6761\u4ef6\u306f\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u3060\u3063\u305f\u3089\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u304b\u30db\u30b9\u30c8\u30cd\u30fc\u30e0\u306f\u30e6\u30cb\u30fc\u30af\u3060\u3068\u601d\u3046\u306e\u3067\u3001\u4eca\u56de\u306f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3067\u6307\u5b9a\u3002<br \/>\n\u5206\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u3088\u3046\u306btake\u3055\u3093\u306e\u5834\u5408\u306f5\uff05\u306a\u3093\u3066\u6570\u5b57\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: ruby; title: ; notranslate\" title=\"\">\r\ns = Apache::Server.new\r\nif s.document_root == &quot;\/home\/take\/public_html&quot;\r\n  c = Cgroup::CPU.new(&quot;apache\/mod_mruby_group&quot;)\r\n  c.cfs_quota_us = 5000\r\n<\/pre>\n<pre>\n  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\n 6051 jiro      20   0 38660 7716 2052 R 44.9  0.8   0:15.19 index.cgi\n 6055 sayo      20   0 38660 7720 2052 R 44.9  0.8   0:10.41 index.cgi\n 6053 take      20   0 38660 7720 2052 R 10.0  0.8   0:02.58 index.cgi\n<\/pre>\n<p>\u3053\u308c\u3067\u524d\u56de\u3088\u308a\u306f\u4f7f\u3063\u3066\u308b\u611f\u304c\u51fa\u3066\u307e\u3044\u308a\u307e\u3057\u305f\u3002\u3053\u308c\u3067\uff06\u6761\u4ef6\u3067\u3082\u4ed8\u3051\u8db3\u305b\u3070\u305d\u308c\u306a\u308a\u306a\u5f62\u306b\u306a\u308b\u3068\u601d\u308f\u308c\u3002<br \/>\n\u5143\u304b\u3089\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u306f\u30ea\u30bd\u30fc\u30b9\u3092\u3042\u307e\u308a\u4f7f\u3044\u305f\u304f\u306a\u3044\u306a\u3041\u306a\u3093\u3066\u6642\u306b\u3082\u4f7f\u3048\u307e\u3059\u306d\u3002<\/p>\n<p>\u305d\u3093\u306a\u611f\u3058\u3067\u4eca\u56de\u306f\u304a\u308f\u308a\u301c\u3002<\/p>\n<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.vincentina.net\/?p=5427\" data-text=\"mruby-cgroup\u3092\u6709\u52b9\u306b\u3057\u3066Apache\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3059\u308b\u8a71\u3000\u305d\u306e\u58f1\" data-via=\"TakekenTw\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306fmod_mruby\u3092\u5c0e\u5165\u3057\u3066\u7c21\u5358\u306aRuby\u30b9\u30af\u30ea\u30d7\u30c8\u3067Apache\u306e\u6319\u52d5\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u3084\u308a\u307e\u3057\u305f\u3002\u7d9a\u3044\u3066\u4eca\u56de\u3082mruby\u306e\u8a71\u3067\u3001Cgroup\u3092\u6709\u52b9\u306b\u3057\u3066\u305d\u306e\u52b9\u679c\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3053\u307e\u3067\u3084\u308d\u3046\u304b\u306a\u3063\u3068\u601d\u3044\u307e\u3059\u3002\u30bb\u30df\u306e &hellip; <a href=\"https:\/\/www.vincentina.net\/?p=5427\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;mruby-cgroup\u3092\u6709\u52b9\u306b\u3057\u3066Apache\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3059\u308b\u8a71\u3000\u305d\u306e\u58f1&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-5427","post","type-post","status-publish","format-standard","hentry","category-server"],"_links":{"self":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts\/5427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5427"}],"version-history":[{"count":0,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=\/wp\/v2\/posts\/5427\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vincentina.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}