, , , , , , , , ,

  • Google Data Store provides single core CPU  (F class) for applications.
  • Hence heavily multi-threaded applications can’t scale enough
  • DataStoreprovidesasync calls for DB access. It has:
    • Async queries
    • Async transactions
    • Async read/writes
  • Documentation is good but lacks clarity on usage and benefits on async calls. It says that async queries can run in parallel after immediately returning a temporary result object. But how?
  • I think Data Store can time share multiple requests, hence improving responsiveness and fairness.
  • How to convert sync calls to async:
  • Please refer Source: Google Developer website
    • I got confused at async queries. It uses run() menthod on a query to make it async. A get() method is a sync call.
    • Difference between run() and get() is that:
      • run() returns an iterator over results
      • run() pre-fetches results with a batch read, so access to elements in results is faster
      • get() is a sync call and returns the first result from result set
      • run(limit=1) == get()


q1 = Salesperson.all().filter('date_of_hire <', one_month_ago)
# Returns instantly, query is executing in the background.
recent_hires = q1.run()

# q1 and recent_hires are both iterable objects. Your application should iterate over 'recent_hires' to enjoy benefits of pre-fetched reads.
##### for h in recent_hires:
# instead of
##### for h in q1: