I know that app engine uses the memcache and the datastore for sessions. I can see in appstats that when i call getSession(), creating a new session, that 1 memcache and 1 datastore put occur.
However, in every开发者_JS百科 single request of my app I get the current user object from the session. And no memcache or datastore gets show up in appstats.
How does that work?
The Google blog "Easy Performance Profiling with Appstats" has a nice article that looks at profiling memcache in Appstats. It's discussed in Python, but references the use of Appstats for Java.
From: "Google App Engine > Appstats for Java"
How It Works
The Appstats servlet filter adds itself to the remote procedure call framework that underlies the App Engine service APIs. It records statistics for all API calls made during the request handler, then stores the data in memcache, using a namespace of
__appstats__
. Appstats retains statistics for the most recent 1,000 requests (approximately). The data includes summary records, about 200 bytes each, and detail records, which can be up to 100 KB each.The Java version of Appstats uses fixed values and behaviors for how data is stored in the memcache and the datastore. (These cannot be configured as they can with the Python version of Appstats.)
If you're having problems with memcache data not showing up in Appstats, you might want to look at JCache as an interface to the App Engine memcache service. Or, there are a few tools tailored to reporting memcached statistics recommended here.
Cheers.
精彩评论