简体   繁体   English

何时从数据存储过渡到NDB?

[英]When to transition from Datastore to NDB?

From what I have heard, it is better to move to NDB from Datastore. 据我所知,最好从Datastore迁移到NDB。 I would be doing that eventually since I hope my website will be performance intensive. 最终我会这样做,因为我希望我的网站能提高性能。 The question is when. 问题是何时。 My project is in its early stages. 我的项目尚处于初期阶段。

Is it better to start in NDB itself? 从NDB本身开始更好吗? Does NDB take care of Memcache also. NDB是否也照顾Memcache。 So I don't need to have an explict Memcache layer? 因此,我不需要显式的Memcache层?

NDB provides an automated caching mechanism. NDB提供了一种自动缓存机制。 See Caching : 请参阅缓存

NDB automatically caches data that it writes or reads (unless an application configures it not to). NDB自动缓存其写入或读取的数据(除非应用程序配置为不写入)。 Reading from cache is faster than reading from the Datastore. 从缓存读取比从数据存储读取更快。

Probably the automatic caching does what you want. 自动缓存可能满足您的需求。 The rest of this page provides more detailed information in case you want to know more or to control some parts of the caching behavior. 如果您想了解更多信息或控制某些部分的缓存行为,本页面的其余部分将提供更详细的信息。

As the documentation says, the default behavior probably does what you want, but you can tweak it if that's not the case. 如文档所述,默认行为可能会满足您的要求,但是如果不是这种情况,您可以对其进行调整。 Adding your own memcache layer for the datastore shouldn't be required if you're using NDB. 如果您使用的是NDB,则不需要为数据存储添加自己的内存缓存层。

As for when to migrate, sooner is probably better. 至于何时迁移,越早越好。 The longer you wait the more code you have to rewrite to take advantage of the freebies you get with NDB. 您等待的时间越长,就必须重写越多的代码才能利用NDB获得的免费赠品。 For new projects, I would recommend starting with NDB. 对于新项目,我建议从NDB开始。

To add to Dan's correct answer, remember ndb and the older db are just APIs so you can seamlessly begin switching to ndb without worrying about schema changes etc.. You're question asks about switching from datastore to NDB, but you're not switching from the datastore as NDB still uses the datastore. 为了补充Dan的正确答案,请记住,ndb和较早的db只是API,因此您可以无缝地开始切换到ndb,而不必担心架构更改等。您可能会询问从数据存储区切换到NDB的问题,但您没有NDB仍在使用该数据存储区,因此无法从该数据存储区中访问。 Make sense? 说得通?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM