Nick Heiner
Nick Heiner

Reputation: 122412

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 method:

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?

Upvotes: 2

Views: 448

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 881567

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

Upvotes: 4

Related Questions