简体   繁体   English

Objectify-AppEngine替代

[英]Objectify - AppEngine Alternatives

we have a very big app off objectify but we are finding lot of issues with the underlying platform. 我们在objectify之外有一个很大的应用程序,但是我们发现底层平台存在很多问题。 Eg: inequality filters more than 1 cannot be used, sorting based on custom data (end user variables) are two very big pains. 例如:不能使用大于1的不等式过滤器,基于自定义数据(最终用户变量)的排序是两个很大的难题。 Ours is a vertical CRM. 我们的是垂直CRM。

Since we are using objectify, is there a way to move to a different cloud platform without lot of pain? 既然我们使用的是objectify,是否有办法轻松迁移到其他云平台?

We are ok to restructure some of the application for it but what would you recommend us to move to assuming that AppEngine is not working out? 我们可以为此重组一些应用程序,但是您建议我们在假设AppEngine无法正常工作的情况下采取什么行动呢? Does objectify work or can be made to work for other platforms easily? 客观化工作还是可以轻松地使其适用于其他平台?

Thanks. 谢谢。

MongoDB's Morphia interface was originally based off of an early version of Objectify. MongoDB的Morphia界面最初基于Objectify的早期版本。 As key/value stores go, MongoDB will seem fairly familiar to GAE users. 随着键/值存储的发展,GAE用户似乎对MongoDB相当熟悉。 If you're looking for a low-pain transition, this is probably the best option. 如果您正在寻找低痛苦的过渡,这可能是最好的选择。

Note that some things (like ad-hoc and less-than-optimal queries) are easier with MongoDB, but some things (like transactions) are harder. 请注意,使用MongoDB可以轻松完成某些事情(例如临时查询和次优查询),但是更困难一些。 And of course make sure that it fits your scaling requirements. 当然,请确保它符合您的缩放要求。

If you're staying on App Engine, the Java Datastore API page suggests Slim3 , also the low-level Datastore API, along with Objectify. 如果您仍在使用App Engine,则Java Datastore API页面会建议Slim3 (也是低级Datastore API)以及Objectify。

It also mentions JDO and JPA, but the reason to use those is compatibility with other implementations of the same interfaces, and these are subset implementations so the compatibility is limited. 它还提到了JDO和JPA,但是使用它们的原因是与相同接口的其他实现兼容,并且它们是子集实现,因此兼容性受到限制。

The Storing Data in Java page lists other choices Google Cloud SQL and Google Cloud Storage . 在Java中存储数据”页面列出了其他选择Google Cloud SQLGoogle Cloud Storage These will require bigger changes to your code. 这些将需要对代码进行更大的更改。

One inequality filter is an App Engine's limitation, not Objectify's. 一个不平等过滤条件是App Engine的限制,而不是Objectify的限制。 It was never a problem for us, and we have a very large and complex application with close to 100 entity kinds. 对于我们而言,这从来都不是问题,我们拥有一个非常大而复杂的应用程序,其中包含近100种实体。 There are many tips across SO on how to work around this limitation. SO上有很多技巧来解决该限制。

I have no idea why you have a problem with sorting data. 我不知道为什么您在排序数据时遇到问题。 As long as it is indexed, you can sort based on any criteria - user-generated or not. 只要建立索引,您就可以根据任何条件(无论用户生成与否)进行排序。 Maybe you can elaborate on this, and we can help with a solution. 也许您可以对此进行详细说明,我们可以为您提供解决方案。

App Engine is a very different platform, and it may take time for folks who are used to only relational databases to learn and appreciate its power. App Engine是一个非常不同的平台,习惯于仅使用关系数据库的人们可能需要一些时间来学习和欣赏其功能。 What you see as limitations are actually features - one inequality filter, for example, allows for very fast (and consistent) query times regardless of the number of entities. 您所看到的限制实际上是功能-例如,一个不等式过滤器允许非常快(且一致)的查询时间,而与实体的数量无关。 I would even state that the larger the application, the more it will benefit from using a non-relational (App Engine) Datastore. 我什至要声明,应用程序越大,使用非关系(App Engine)数据存储区将受益越多。

It will probably take you less time to learn how to use App Engine than to move to an entirely different platform. 与使用完全不同的平台相比,学习如何使用App Engine的时间可能会更少。

UPDATE: 更新:

I would suggest the following approach to your plant question (based on a very limited information I have about your data model and usage patterns). 对于您的工厂问题,我建议采用以下方法(基于我所掌握的有关您的数据模型和使用模式的非常有限的信息)。

  1. If users can add any number of custom properties to an object, the ultimately flexible solution is to store all of them as unindexed properties in the datastore. 如果用户可以向对象添加任意数量的自定义属性,则最终的灵活解决方案是将所有这些自定义属性存储为数据存储中的未索引属性。 Then when a user initiates a query, you retrieve all entities of a given kind and filter them in your code as opposed to relying on Datastore indexes. 然后,当用户启动查询时,您检索给定类型的所有实体,并在代码中过滤它们,而不是依赖于数据存储区索引。 It may seem like an inefficient approach, but it is dramatically cheaper to add and retrieve entities with few indexed properties than entities with many indexed properties. 看来这是一种低效的方法,但是添加和检索索引属性很少的实体比索引属性很多的实体便宜得多。 Overall, your total costs may end up being lower even though you over-read on each custom query, unless your users add >10k entities of the same kind. 总体而言,即使您对每个自定义查询都进行了超额阅读,您的总成本也可能最终更低,除非您的用户添加了超过1万个相同类型的实体。 You can even estimate this in advance as the Datastore shows the number of write operations on each entity in the Datastore viewer. 您甚至可以预先估计这一点,因为数据存储区会在数据存储区查看器中显示每个实体上的写入操作数。

If you have a number of standard (non-user generated) indexed properties on these entities, you can further optimize this by splitting each entity into a standard part (eg "Plant") and custom part ("Plant_custom") with end-user generated properties. 如果这些实体上有许多标准的(非用户生成的)索引属性,则可以通过将每个实体分为最终用户的标准部分(例如“ Plant”)和自定义部分(“ Plant_custom”)来进一步优化此属性生成的属性。 This way an update to the custom part will be much cheaper as it won't trigger index re-writes on standard properties. 这样,对自定义部件的更新将便宜得多,因为它不会触发标准属性的索引重写。 Then, if a query involves standard properties, you retrieve a list of entities that match search criteria on standard properties using a cheap keys-only query, then retrieve custom entities using a cheap get operation (standard and custom entities should have the same ID), and finally filter based on custom search criteria. 然后,如果查询涉及标准属性,则使用便宜的仅键查询来检索与标准属性上的搜索条件匹配的实体的列表,然后使用便宜的get操作检索自定义实体(标准和自定义实体应具有相同的ID) ,最后根据自定义搜索条件进行过滤。

  1. A totally different solution is to use App Engine Search API for your custom properties. 完全不同的解决方案是对您的自定义属性使用App Engine搜索API It is much more flexible that the Datastore, but you need to compare costs. 数据存储区要灵活得多,但是您需要比较成本。 Still, it may be a cheaper solution than indexing every custom property in the Datastore. 不过,与索引数据存储区中的每个自定义属性相比,它可能是一种更便宜的解决方案。

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

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