2012-05-02
■[HAProxy]HAProxyの最大接続数設定はコンフィグファイル+αが必要だった罠

コンフィグファイルのmaxconn設定してるのに
HAProxyの接続数が頭打ちになるわ〜、ぼやいていたところ、
id:sfujiwaraさんから以下のような回答をいただきました。
HAProxyの接続数が頭打ちになるのはなんでじゃろ。ulimit/maxconnは設定してるんだけど
@toritori0318 何接続ぐらいですか?
@fujiwara 2000くらいですかね。ちなみにwebsocketで常時接続です
2012-05-02 13:48:44 via Echofon to @fujiwara
@toritori0318 ソースみたら #define DEFAULT_MAXCONN 2000 というのがありましたが、maxconnの設定が効いていないんでしょうか
@fujiwara おおなるほど。設定のしかたが悪いのかなあ?ちょっと見なおしてみます。ありがとうございます!
2012-05-02 13:52:52 via Echofon to @fujiwara
@toritori0318 defaults.h にこんなコメントが > The only way to override this limit will be to set it via the command-line '-n' argument
あなたが神か…!*1
helpを確認。
Usage : haproxy [-f <cfgfile>]* [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]
[ -p <pidfile> ] [ -m <max megs> ]
-v displays version ; -vv shows known build options.
-d enters debug mode ; -db only disables background mode.
-V enters verbose mode (disables quiet mode)
-D goes daemon
-q quiet mode : don't display messages
-c check mode : only check config files and exit
-n sets the maximum total # of connections (2000)
-m limits the usable amount of memory (in MB)
-N sets the default, per-proxy maximum # of connections (2000)
-p writes pids of all children to this file
-de disables epoll() usage even when available
-ds disables speculative epoll() usage even when available
-dp disables poll() usage even when available
-sf/-st [pid ]* finishes/terminates old pids. Must be last arguments.
今回の場合だと 「-n」 と 「-N」 を両方指定したところ
想定通りの接続数まで行きました。
しかしこれ、コンフィグファイルのmaxconnだけ設定すれば良いと
勘違いしてる人いるんじゃないかなー?
わりと罠な気がする。
本日の教訓
ソース嫁。
*1:何回目だw
- 167 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCYQFjAA&url=http://d.hatena.ne.jp/toritori0318/20091105/1257260011&ei=qqChT6_vFvCfiAfL46HnCA&usg=AFQjCNGLT8V7GZtIeIZARa9Db5P6sR_v4w
- 99 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CCwQFjAB&url=http://d.hatena.ne.jp/toritori0318/20120417/1334673901&ei=V0ChT9bNI8nGmQWAocW_CA&usg=AFQjCNGPsszK6p-0GKKP1lYTlaq8n5q1ug
- 82 http://www.r-labs.org/projects/r-labs/wiki/Estimate_timelog
- 74 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CD0QFjAC&url=http://d.hatena.ne.jp/toritori0318/20091103/1257260011&ei=gCmiT-G4OIjPmAWIwej_Bw&usg=AFQjCNEGQFUpMs7ryFhteyoIOg4uFR3U8w&sig2=uwVpFicSXcVl1dxuOSblZA
- 43 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CGkQFjAD&url=http://d.hatena.ne.jp/toritori0318/20110625/1309023660&ei=0wikT82NM66imQXe1uCyCQ&usg=AFQjCNFhNsr9rMGcLVeD-S8IxbPsFS7Xcg&sig2=OFIc-jQDzHfviyJNA-jcEg
- 30 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=7&ved=0CKoBEBYwBg&url=http://d.hatena.ne.jp/toritori0318/20110119/1295449880&ei=tIOjT7qqNrGUmQXu1PzXDg&usg=AFQjCNE8IrjfZe-NqTo274LLjLT3L95qnw&sig2=es4Xti0fqEOH33WAHaqp6w
- 28 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&ved=0CD0QFjAE&url=http://d.hatena.ne.jp/toritori0318/20120205/1328457492&ei=e1mhT_DaC6WOmQW6v_mKCA&usg=AFQjCNHamJFPsCMnMXGbm46ef1kvyA-dfg&sig2=fLAJwPG1vJkGvfH5R_GG_Q
- 27 http://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=6&ved=0CEsQFjAF&url=http://d.hatena.ne.jp/toritori0318/20110625/1309023660&ei=cjaiT7KeHcXUmAWh99iJCA&usg=AFQjCNFhNsr9rMGcLVeD-S8IxbPsFS7Xcg&sig2=zHdsYchTM7Kz_u39wmXgBw
- 13 http://www.google.co.jp/url?sa=t&rct=j&q=xen インストール&source=web&cd=2&ved=0CHMQFjAB&url=http://d.hatena.ne.jp/toritori0318/20090411/1239467997&ei=71GmT8LhBe6amQXMseHhBA&usg=AFQjCNEPuWgsgINgR196Ph
- 12 http://ruf.site90.com/wp




