As Ikai says, Slim3 has a certain level of overhead for global transactions,
but it is not very expensive.
I prepared the demonstration.
Local Transaction test code:
long start = System.currentTimeMillis();
for (int i = 0; i < entityGroups; i++) {
Transaction tx = Datastore.beginTransaction();
Datastore.put(tx, new Entity("Hoge"));
tx.commit();
}
long time = System.currentTimeMillis() - start;
Global Transaction test code:
start = System.currentTimeMillis();
GlobalTransaction gtx = Datastore.beginGlobalTransaction();
for (int i = 0; i < entityGroups; i++) {
gtx.put(new Entity("Hoge"));
}
gtx.commit();
time = System.currentTimeMillis() - start;
The result:
Entity Groups Local Transaction(millis) Global Transaction(millis)
1 79
77
2 152
615
3 249
626
4 280
764
5 395
797
You can try this demonstration:
http://slim3demo.appspot.com/gtx/
Thanks,
Yasuo Higa
> To add on to Nick's note: global, distributed transactions are very
> expensive to do for all your writes. Even in the case of Slim3, the overhead
> is a multiplier on a write - you'll want to be very careful where you use
> this. If you use it on an operation that's frequent, you'll be paying a huge
> cost, one that you can likely avoid.
>
> On Tue, Apr 6, 2010 at 4:38 AM, Yasuo Higa <[email protected]> wrote:
>>
>> Hi Dexter,
>>
>> > The global conservation law is a show stopper for many banking type
>> > application in Google Apps.
>> > Check http://code.google.com/p/googleappengine/issues/detail?id=313
>> > for details.
>> >
>> > It seems that google is not going to bring 2 row concurrency anytime
>> > soon. However if a large number of people are interested it might get
>> > a higher priority.
>> >
>> In Java world, Slim3, which is a framework, supports global transactions.
>>
>> http://sites.google.com/site/slim3appengine/slim3-datastore/transactions/global-transaction
>>
>> If python SDK supports explicit transactions, global transactions can
>> be implemented as Slim3.
>>
>> Explicit transactions means:
>> DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
>> Entity entity = new Entity("Aaa");
>> Entity entity2 = new Entity("Bbb");
>> Tranaction tx = ds.beginTransaction();
>> ds.put(tx, entity);
>> //this operation will execute without transaction
>> ds.put(null, entity2);
>> tx.commit();
>>
>> Thanks,
>>
>> Yasuo Higa
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To post to this group, send email to [email protected].
>> 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.
>>
>
>
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> http://googleappengine.blogspot.com | http://twitter.com/app_engine
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> 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.
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
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.