New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ベンチマーカーのコネクションリーク #3
Comments
なお、「大きめのTransport」とは、 Transport の以下のメンバーを適切に設定することを意味しています。
https://golang.org/pkg/net/http/#Transport その下にある以下の文が、「Go の想定している使い方」を説明しています。
|
cocodrips
referenced
this issue
in cocodrips/isucon6-qualify
Aug 19, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/isucon/isucon6-qualify/blob/master/bench/cli.go#L70
ここで scenario 関数を実行するたびに NewSession() していて、
https://github.com/isucon/isucon6-qualify/blob/master/bench/checker/session.go#L46
ここで Session ごとに Transport を作ってしまっているのですが、 Transport はコネクションプールに
なっているので、 Session & Transport を GC 任せに破棄すると、その Transport に
残っている http クライアントのコネクションが開放されずにベンチマーカー終了まで
残ってしまうように見えます。
そのため、アプリ側のチューニングが進むと、ベンチマーカー側が too many open files になったり、
ポートが枯渇したりして、スコアが上がらなくなります。
回避策としては、
Go の想定している使い方としては 1 の方がおすすめですが、それだと1つのTCPコネクションを
通して複数のユーザーのhttpリクエストが送られてくることになるので、多数のブラウザからの
(ロードバランサーなどを介さない)接続をエミュレートしたいなら 2 の方が近くなります。
The text was updated successfully, but these errors were encountered: