Improve App Engine performance by reducing entity size

為{幸葍}努か 提交于 2019-12-03 00:27:01

To answer your questions in order:

  • Yes, splitting up your model will reduce the fetch time, though probably not linearly. For a relatively small model like yours, the differences may not be huge. Large list properties are the leading cause of increased fetch time.
  • Old properties will still be transferred when you fetch an entity after the change to the model, because the datastore has no knowledge of models.
  • Also, however, deleted properties will still be stored even once you call .put(). Currently, there's two ways to eliminate the old properties: Replace all the existing entities with new ones, or use the lower-level api.datastore interface, which is dict-like and makes it easy to delete keys.

To remove properties from an entity, you can change your Model to an Expando, and then use delattr. It's documented in the App Engine docs here:

http://code.google.com/intl/fr/appengine/articles/update_schema.html

Under the heading "Removing Deleted Properties from the Datastore"

if I want to reduce the size of my entities, is it necessary to migrate the old entities to ones with the new definition?

Yes. The GAE data store is just a big key-value store, that doesn't know anything about your model definitions. So the old values will be the old values until you put new values in!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!