Performance degrades x3 after first request (GAE Standard)

69 views
Skip to first unread message

Pablo Rozas Larraondo

unread,
Apr 23, 2018, 7:10:35 AM4/23/18
to google-appengine-go
Hi,

I'm doing some tests with the Go Appengine standard and I've come across some cases where some moderately CPU intensive operations take excessively long to run in the GAE, after the first request is made.

I've simplified my handler code to contain just a loop like this:

func handle_loop(w http.ResponseWriter, r *http.Request) {
        start := time.Now()
        a := float64(3.343423)
        var b float64
        for i := 0; i < 2000000000; i++ {
                b = a * float64(i)
        }
        w.Header().Set("Content-Type", "text/plain")
        fmt.Fprintln(w, b, time.Since(start))
}

This loop takes around 1.25 seconds on my local computer. Once deployed to GAE, the first request reports 1.75 seconds, which is normal. Surprisingly, every subsequent request reports times in the order of 4.5 seconds.

Looking at the Stackdriver logging, the first request has an exclamation mark saying: This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application. Which is the opposite to what I'm experiencing.

Does anyone have an idea of what might be going on here? Also any ideas on how I could find more details about this effect are greatly appreciated.

Thanks for your help,
Pablo

Reply all
Reply to author
Forward
0 new messages