假设我想读取以下对象结构,并希望尽可能并行化读取:
root_object --> ShardCounter
|
-> SubObject1 (1..N)
|
-> SubObject2 (1..N) --> ShardCounter
|
-> SubObject3 (1..N)
1) 与 memcache 和/或存储交互以从 tasklet 中获取 ShardCounters 是否有意义?据我所知,memcache 没有 get_async
,所以我有点不确定这是否能很好地并行化?
2) 在为 SubObject2
生成结果的 tasklet 中,我会使用 iter.has_next_async()
模式还是调用 fecth_async()。 map(...)
来检索 SubObject3
,或者完全不同的东西(例如,另一个 tasklet)?
感谢您的指点。
最佳答案
NDB 确实在 Context 对象上有自动批处理异步内存缓存 api。参见 https://developers.google.com/appengine/docs/python/ndb/contextclass .
关于python - 将 ndb.Tasklets 与 memcache 读取相结合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9978981/