Memory profiling/monitoring (python) on Google AppEngine

92 views
Skip to first unread message

Lukas Šalkauskas via StackOverflow

unread,
Nov 16, 2015, 5:19:06 PM11/16/15
to google-appengin...@googlegroups.com

I've been working with app engine for quite some time, I know that there is appstats but those only show datastore/memcache and other not related to actual memory usage stats.

I've tried to integrate with AppTrace (with all the components latest versions) but I can't continue, since I get this error:

ImportError: dlopen(../apptrace/guppy/sets/setsc.so, 2): Symbol not found: __PyLong_AsScaledDouble
Referenced from: ../apptrace/guppy/sets/setsc.so
Expected in: flat namespace

So my question is: what is the best way (on latest appengine sdk) to profile/monitor memory/catch memory leaks and other python-memory related stuff (either on local or Google server)?

btw, we use Python 2.7 and we're working on Mac OS X (10.7.4)



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/11202475/memory-profiling-monitoring-python-on-google-appengine

Milo via StackOverflow

unread,
Nov 16, 2015, 5:19:08 PM11/16/15
to google-appengin...@googlegroups.com

This post is 3 years old, however I thought this answer is still worth sharing to help others. I have premium Google App Engine support and contacted them regarding this same issue.

The Google engineer advised me that the Google App Engine runtime API is deprecated, but still functions. It provides a method called memory_usage.

from google.appengine.api.runtime import runtime
import logging

logging.info(runtime.memory_usage())

This will output memory usage statistics, where the numbers are expressed in MB. For example:

current: 464.0859375
average1m: 464
average10m: 379.575

By placing the logging statement at key points in your code, you can work out which part is causing a memory leak.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/11202475/memory-profiling-monitoring-python-on-google-appengine/33745549#33745549
Reply all
Reply to author
Forward
0 new messages