Two Important Profiles for any Application:
- Speed
- Memory Usage
1.) Speed is easy to profile in the new versions of web2py:
python web2py.py -F profiler.log
2.) The easiest method I found to profile memory is as follows:
-
Install: https://github.com/fabianp/memory_profiler
-
pip install -U memory_profiler
-
easy_install -U memory_profiler
-
- Run web2py:
-
python web2py.py
- Determine the process running web2py:
-
ps -a
- Find the process running CMD: python web2py.py
- Run the following in python (via script or interpreter):
-
from memory_profiler import memory_usage import time while True: print memory_usage(WEBPY_PROCESS_ID, interval=.2, timeout=1) time.sleep(.2)
It's not perfect, but it gives you an idea as you optimize your application.
Suggestions Welcomed!
Comments (0)