From 6c23252515492caf9b228a9d5cabcdbde29f7f82 Mon Sep 17 00:00:00 2001 From: Jaana Burcu Dogan Date: Fri, 24 Mar 2017 14:59:51 -0700 Subject: [PATCH] Revert "http2/h2demo: add HTTP/2 with Server Push" Server Push is not more performant than regular HTTP/2 test for this demo. I will produce a new demo page where Server Push is clearly a better choice and consistently faster. This reverts commit 3e967e1d28d2c9c06e749dc2bdc14b04df89e689. Change-Id: Iace26e17714c0eca52785fc04d410df041e56415 Reviewed-on: https://go-review.googlesource.com/38608 Reviewed-by: Brad Fitzpatrick --- http2/h2demo/h2demo.go | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/http2/h2demo/h2demo.go b/http2/h2demo/h2demo.go index fa5978ee5..980b6d67d 100644 --- a/http2/h2demo/h2demo.go +++ b/http2/h2demo/h2demo.go @@ -313,13 +313,6 @@ func newGopherTilesHandler() http.Handler { } return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ms, _ := strconv.Atoi(r.FormValue("latency")) - push, _ := strconv.ParseBool(r.FormValue("push")) - - cacheBust := time.Now().UnixNano() - if push { - pushTiles(w, cacheBust, ms, xt, yt) - } - const nanosPerMilli = 1e6 if r.FormValue("x") != "" { x, _ := strconv.Atoi(r.FormValue("x")) @@ -336,13 +329,13 @@ func newGopherTilesHandler() http.Handler { fmt.Fprintf(w, "A grid of %d tiled images is below. Compare:

", xt*yt) for _, ms := range []int{0, 30, 200, 1000} { d := time.Duration(ms) * nanosPerMilli - fmt.Fprintf(w, "[HTTP/2, %v latency] [HTTP/2, %v latency with Server Push] [HTTP/1, %v latency]
\n", - httpsHost(), ms, d, + fmt.Fprintf(w, "[HTTP/2, %v latency] [HTTP/1, %v latency]
\n", httpsHost(), ms, d, httpHost(), ms, d, ) } io.WriteString(w, "

\n") + cacheBust := time.Now().UnixNano() for y := 0; y < yt; y++ { for x := 0; x < xt; x++ { fmt.Fprintf(w, "", @@ -363,21 +356,6 @@ function showtimes() { }) } -func pushTiles(w http.ResponseWriter, cacheBust int64, latency int, xt, yt int) { - pusher, ok := w.(http.Pusher) - if !ok { - return - } - for y := 0; y < yt; y++ { - for x := 0; x < xt; x++ { - img := fmt.Sprintf("/gophertiles?x=%d&y=%d&cachebust=%d&latency=%d", x, y, cacheBust, latency) - if err := pusher.Push(img, nil); err != nil { - log.Printf("Failed to push %v: %v", img, err) - } - } - } -} - func httpsHost() string { if *hostHTTPS != "" { return *hostHTTPS