Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8191677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:58:16+00:00 2026-06-07T03:58:16+00:00

In my App Engine app (in Python 2.7, threadsafe) I want to be able

  • 0

In my App Engine app (in Python 2.7, threadsafe) I want to be able to display information on all entities of my ChildModel kind. I think I’ve got memcache working, but because the ChildModel has a property that connects to a ParentModel there are some things happening that I don’t understand.

I currently have the following models:

class ParentModel(db.Model):
  name = db.StringProperty()
  # currently 109 of these

class ChildModel(db.Model):
  name = db.StringProperty()
  parent_program = db.ReferenceProperty(ParentModel)
  # currently 758 of these

I’m implemented memcache using the example from Nick Johnson’s blog.

class AllEntities(webapp2.RequestHandler):
  def get(self):
    entitylist = deserialize_entities(memcache.get("entitylist"))
    if not entitylist:
      entitylist = ChildModel.all().fetch(None)
      memcache.set("entitylist", serialize_entities(entitylist))
    totalnum = ChildModel.all().count()

The very first time I run this I see the following in appstats:

datastore_v3.Get        758
datastore_v3.RunQuery   3
datastore_v3.Next       2
memcache.Get        1
memcache.Set        1

After that, I see the following in appstats:

datastore_v3.Get        758
datastore_v3.RunQuery   2
memcache.Get            1

It looks like memcache gets set correctly, based on the memcache size (1304599 byte(s)). But I can’t figure out how to stop the 758 datastore_v3.Get’s which are extraordinary slow and also killing me on my quota of Datastore Small Operations and Datastore Read Operations.

Can someone please help me figure out what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:58:17+00:00Added an answer on June 7, 2026 at 3:58 am

    You are not doing anything wrong, count() is whats doing the 758 gets and cost you the small operation quota.

    Since you have all the models loaded from memcache into a list you can just call len(entitylist) to get the amount of entities.


    Try calling prefetch_refprops(entitylist, ChildModel.parent_program) prior to setting the value in the memcache as describe in Nick’s blog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Google App Engine (python), I want my users to be able
I'm using Google App Engine python. I want to know what browser the user
I want to have multiple pages in google-app engine (python 2.7) and the followoing
I'm developing in Google App Engine (python sdk) and I want to use jQuery
I want to provide rss feed under google app engine/python. I've tried to use
I am using the App Engine Bulk loader (Python Runtime) to bulk upload entities
I'm using Google App Engine (Python) and Chanel api. Is it possible to show
I'm developing a web application on App Engine Python. I have a form with
Are there any guidelines to writing Google App Engine Python code that would work
I'm currently making an iphone web app based on Google App Engine (python). I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.