2

Do you know which is the safest Queries Per Second rate in update on a single entity without incurring in write contention?
Reading this document about sharding it clearly says:

it is important to note that you can only expect to update any single entity or entity group about five times a second. That is an estimate and the actual update rate for an entity is dependent on several attributes of the entity, including how many properties it has, how large it is, and how many indexes need updating.

I'm having timeout problem even with one update per second and a comment in this answer has baffled me:

You can still get write contention on individual entities if you're doing more than about 1QPS of modifications to them

Am I missing something?
How could my GAE app scale if I can't even update a single entity per second without incurring in Timeout errors?

Community
  • 1
  • 1
systempuntoout
  • 71,966
  • 47
  • 171
  • 241
  • I don't know if 5 updates per second or 1 update per second is the safe number. But in either case, that rate is for 1 entity, not your entire app. So you app can still scale just fine - you could have a hundred different entities being updated per second, serving a hundred different users. App Engine is focused on serving web apps, which generally need to scale horizontally, not vertically. – Peter Recore Jan 21 '11 at 18:47
  • @Peter fair enough, I still don't get how could is possible to get a timeout updating an entity 1 time per second though. – systempuntoout Jan 21 '11 at 19:04
  • 1
    if you don't get an answer here you could try asking at the next IRC chat. – Peter Recore Jan 21 '11 at 23:16
  • Did the 1 QPS figure come from an article referencing the new high replication datastore ? writes supposedly take longer on that system. – Peter Recore Feb 15 '11 at 21:52

1 Answers1

4

The reason for the variance is because this isn't a hard limit. If you do 1 QPS of updates to an entity group, you probably won't notice any significant increase in timeouts or latency at all. If you do 5 QPS, you'll probably see an increased rate of timeouts, and noticeably higher latency. Beyond that, contention issues will get worse.

Generally, I think of 1 QPS as the design goal to build around, to give a reasonable margin of error for spikes.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
  • thanks, I think you (Google) should update that sharding article to a more correct 1 QPS. As said in the other question, I have tuned the rate of the task queue that updates the single entity to 1 task per second; I'm still getting some few Timeout errors. Could the high number of reads on the entity increase the possibility of Timeouts even if the entity is updated just 1 time per second? – systempuntoout Jan 24 '11 at 08:42
  • Reads won't increase timeouts; some low number of timeouts are expected at any level of writes, though. About what percentage of writes do you see timeouts on? – Nick Johnson Jan 24 '11 at 23:37
  • *some low number of timeouts are expected at any level of writes* that explains everything. I'm having from 1 to 5 timeouts everyday but with a number of writes > 2000 so it's a tiny tiny percentage. I simply thought that lowering the rate to 1 task per second in updates would allowed me to keep the logs clean; thanks for your clarification. – systempuntoout Jan 27 '11 at 08:16