Google App Engine DB Query Memory Usage

后端 未结 2 1927
故里飘歌
故里飘歌 2020-12-21 14:26

When I run a query on a large set of small objects (15k objects with only a few short string and boolean properties), without doing anything with these objects, I see my ins

相关标签:
2条回答
  • 2020-12-21 14:54

    I have reported this to the app engine team, and they seem to confirm this is actually a problem (suspected to be with the handling of cursors).

    0 讨论(0)
  • 2020-12-21 14:59

    Each model entity has some over head.

    You query returns objects as Protobufs for starters.

    So you will a series of batched protobufs for the result set.

    Then it is decoded. Each decoded entity includes the property names as well as the data for each entity. You have 15K entities. How big are your property names for instance.

    So you have at least two copies of the result set in memory in various forms (possibly more), not including anything else you do with instances of the model class.

    You code/loop has no opportunity for garbage collections, and that can/will happen later.

    Have a look at tools like apptrace to help memory profiling.

    0 讨论(0)
提交回复
热议问题