App Engine Deferred: Tracking Down Memory Leaks

后端 未结 1 1255
终归单人心
终归单人心 2020-12-02 03:12

We have an App Engine application that writes many files of a relatively large size to Google Cloud Store. These files are CSVs that are dynamically created, so we use Pytho

相关标签:
1条回答
  • 2020-12-02 03:21

    The symptom described isn't necessarily an indication of an application memory leak. Potential alternate explanations include:

    • the app's baseline memory footprint (which for the scripting-language sandboxes like python can be bigger than the footprint at the instance startup time, see Memory usage differs greatly (and strangely) between frontend and backend) may be too high for the instance class configured for the app/module. To fix - chose a higher memory instance class (which, as a side effect, also means a faster class instance). Alternatively, if the rate of instance killing due to exceeding memory limits is tolerable, just let GAE recycle the instances :)
    • peaks of activity, especially if multi-threaded request handling is enabled, means higher memory consumption and also potential overloading of the memory garbage collector. Limiting the number of requests performed in parallel, adding (higher) delays in lower priority deferred task processing and other similar measures reducing the average request processing rate per instance can help give the garbage collector a chance to cleanup leftovers from requests. Scalability should not be harmed (with dynamic scaling) as other instances would be started to help with the activity peak.

    Related Q&As:

    • How does app engine (python) manage memory across requests (Exceeded soft private memory limit)
    • Google App Engine DB Query Memory Usage
    • Memory leak in Google ndb library
    0 讨论(0)
提交回复
热议问题