我正在尝试使用memcache来提高性能。
这里是我的模型:
试图提高我的GAE应用程序的性能
class ABC(db.Model):
some_property = db.StringProperty()
# more properties
class XYZ(db.Model):
another_property = db.StringProperty()
abc = db.ReferenceProperty(ABC,collection_name="xyzs")
# more properties
我只有两个ABC的实体和XYZ
的800个实体因此,应用程序的功能之一就是提供Excel工作表的所有XYZ。 Excel表格有两列。
第一列是“another_property”,第二列是“some_property”(来自ABC参考)。
xyzs = XYZ.all()
for xyz in xyzs:
logging.info(xyz.another_property)
logging.info(xyz.abc.some_property)
通过这种方法,xyz.abc.some_property
被制作数据存储区调用的每次
见此情景,我决定使用内存缓存在内存中存储的ABC参考。
随着memcache的使用,我没有看到响应时间的任何重大变化。
abcId = XYZ.abc.get_value_for_datastore(xyz).id()
#Get ABC reference from memcache if present else bring it from datastore and add it to memcahce.
能取悦别人,为什么我没有看到任何性能提升?
将我的应用程序从db移至ndb,但性能下降。 http://stackoverflow.com/questions/16998450/can-someone-explain-the-difference-between-this-two-ahstats-generated-timeline – Sandeep 2013-06-08 10:19:29