Question

What happens when I try to send a message with Google App Engine's Channel API but from two or more goroutines and/or task queues? e.g.

go channel.Send(context, clientID, "Hello")
go channel.Send(context, clientID, "World")

I understand that in GAE Go, all goroutines are multiplexed onto a single thread. However this still allows for pre-emption during I/O, and presumably channel sends qualify as I/O.

The GAE dev server seems to serialize all requests so I don't see any channel sends overlapping. The production server seems to allow some request concurrency but the channel sends appear atomic or at least safe to call from different threads/goroutines.

Was it helpful?

Solution

In general, App Engine API calls are fine to call concurrently as long as they are not going to be writing to the same memory (e.g. two datastore.Get calls using the same destination struct is not safe).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top