java - Limit of 1 write per sec per a Single Entity Group

139 views
Skip to first unread message

Azeem Haider

unread,
Nov 13, 2017, 8:43:03 AM11/13/17
to Google App Engine

I'm using Java. I have simple scenario here. There are Four kinds 1-user, 2-post, 3-comment, 4-like

Ancestor relation is used like this.


 user---->post---->comment
           -
           ------->Like    


User is parent of post and grand parent of comment and likes. Post is parent of comment and like.

In my app mostly I need posts with recent 3 comments. And when user click on comment button then get all comments of that post and same for likes. Something like Facebook and Instagram. I think for this situation above structure(relation) is useful, isn't it ?

But problem is that As described in documentations maximum operation rate of 1/s. If you increase from this operation there may be an Error.


There is a write throughput limit of about one transaction per second within a single entity group. This limitation exists because Cloud Datastore performs masterless, synchronous replication of each entity group over a wide geographic area to provide high reliability and fault tolerance. Documention

Avoid writing to an entity group more than once per second. Writing at a sustained rate above that limit makes eventually consistent reads more eventual, leads to time outs for strongly consistent reads, and results in slower overall performance of your application. A batch or transactional write to an entity group counts as only a single write against this limit.Documention

There is a quite possible there is more than one like or comment in one sec. So what I do in this case.

Any suggestion how can I overcome this situation or any other better structure ?


I found one thing for counts to use shared count, Ok it's fine for likes but what about others ?


One other thing If entity has no ancestor Entity group write limit apply on it or not ? Because as described in documentation if entity has no parent or child it's own entity group. I think write limit also apply on single entity, Right ?  Actually I have one entity which is updated by multiple users so it's possible there are many updates in one sec. what I do for it ? 

Azeem Haider

unread,
Nov 13, 2017, 8:43:03 AM11/13/17
to Google App Engine

Kenworth (Google Cloud Platform)

unread,
Nov 13, 2017, 3:54:54 PM11/13/17
to google-a...@googlegroups.com
I can see that you already asked the same scenario and questions on this thread. I highly recommend reviewing my colleague's answer (Jordan) on his November 8 post.


One other thing If entity has no ancestor Entity group write limit apply on it or not?

Write limit applies because a root entity (and all of its descendants) is considered as one entity group. 

Because as described in documentation if entity has no parent or child it's own entity group. I think write limit also apply on single entity, Right ? 

Correct. 

Actually I have one entity which is updated by multiple users so it's possible there are many updates in one sec. what I do for it?

Use exponential backoff. See full answer here  


Based on the above, I highly encourage you to submit a feature request as described in this article so that proper attention will be given to it. You can use this thread as a background to the request. 


Reply all
Reply to author
Forward
0 new messages