INNER CODE UNIT · Go

estimatedRPS

bhope/hedge · benchmark/simulate/main.go:116

	estimatedRPS := float64(concurrency) * 1000.0 / avgLatencyMs

	var adaptiveStats *hedge.Stats
	adaptiveTransport := hedge.New(http.DefaultTransport,
		hedge.WithEstimatedRPS(estimatedRPS),
		hedge.WithBudgetPercent(10), // p90 fires on ~10% of requests; match budget to threshold rate
		hedge.WithStats(&adaptiveStats),
	)
	fmt.Printf("warming up adaptive transport (estimatedRPS=%.0f)...\n", estimatedRPS)
	for i := 0; i < 25; i++ {
		req, _ := http.NewRequest("GET", srv.URL, nil)
		resp, err := adaptiveTransport.RoundTrip(req)
		if err == nil {
			resp.Body.Close()
		}
	}

	static10, err := hedgedhttp.NewRoundTripper(10*time.Millisecond, 2, http.DefaultTransport)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…