What exactly is the throughput restriction on an e

2019-06-16 09:06发布

The documentation describes a limitation on the throughput to an entity group in the datastore, but is vague on what exactly the limitation is. My confusion is in two parts:

1. What is being restricted?

Specifically, is it:

  1. The number of writes?
  2. Number of transactions that write to the datastore?
  3. Number of transactions regardless of whether it reads or writes to the datastore?

2. What is the type of the restriction?

Specifically, is it:

  1. An artificially enforced one-per-second hard rule?
  2. An empirically observed max throughput, that may in practice be better based on factors like network load, etc.?

3条回答
淡お忘
2楼-- · 2019-06-16 09:42

There's no throughput restriction per se, but to guarantee atomicity in transactions, updates must be serialized and applied sequentially and in order, so if you make enough of them things will start to fail/timeout. This is called datastore contention:

Datastore contention occurs when a single entity or entity group is updated too rapidly. The datastore will queue concurrent requests to wait their turn. Requests waiting in the queue past the timeout period will throw a concurrency exception. If you're expecting to update a single entity or write to an entity group more than several times per second, it's best to re-work your design early-on to avoid possible contention once your application is deployed.

To directly answer your question in simple terms, it's specifically the number of writes per entity group (5/ish per second), and it's just a rule of thumb, your milage may vary (greatly).

Some people have reported no contention at all, while others have problems to get more than 1 update per second. As you can imagine this depends on the complexity of the operation and the load of all the machines involved in execution.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-06-16 09:46

Limits:

  • writes per second to an entity group
  • entity groups per cross-entity-group transaction (XG transaction)

There is a limit of 1 write per second per entity group. This is a documented limit that in practice appears to be a 'soft' limit, as in it is possible to exceed it, but not guaranteed to be allowed. Transactions 'block' if the entity had been written to in the last second, however the API allows for transient exceptions to occur as well. Obviously you would be susceptible to timeouts as well.

This does not affect the overall number of transactions for your app, just specifically related to that entity group. If you need to, you can design portions of your data model to get around this limitation.

There is a limit of 25 entity groups per XG transaction, meaning a transaction can not incorporate more than 25 entity groups in its context (reads, writes etc). This used to be a limit of 5 but was recently increased.

So to answer your direct questions:

  1. Writes for the entire entity group (as defined by the root key) within a second window (which is not strict)

  2. artificially enforced one-per-second soft rule

查看更多
Fickle 薄情
4楼-- · 2019-06-16 09:54

If you ask that question, then the Google DataStore is probably not for you.

The Google DataStore is an experimental database, where the API can be changed any time - it is also ment for retail apps, non-critical applications.

A clear indication you meet when you signup for the DataStore, something like no responsibility to backwards compatibility etc. Another indication is the lack of clear examples, the lack of wrappers providing a simple API to implement an access to the DataStore - and the examples on the net being a soup of complicated installations and procedures to make a simple query.

My own conclusion so far after days of research, is Google DataStore is not ready for commercial use, but looks promising once it is finished and in a stable release version.

When you search the net, and look at the few Google examples, if there at all are any - it is about to notice whats not mentioned rather than what is mentioned - which is about nothing is mentioned by Google ..... ;-) If you look at the vendors "supporting" Google DataStore, they simply link to the Google DataStore site for further information, which mention nothing, so you are in a ring where nothing concrete is mentioned ....

查看更多
登录 后发表回答