Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle App Engine Efficient Data store Read/Write Operation to Save Quota
    text
    copied!<p>I've created an Google App Engine Apps using Python.The application deals with lot of user names.</p> <p>It has got a database to 50K usernames. Each user name has a unique hash value. Which is also stored in the data store.</p> <p>When any app user submit any user name. The application first checks if the username exist in DB.</p> <p>If its a new user name, the application calculate a new hash for the new name and store the name and hash in DataStore.</p> <p>If user name already exist in Datastore, it retrieve the old hash from data store.</p> <p>Sample Code:</p> <pre><code>class Names(db.Model): name = db.StringProperty(required=True) hash = db.StringProperty(required=True) username = "debasish" user_db = db.GqlQuery("SELECT * FROM Names WHERE name=:1", username) user = user_db.get() if user == None: #doesn't exist in DB..so calculate new hash for that name and store it in DB e = Names(name=username,hash="badasdbashdbhasbdasbdbjasbdjbasjdbasbdbasjdbjasbd") e.put() else: #retrieve the old hash. self.response.out.write('{"name":"'+user.name+'","hash":"'+user.hash+'"}') </code></pre> <p>The problem I'm facing is GAE's free data store read operation quota.Its exceeding too quickly and My application stop working.</p> <p>I've also tried to implement memcache,like this , adding entire db in memcache. But it was also a failure,result more bad.</p> <pre><code>def get_fresh_all(self): all_names = db.GqlQuery("SELECT * FROM Names") memcache.add('full_db', all_names, 3600) return all_names </code></pre> <p>So,guys could you please suggest , Am I doing something wrong?? How I can make data store read operations more efficiently??</p> <p>Thanks in Adv.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload