diff --git a/bench/go.mod b/bench/go.mod index 3671f16b1..49f23290d 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -7,7 +7,7 @@ require ( github.com/francoispqt/gojay v1.2.13 github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.3.0 - github.com/isucon/isucandar v0.0.0-20210816071706-966d19eb5d22 + github.com/isucon/isucandar v0.0.0-20210821075549-ee64d0785035 github.com/isucon/isucon10-portal v0.0.0-20201008112716-8c0b637e1bd8 github.com/isucon/isucon11-qualify/bench/random v0.0.0-00010101000000-000000000000 github.com/labstack/echo/v4 v4.5.0 diff --git a/bench/go.sum b/bench/go.sum index 20fc80638..0d437332b 100644 --- a/bench/go.sum +++ b/bench/go.sum @@ -87,6 +87,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/isucon/isucandar v0.0.0-20210816071706-966d19eb5d22 h1:8LGGYd5yECQgJAH+OF0qgEBiLzm4mE4i6ktvFeq7u/E= github.com/isucon/isucandar v0.0.0-20210816071706-966d19eb5d22/go.mod h1:B9L4o5rIoL2dKdHHVOFih3sZN1EfUFPtteVcSR5z1xw= +github.com/isucon/isucandar v0.0.0-20210821075549-ee64d0785035 h1:6JhNwsSGVZa/Z1TphnHxeWC/4KZwguI0SInxNkLqPT0= +github.com/isucon/isucandar v0.0.0-20210821075549-ee64d0785035/go.mod h1:B9L4o5rIoL2dKdHHVOFih3sZN1EfUFPtteVcSR5z1xw= github.com/isucon/isucon10-portal v0.0.0-20201008112716-8c0b637e1bd8 h1:3EP6xzY6pG71UdUBTWI3vjqQz/57fWrYnTANB7R4rX4= github.com/isucon/isucon10-portal v0.0.0-20201008112716-8c0b637e1bd8/go.mod h1:4hdJ/uFyj4jMNPfKq8KkrsrPyw5nV7B/5JRcAu1sgQM= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= diff --git a/bench/scenario/scenario.go b/bench/scenario/scenario.go index 60ecb57bb..d09204a8b 100644 --- a/bench/scenario/scenario.go +++ b/bench/scenario/scenario.go @@ -86,7 +86,17 @@ func (s *Scenario) WithInitializeTimeout(t time.Duration) *Scenario { return s } +func (s *Scenario) separatedTransport() agent.AgentOption { + return func(a *agent.Agent) error { + transport := agent.DefaultTransport.Clone() + transport.MaxIdleConnsPerHost = 100 + a.HttpClient.Transport = transport + return nil + } +} + func (s *Scenario) NewAgent(opts ...agent.AgentOption) (*agent.Agent, error) { + opts = append([]agent.AgentOption{s.separatedTransport()}, opts...) opts = append(opts, agent.WithBaseURL(s.BaseURL), agent.WithUserAgent(useragent.UserAgent())) return agent.NewAgent(opts...) }