简体   繁体   English

应用引擎事务

[英]AppEngine transactions

I have to add to a PropertyList a value for 50 entities.我必须向 PropertyList 添加 50 个实体的值。 I have to make sure that no other code changes the PropertyList in the same time for particular entity.我必须确保没有其他代码同时更改特定实体的 PropertyList。 Is it better to have one big transaction changing all 50 entities or 50 small ones changing only one entity?一笔大交易改变所有 50 个实体还是 50 个小交易只改变一个实体更好?

If you need exactly what your post says (updates to many entities, and transaction safety only on each entity), then you can use many small transactions.如果您确实需要您的帖子所说的内容(更新许多实体,并且仅在每个实体上进行交易安全),那么您可以使用许多小交易。

If you must guarantee that none of the many entities is changed during this period, you should use one transaction, with all of your entities in the same entity group.如果您必须保证在此期间许多实体中的任何一个都没有更改,您应该使用一个事务,将所有实体都放在同一实体组中。 Beware that the recommended update limit to entity groups is once per second.请注意,建议的实体组更新限制为每秒一次。 If you really have to update 50 entities transactionally, and you cannot for some reason put them into the same entity group, you should consider reorganizing your data.如果您确实需要更新 50 个实体的事务,并且由于某种原因您不能将它们放入同一个实体组中,那么您应该考虑重新组织您的数据。

this requirements most likely implies that you might want to reconsider your design.此要求很可能意味着您可能想要重新考虑您的设计。

currently you are solving the 'how to implement this' question.目前你正在解决“如何实现这个”的问题。

perhaps you want to share your original problem so there can be a better solution to the question of 'this is how it should work'也许您想分享您的原始问题,以便可以更好地解决“这就是它应该如何工作”的问题

looking forward.期待。

-J -J

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

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