nginxでabした時にtoo many open filesになってしまった場合の対処
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[nginx]]
*説明 [#z21f03ff]
nginxが同時に開けファイル数の制御の設定です。
*手順 [#bf3a6249]
# ab -c 1024 -n 10240 http://hogehoge.com/
Too many open files
# ps aux | grep nginx
root 13206 0.0 0.0 44720 1184 ? Ss 18:5...
nginx 13207 1.0 0.0 45212 2276 ? S 18:5...
nginx 13208 0.0 0.0 45108 1916 ? S 18:5...
nginx 13209 0.5 0.0 45212 2276 ? S 18:5...
nginx 13210 0.0 0.0 45108 1864 ? S 18:5...
# cat /proc/プロセスID/limit
# cat /proc/13207/limits
Limit Soft Limit Hard Limi...
Max cpu time unlimited unlimited...
Max file size unlimited unlimited...
Max data size unlimited unlimited...
Max stack size 10485760 unlimited...
Max core file size 0 unlimited...
Max resident set unlimited unlimited...
Max processes 30490 30490 ...
Max open files 1024 1024 ...
Max locked memory 65536 65536 ...
Max address space unlimited unlimited...
Max file locks unlimited unlimited...
Max pending signals 30490 30490 ...
Max msgqueue size 819200 819200 ...
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited...
# cd /etc/nginx/
# cp -p nginx.conf nginx.conf.`date +%Y%m%d`
# vi nginx.conf
--- 追記
worker_rlimit_nofile 8192; <--ここ
events {
worker_connections 1024;
}
---
# service nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf synt...
nginx: configuration file /etc/nginx/nginx.conf test is ...
# service nginx resrart
# ps aux | grep nginx
root 13282 0.0 0.0 44752 1172 ? Ss 18:5...
nginx 13283 0.0 0.0 45204 1876 ? S 18:5...
nginx 13284 0.0 0.0 45204 1812 ? S 18:5...
nginx 13285 0.0 0.0 45204 1876 ? S 18:5...
nginx 13287 0.0 0.0 45204 1860 ? S 18:5...
# cat /proc/13287/limits
Max open files 8192 8192 ...
参考URL:http://www.1x1.jp/blog/2013/02/nginx_too_many_ope...
終了行:
[[nginx]]
*説明 [#z21f03ff]
nginxが同時に開けファイル数の制御の設定です。
*手順 [#bf3a6249]
# ab -c 1024 -n 10240 http://hogehoge.com/
Too many open files
# ps aux | grep nginx
root 13206 0.0 0.0 44720 1184 ? Ss 18:5...
nginx 13207 1.0 0.0 45212 2276 ? S 18:5...
nginx 13208 0.0 0.0 45108 1916 ? S 18:5...
nginx 13209 0.5 0.0 45212 2276 ? S 18:5...
nginx 13210 0.0 0.0 45108 1864 ? S 18:5...
# cat /proc/プロセスID/limit
# cat /proc/13207/limits
Limit Soft Limit Hard Limi...
Max cpu time unlimited unlimited...
Max file size unlimited unlimited...
Max data size unlimited unlimited...
Max stack size 10485760 unlimited...
Max core file size 0 unlimited...
Max resident set unlimited unlimited...
Max processes 30490 30490 ...
Max open files 1024 1024 ...
Max locked memory 65536 65536 ...
Max address space unlimited unlimited...
Max file locks unlimited unlimited...
Max pending signals 30490 30490 ...
Max msgqueue size 819200 819200 ...
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited...
# cd /etc/nginx/
# cp -p nginx.conf nginx.conf.`date +%Y%m%d`
# vi nginx.conf
--- 追記
worker_rlimit_nofile 8192; <--ここ
events {
worker_connections 1024;
}
---
# service nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf synt...
nginx: configuration file /etc/nginx/nginx.conf test is ...
# service nginx resrart
# ps aux | grep nginx
root 13282 0.0 0.0 44752 1172 ? Ss 18:5...
nginx 13283 0.0 0.0 45204 1876 ? S 18:5...
nginx 13284 0.0 0.0 45204 1812 ? S 18:5...
nginx 13285 0.0 0.0 45204 1876 ? S 18:5...
nginx 13287 0.0 0.0 45204 1860 ? S 18:5...
# cat /proc/13287/limits
Max open files 8192 8192 ...
参考URL:http://www.1x1.jp/blog/2013/02/nginx_too_many_ope...
ページ名: