Goroutine on Google App Engine

23 April 2016

Profile

2

App Engine Architecture

3

Performance importance

4

Goroutine

By Renée French

5

Sync (code)

var entries []Entry
var comments []Comment
var friends []Friend
var footprint []Footprint
_, err := datastore.NewQuery("Entry").GetAll(ctx, &entries)
_, err = datastore.NewQuery("Comment").GetAll(ctx, &comments)
_, err = datastore.NewQuery("Friend").GetAll(ctx, &friends)
_, err = datastore.NewQuery("Footprint").GetAll(ctx, &footprint)
6

Sync (trace)

7

Async (code)

var entries []Entry
var comments []Comment
var friends []Friend
var footprint []Footprint
errc := make(chan error)
go func() {
    _, err := datastore.NewQuery("Entry").GetAll(ctx, &entries)
    errc <- err
}()
go func() {
    _, err := datastore.NewQuery("Comment").GetAll(ctx, &comments)
    errc <- err
}()
go func() {
    _, err := datastore.NewQuery("Friend").GetAll(ctx, &friends)
    errc <- err
}()
go func() {
    _, err := datastore.NewQuery("Footprint").GetAll(ctx, &footprint)
    errc <- err
}()
err1, err2, err3, err4 := <-errc, <-errc, <-errc, <-errc
8

Async (trace)

9

Advertise

10

Resource

11

Thank you

TOPGATE GAEマイスター

Use the left and right arrow keys or click the left and right edges of the page to navigate between slides.
(Press 'H' or navigate to hide this message.)