LoginSignup
28
31

More than 5 years have passed since last update.

Linuxサーバで負荷試験するにあたって

Last updated at Posted at 2015-03-26

LinuxでTCPのサーバを置いて多量のTCP接続を行うと、初期設定のままではうまくいきませんでした。
多量のTCP接続を受け付けるには設定手順があると知ったので紹介します。

「Too many open files」と出て接続できない

1プロセスで開けるソケット数上限に達したようです。
上限を上げましょう(デフォルト1024)。
接続元と接続先でそれぞれ以下のコマンドを使います。

ulimit -n 102400

「Connection refused」と出て接続できない

まず接続先でdmesgコマンドを実行しましょう。

TCP: Possible SYN flooding on port 8888. Sending cookies.

と表示されたらSYN flooding攻撃かもとOSが判断して新規接続をブロックしています。
無効化しましょう( http://ja.wikipedia.org/wiki/SYN_flood )。
接続先で以下のコマンドを使います。

sysctl -w net.ipv4.tcp_syncookies=0

28
31
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
31