如何在 Google App Engine 上扩展大量记录
我正在考虑编写一个应用程序,该应用程序必须为每个用户存储少量记录(<300),但希望能够拥有大量用户(>>1000)。 我对一个平台进行了一些研究,该平台允许在需要时从小规模开始并进行扩展,但我被 App Engine 困住了,但我不确定它是否是合适的工具,尤其是数据存储区。
如果我有一个用户实体和一个消息实体并将所有用户和消息存储在该实体中,我将如何使其扩展?我认为实体中的记录数量将变得非常大,并且过滤(即用户的所有消息)将变得昂贵。这是一个问题吗?谷歌会处理这个问题吗?我是否必须引入多租户并为每个用户创建一个命名空间,以便我只能看到与该用户相关的实体中的记录?命名空间的数量有限制吗?对数据存储中的数据进行建模的正确方法是什么?
我真的不知道如何处理 App Engine 数据存储以及它是否适合我。
I´m thinking about to write an application will have to store a small amount of records per user (<300) but hopefully will have a lot of users (>>1000).
I did some research for a platform that allows starting small and scale if there is a need to do so and got stuck with App Engine, but I´m not sure if it is the right tool for it, especially the datastore.
How will I get it to scale if I have a User entity and a Message entity and store all users and messages in that entities? I think the amount of records in the entities will grow really big and filtering i.e. for all messages of a user will get expensive. Is that a problem or will Google handle that ? Do I have to introduce multitenancy and create a namespace for each user so I only see the records in the entities that relates to the user? Is there a limit for the number of namespaces ? What would be the right approach for modeling the data in the datastore?
I do not really have a clue how to handle the App Engine datastore and if its the right tool for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
App Engine 数据存储区专门设计用于处理这种可扩展性。查询的执行时间与返回的记录数成正比,因此无论系统中有多少用户,获取所有用户的消息都将花费相同的时间。
The App Engine datastore is explicitly designed to handle this kind of scalability. Queries execute in time proportional to the number of records returned, so fetching all a user's messages will take the same time regardless of how many users there are in the system.
我认为有了这些数字,您在可扩展性方面可能就可以了。任何重要的数据存储都可以轻松处理 300,000 到数百万条记录。
I think with those kind of numbers you are probably ok in terms of scalability. anywhere from 300,000 to millions of records is easily handled by any serious datastore.
在项目的起步阶段考虑扩展是不可取的。您的第一步应该始终是构建应用程序/产品并启动它...扩展是后话当今推出的大多数应用程序/产品从未使它达到了他们需要扩展的水平..即使你确实制作或启动了这样一个网站/产品/应用程序,受到大量流量的打击并且你需要扩展,那么欢欣鼓舞!因为你已经达到了那个水平..但是如何达到那个水平应该永远是第一个问题...
我并不是想让你士气低落,而是试图帮助你专注于你应该做的事情..感谢您的阅读,祝您的应用程序好运!也许您确实需要扩展,正如 Toby 所说,即使是最基本的 App Engine 配置也足以处理数十万条记录......
It is not advisable to think of scaling during the infancy of your project.. Your first step should always be to build an app/product and launch it... Scaling comes afterwords Most of the app/products that are launched these days never make it to the level where they need to scale.. even if you do make or launch such a website/product/app that gets hit by large amount of traffic and you need to scale, then rejoice!!! because you've made it to that level.. But how to get to that level should always be the first question...
I'm not trying to de-moralise you, rather trying to help you focus where you should be... Thanks for reading and good luck with your App! May you do need to scale and as Toby said, even the most basic App Engine configuration is good enough to handle a couple of hundred thousands of records...