Hi,

I am kind of new to GAE, and I was wondering if someone has statistics
or data that shows what are the most optimal (efficient) ways for
deleting and creating objects in the Datastore.

I did some small experiments in order to identify a more efficient
mechanism to delete and create objects in the datastore. In these
tests, I have a single persistent object that contains 8 persistent
fields.

In the first test, I have a loop of 150 instances, and at each
iteration I create the persistent object, and I call the
makePersistent function to add the single instance to the datastore.
This should take much longer, and it does. It takes on average 16-17
seconds.

In the second test, the loop only creates the 150 objects, and then
outside the loop, I call the makePersistentAll function, passing all
my collection of objects. As it is mentioned in the documentation,
this is supposed to be faster, and it is. It takes on average 1-2
seconds.

I have experimented only with one way for deleting objects.
Basically, I make a query to retrieve "ONLY" the keys of my
objects.
Query query = pm.newQuery("select objectKey from " +
objectClass.getName());
keys = (List<Key>) query.execute();

Then, once all keys have been retrieved, I call the following service
method:
DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
ds.delete(keys);

To delete the objects. It takes on average 2-4 seconds to delete 150
instances.

I was just wondering if I am missing something, and if there is a more
efficient way for deleting (or creating) objects in the datastore. I
see also that there is a higher variance in deleting objects than in
creating them. For example, the fastest run in my test took 1.6
seconds to delete the 150 instances, while the slowest run took almost
8 seconds. I do not see this variability when I create the objects
(i.e., when I add them to GAE).

Any advice or suggestions on alternative methods for doing these kinds
of operations in GAE is GREATLY APPRECIATED. Or, If I am in the right
track, please let me know.

THANKS A LOT.






-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en.

Reply via email to