I.Tyger
I.Tyger

Reputation: 805

Task queues and Datastore read and writes

I am using Objectify in my google cloud endpoints module , My endpoint project handles most of my datastore read and write ops , but i wanted to know if it is an efficient design practice to use Task queues to wrap a read or write operation on the datastore in google app engine .

Upvotes: 0

Views: 248

Answers (2)

Dmytro Sadovnychyi
Dmytro Sadovnychyi

Reputation: 6201

Consider to use write-behind-cache if you want to speed up your writes. There's a little chance that you will lose your data, but you will dramatically speed up the write speed (as seen by user).

The idea is to write entity only into memcache first, so user will not wait for actual datastore write, and then pick up that memcached entity by task queue/cron and write it into datastore.

Upvotes: 0

Andrei Volgin
Andrei Volgin

Reputation: 41089

All the data necessary for a task execution has to be written somewhere, and the App Engine persists this data in a task queue backed by the same Datastore. Unless your write operation involves number crunching, URL fetching, external API calls, updates of hundreds on entities, or some other expensive logic, there is no advantage to wrapping a write call in a task.

Wrapping read calls in tasks is impossible in most cases as you lose an ability to return this data in the same call.

Upvotes: 3

Related Questions