App Engine instance memory constantly increasing

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 18:09:29
gaefan

I found another answer that explains part of what is going on here. I'll give a summary based on that answer:

  1. When using NDB, entities are stored in a context cache, and the context cache is part of your memory usage.

  2. From the documentation, one would expect that memory to be released upon the completion of an HTTP request.

  3. In practice, the memory is not released upon the completion of the HTTP request. Apparently, context caches are reused, and the cache is cleared before its next use, which can take a long time to happen.

For my situation, I am adding _use_cache=False to most entities to prevent them from being stored in the context cache. Because of the way my app works, I don't need the context caches for these entities, and this reduces memory usage.

The above is only a partial solution however!

Even with caching turned off for most of my entities, my memory usage is still constantly increasing! Below is snapshot over a 2.5 day period where the memory continuously increases from 36 MB to 81 MB. This is over the 4th of July weekend with low traffic.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!