Google App Engine: Devserver is hideously slow
My devserver has become hideously slow for some reason. (Python, Windows 7, GAE 1.3.3) I'm not sure if I'm doing something wrong, or if it's just not meant to handle the load I'm putting on it. I have 1000 models of a certain type in the datastore. I am trying to delete them with this m开发者_开发技巧ethod:
def _deleteType(type):
results = type.all().fetch(1000)
while results:
db.delete(results)
results = type.all().fetch(1000)
It's taken 20+ minutes. I restarted the devserver, and the SDK console still said I have 1000 of these models in the DB. What's going on?
Is there a better way to cleanse my app of all data?
Getting (and passing to db.delete
) just the keys rather than the whole objects should be a bit faster. However, by far the fastest way to clear the datastore at start-up on the SDK is to start your app with:
dev_appserver.py --clear_datastore myapp
精彩评论