MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / Benchmark_RestApiGetDocPerformanceFullRevCache

Function Benchmark_RestApiGetDocPerformanceFullRevCache

rest/api_test.go:2161–2182  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

2159}
2160
2161func Benchmark_RestApiGetDocPerformanceFullRevCache(b *testing.B) {
2162 base.SetUpBenchmarkLogging(b, base.LevelWarn, base.KeyHTTP)
2163 // Create test documents
2164 rt := NewRestTester(b, nil)
2165 defer rt.Close()
2166 keys := make([]string, 5000)
2167 for i := 0; i < 5000; i++ {
2168 key := fmt.Sprintf("doc%d", i)
2169 keys[i] = key
2170 rt.SendRequest("PUT", "/{{.keyspace}}/"+key, `{"prop":true}`)
2171 }
2172
2173 b.ResetTimer()
2174
2175 b.RunParallel(func(pb *testing.PB) {
2176 // GET the document until test run has completed
2177 for pb.Next() {
2178 key := keys[rand.Intn(5000)]
2179 rt.SendRequest("GET", fmt.Sprintf("/{{.keyspace}}/%s?rev=1-45ca73d819d5b1c9b8eea95290e79004", key), "")
2180 }
2181 })
2182}
2183
2184func TestHandleProfiling(t *testing.T) {
2185 rt := NewRestTester(t, nil)

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
SendRequestMethod · 0.95
SetUpBenchmarkLoggingFunction · 0.92
NewRestTesterFunction · 0.85
NextMethod · 0.45

Tested by

no test coverage detected