A local count can be unique across URL requests that happen to hit the
same process, but it can't be unique across processes.  In that, a
local count is like time.

A datastore counter eliminates the dangling object problem because a
single counter can be used to manage an arbitrarily large number of
entity group types (when combined with time), but its update (once for
every process that needs to generate unique names) is a bottleneck.
Of course, that bottleneck can be addressed with multiple counters (so
the count is actually a count/counter-name pair), reducing the problem
to one of uniquely naming the counters, but that's easily solvable.
(Figuring out when there's sufficient congestion to justify creating a
new counter is a little tricky but it's good enough to create "more
than enough" counters.)

Thanks.

On Dec 9, 10:01 am, yejun <[EMAIL PROTECTED]> wrote:
> You don't have to use global data entity. For example use a datastore
> backed global count as base number.
> Your unique id can be generated by that count multiply by a big number
> + a local count.
>
> On Dec 9, 11:57 am, Andy Freeman <[EMAIL PROTECTED]> wrote:
>
>
>
> > > The later
> > > solution only requires one put during any given processes lifetime so
> > > it shouldn't be a perf problem.
>
> > It introduces a clean-up problem.   I can't delete such an object
> > until after I delete all entity groups named using said object's key.
> > (GAE is free to reused generated keys.)
>
> > I shouldn't have mentioned the overhead of puts.  The real problem is
> > cleanup and consistency, a problem that transactions are designed to
> > solve.
>
> > On Nov 24, 7:18 pm, Josh Heitzman <[EMAIL PROTECTED]> wrote:
>
> > > Like Jon McAlister said either use a random number or create a new
> > > entity when one of your modules is loaded and treat that entity's key
> > > as the globally unique process ID (i.e. MAC address + pid).  The later
> > > solution only requires one put during any given processes lifetime so
> > > it shouldn't be a perf problem.
>
> > > On Nov 22, 6:38 pm, Andy Freeman <[EMAIL PROTECTED]> wrote:
>
> > > > > Yes, I understand transactions and entity groups. Why do you need to
> > > > > create an entity group *atomically*?
>
> > > > For the same reason that transactions are useful - incomplete groups
> > > > are wrong (in my application) and I'd rather not deal with them.
>
> > > > > If you create a new entity, it will automatically be assigned a unique
> > > > > key at the datastore level. What's wrong with just using that?
>
> > > > Each db.put has significant overhead.  If I can generate a unique name
> > > > without a db.put, I can reduce the number of db.puts that my
> > > > application does by a factor of 2.
>
> > > > On Nov 22, 5:07 pm, "David Symonds" <[EMAIL PROTECTED]> wrote:
>
> > > > > On Sun, Nov 23, 2008 at 8:50 AM, Andy Freeman <[EMAIL PROTECTED]> 
> > > > > wrote:
> > > > > >> > Suppose that I want to atomically create an entity group with two
> > > > > >> > nodes, one the parent of the other.
> > > > > >> But *why* exactly do you want to do this?
>
> > > > > > Because I want "a set of one or more entities that can be 
> > > > > > manipulated
> > > > > > in a single transaction. Entity group relationships tell App Engine 
> > > > > > to
> > > > > > store several entities in the same part of the distributed network. 
> > > > > > A
> > > > > > transaction sets up datastore operations for an entity group, and 
> > > > > > all
> > > > > > of the operations are applied as a group, or not at all if the
> > > > > > transaction fails."
>
> > > > > Yes, I understand transactions and entity groups. Why do you need to
> > > > > create an entity group *atomically*?
>
> > > > > > The fact that GAE uses many machines and concurrently is why the 
> > > > > > full
> > > > > > hostname, IP, or MAC address or some other machine identifier is
> > > > > > useful in creating a unique identifier on GAE.  (If my application
> > > > > > always ran on the same machine, the process id and time would be
> > > > > > sufficient.)
>
> > > > > If you create a new entity, it will automatically be assigned a unique
> > > > > key at the datastore level. What's wrong with just using that?
>
> > > > > Dave.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to