Async Datastore?

327 views
Skip to first unread message

Fred Janon

unread,
Jun 26, 2014, 11:52:54 AM6/26/14
to google-ap...@googlegroups.com
Are we going to see an async version of the datastore for Go as in Java?

Thanks

Fred

Glenn Lewis

unread,
Jun 26, 2014, 12:14:42 PM6/26/14
to Fred Janon, google-appengine-go

One of the most beautiful things about Go in my opinion is that you can make anything asynchronous by placing the "go" keyword in front of a function call.

The other runtimes needed to add synchronous and asynchronous versions of all their APIs because their language did not easily support both.

So I believe that it is fair to say that you will never see asynchronous versions of any API for the Go programming language just because the language itself makes this a non-issue.

-- Glenn

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fred Janon

unread,
Jun 26, 2014, 6:57:43 PM6/26/14
to Glenn Lewis, google-appengine-go
But the go function has to complete the call to the datastore before returning, so it's not truly async as in sending the request over the wire to the SD and not waiting for the response. I still think that there is a difference between a sync and and async call.

David Byttow

unread,
Jun 26, 2014, 7:05:46 PM6/26/14
to Fred Janon, Glenn Lewis, google-appengine-go
Not really. That assumes some magic is going on behind the scenes on the client to allow for go-routines to escape the request context while the client sends the data up to the server and bails. Which is quite weird.

The Java async API is just a non-blocking API, which uses the thread pool under the hood to manage. And in Java, threads still must finish before the request ends, so in the end it's just a convenience which you can write yourself.

Glenn Lewis

unread,
Jun 26, 2014, 7:06:06 PM6/26/14
to Fred Janon, google-appengine-go
Check out this excellent talk by Dave Symonds on high-performance App Engine apps written in Go.
He has an example of setting up a channel, firing off an asynchronous Datastore operation, and then later blocking until it is completed before returning from the handler.

-- Glenn


On Thu, Jun 26, 2014 at 3:57 PM, Fred Janon <fja...@gmail.com> wrote:

Fred Janon

unread,
Jun 27, 2014, 4:41:56 AM6/27/14
to google-ap...@googlegroups.com, fja...@gmail.com
Thanks, my point is: I don't want to "blocking until it is completed before returning from the handler".

In Java, I allocate a new ID, set up the write op, send it off to the DS and return immediately from the request handler. Later on, the client can check on the data written if necessary.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.

Mark Mandel

unread,
Jun 27, 2014, 7:33:50 AM6/27/14
to Fred Janon, google-appengine-go

Dumb question, but why not just use a queue or the delay package?

Sent from my mobile doohickey

To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.

David Symonds

unread,
Jun 27, 2014, 8:28:28 AM6/27/14
to Fred Janon, google-appengine-go
On 27 June 2014 18:41, Fred Janon <fja...@gmail.com> wrote:

> Thanks, my point is: I don't want to "blocking until it is completed before
> returning from the handler".
>
> In Java, I allocate a new ID, set up the write op, send it off to the DS and
> return immediately from the request handler. Later on, the client can check
> on the data written if necessary.

In Java, either the App Engine library is doing the blocking for you,
or your RPCs are at risk of being canceled. That is how the App Engine
serving infrastructure works, independent of runtime: when the HTTP
handler finishes, the appserver cancels any outstanding API RPCs and
then returns the HTTP response.

Paul Jolly

unread,
Jun 27, 2014, 8:31:11 AM6/27/14
to Fred Janon, google-ap...@googlegroups.com
Push task queues will probably be what you're after:

https://developers.google.com/appengine/docs/go/taskqueue/


To unsubscribe from this group and stop receiving emails from it, send an email to google-appengin...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Fred Janon

unread,
Jun 29, 2014, 11:07:34 AM6/29/14
to google-ap...@googlegroups.com, fja...@gmail.com
Thanks, I am aware of task queues. My question still stands to avoid overcomplexity and why GAE Go would not support async ops on datastore and the other services that are already async in Java. Async programming has been promoted in GAE for a while, but seems to be limited in Go. Concurrency is not multi tasking with async ops.


On Friday, June 27, 2014 2:31:11 PM UTC+2, Paul Jolly wrote:
Push task queues will probably be what you're after:

https://developers.google.com/appengine/docs/go/taskqueue/
On 27 June 2014 09:41, Fred Janon <fja...@gmail.com> wrote:
Thanks, my point is: I don't want to "blocking until it is completed before returning from the handler".

In Java, I allocate a new ID, set up the write op, send it off to the DS and return immediately from the request handler. Later on, the client can check on the data written if necessary.


On Friday, June 27, 2014 1:06:06 AM UTC+2, Glenn Lewis wrote:
Check out this excellent talk by Dave Symonds on high-performance App Engine apps written in Go.
He has an example of setting up a channel, firing off an asynchronous Datastore operation, and then later blocking until it is completed before returning from the handler.

-- Glenn
On Thu, Jun 26, 2014 at 3:57 PM, Fred Janon <fja...@gmail.com> wrote:
But the go function has to complete the call to the datastore before returning, so it's not truly async as in sending the request over the wire to the SD and not waiting for the response. I still think that there is a difference between a sync and and async call.

On Thu, Jun 26, 2014 at 6:14 PM, Glenn Lewis <gml...@google.com> wrote:

One of the most beautiful things about Go in my opinion is that you can make anything asynchronous by placing the "go" keyword in front of a function call.

The other runtimes needed to add synchronous and asynchronous versions of all their APIs because their language did not easily support both.

So I believe that it is fair to say that you will never see asynchronous versions of any API for the Go programming language just because the language itself makes this a non-issue.

-- Glenn

On Jun 26, 2014 8:52 AM, "Fred Janon" <fja...@gmail.com> wrote:
Are we going to see an async version of the datastore for Go as in Java?

Thanks

Fred

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsubscribe...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "google-appengine-go" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine-go+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Symonds

unread,
Jun 29, 2014, 8:01:55 PM6/29/14
to Fred Janon, google-appengine-go
On 30 June 2014 01:07, Fred Janon <fja...@gmail.com> wrote:

> Thanks, I am aware of task queues. My question still stands to avoid
> overcomplexity and why GAE Go would not support async ops on datastore and
> the other services that are already async in Java.

It does; it just uses the Go language primitives instead of forking the API.

> Async programming has
> been promoted in GAE for a while, but seems to be limited in Go. Concurrency
> is not multi tasking with async ops.

It is not limited in Go. Did you read my mail?
Reply all
Reply to author
Forward
0 new messages