MCPcopy Create free account
hub / github.com/appleboy/loadbalancer-algorithms / BenchmarkNextParallel

Function BenchmarkNextParallel

roundrobin/roundrobin_test.go:139–154  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

137}
138
139func BenchmarkNextParallel(b *testing.B) {
140 servers := []*proxy.Proxy{
141 proxy.NewProxy("s1", &url.URL{Host: "192.168.1.10"}),
142 proxy.NewProxy("s2", &url.URL{Host: "192.168.1.11"}),
143 proxy.NewProxy("s3", &url.URL{Host: "192.168.1.12"}),
144 proxy.NewProxy("s4", &url.URL{Host: "192.168.1.13"}),
145 }
146 r, _ := New(servers...)
147 b.ReportAllocs()
148 b.ResetTimer()
149 b.RunParallel(func(pb *testing.PB) {
150 for pb.Next() {
151 r.NextServer()
152 }
153 })
154}
155
156func BenchmarkAddServers(b *testing.B) {
157 r, _ := New()

Callers

nothing calls this directly

Calls 3

NewProxyFunction · 0.92
NewFunction · 0.70
NextServerMethod · 0.65

Tested by

no test coverage detected