[google-appengine] Re: Sharding counters
The safest bet for time and other things is to have another attribute [...] Correct, but do not rely on this attribute if you need _exact_ order of entities. From http://groups.google.com/group/google-appengine/browse_thread/thread/e263ed5bfc4f7efc : Clock sync is generally within seconds between our appservers. The other thread only has a second-hand account from a nameless source, but I have found they generally are well synced. If you see any instances of massive skew, let me know. That said, seconds may be a lot of skew depending on what your app is doing. It's best to instead rely on logical constructs (e.g. distributed counters, random ids) than time. Cheers, Jens On Apr 26, 8:14 pm, pran__ execute.c...@gmail.com wrote: The safest bet for time and other things is to have another attribute as datCreateDate = db.DateTimeProperty(auto_now_add = True) datModDate = db.DateTimeProperty(auto_now = True) While datCrateDate stores the creation date, datModDate stores the last modified date. Regards, Pranav P. On Apr 26, 9:14 pm, Jens Scheffler schefflerj...@gmail.com wrote: Does anybody know whether UNIX tme is the same on all google servers? I would not rely on that. What you could do is something similar as described here:http://blog.appenginefan.com/2009/04/efficient-global-counters-revisi... - add a second property (integer value) to your sharded model. The entity with the highest shard number is the last entity updated. - use memcache to remember the last id. Use the increment operation in memcache to increase the id whenever a new property is stored. - if the property gets evicted from memcache, find the right value from the datrastore and add it _conditionally_ back to memcache (to prevent race conditions) On Apr 26, 8:02 am, Ivan Maslov vanya@gmail.com wrote: I already have it in entity. But this entity is updated more than 5 times/second sometimes. THerefore I want to create sharders for it. See article about it: code.google.com/intl/ru/appengine/articles/sharding_counters.html . But I have a string property (not number) in entity. How can I know what sharder was last updated? I think to append UNIX time to property, e.g.: 'value1_1234567890', 'value2_1234567894', etc. Does anybody know whether UNIX tme is the same on all google servers? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Sharding counters
You can save it in your model ? (add a property ?) Or create a Kind for that ? On 25 avr, 22:03, vanya vanya@gmail.com wrote: Hi, everyone. I'm implemeting the sharding techniquehttp://code.google.com/intl/ru/appengine/articles/sharding_counters.html for my app. And my model has string and stringlist properties. How can I retrieve the last written value from shards? e.g , there was writing to datastore in following order: 'name_2' = 'value1' 'name_3' = 'value2' 'name_4' = 'value3' 'name_1' = 'value4' How can I retrieve the last value? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Sharding counters
I already have it in entity. But this entity is updated more than 5 times/second sometimes. THerefore I want to create sharders for it. See article about it: code.google.com/intl/ru/appengine/articles/sharding_counters.html . But I have a string property (not number) in entity. How can I know what sharder was last updated? I think to append UNIX time to property, e.g.: 'value1_1234567890', 'value2_1234567894', etc. Does anybody know whether UNIX tme is the same on all google servers? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Sharding counters
Does anybody know whether UNIX tme is the same on all google servers? I would not rely on that. What you could do is something similar as described here: http://blog.appenginefan.com/2009/04/efficient-global-counters-revisited.html - add a second property (integer value) to your sharded model. The entity with the highest shard number is the last entity updated. - use memcache to remember the last id. Use the increment operation in memcache to increase the id whenever a new property is stored. - if the property gets evicted from memcache, find the right value from the datrastore and add it _conditionally_ back to memcache (to prevent race conditions) On Apr 26, 8:02 am, Ivan Maslov vanya@gmail.com wrote: I already have it in entity. But this entity is updated more than 5 times/second sometimes. THerefore I want to create sharders for it. See article about it: code.google.com/intl/ru/appengine/articles/sharding_counters.html . But I have a string property (not number) in entity. How can I know what sharder was last updated? I think to append UNIX time to property, e.g.: 'value1_1234567890', 'value2_1234567894', etc. Does anybody know whether UNIX tme is the same on all google servers? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: Sharding counters
The safest bet for time and other things is to have another attribute as datCreateDate = db.DateTimeProperty(auto_now_add = True) datModDate = db.DateTimeProperty(auto_now = True) While datCrateDate stores the creation date, datModDate stores the last modified date. Regards, Pranav P. On Apr 26, 9:14 pm, Jens Scheffler schefflerj...@gmail.com wrote: Does anybody know whether UNIX tme is the same on all google servers? I would not rely on that. What you could do is something similar as described here:http://blog.appenginefan.com/2009/04/efficient-global-counters-revisi... - add a second property (integer value) to your sharded model. The entity with the highest shard number is the last entity updated. - use memcache to remember the last id. Use the increment operation in memcache to increase the id whenever a new property is stored. - if the property gets evicted from memcache, find the right value from the datrastore and add it _conditionally_ back to memcache (to prevent race conditions) On Apr 26, 8:02 am, Ivan Maslov vanya@gmail.com wrote: I already have it in entity. But this entity is updated more than 5 times/second sometimes. THerefore I want to create sharders for it. See article about it: code.google.com/intl/ru/appengine/articles/sharding_counters.html . But I have a string property (not number) in entity. How can I know what sharder was last updated? I think to append UNIX time to property, e.g.: 'value1_1234567890', 'value2_1234567894', etc. Does anybody know whether UNIX tme is the same on all google servers? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google App Engine group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---