Skip to content

Measure memory taken by requested view and response using pympler.muppy and/or psutil

License

Notifications You must be signed in to change notification settings

giussepi/django-memory-profiling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-memory-profiling

Measure memory taken by requested view and response using pympler.muppy and/or psutil

Memory measurements can be:

  • Displayed on Terminal, when running django development server
  • Displayed on Loggin panel of django debug toolbar, if SHOW_ON_DJANGO_DEBUG_TOOLBAR_LOGGIN_PANEL = True
  • Sent to an email list, when the memory threshold is surpassed

Works with Debug = True or False

INSTALLATION

  1. Run pip install git+git://github.com/giussepi/django-memory-profiling

  2. On settings.py

  3. Add your preffered middleware(s) to MIDDLEWARE_CLASSES

    'memory_profiling.psutil_middleware.MemoryUsageMiddleware',
    'memory_profiling.pympler_middleware.MemoryMiddleware2',
    'memory_profiling.pympler_middleware.MemoryMiddleware1',
  1. Add memory_profiling to INSTALLED_APPS
  2. Configurate as desired. Example:
# MemoryMiddleware1 settings
SHOW_REQUEST_SUMMARY = True
SHOW_RESPONSE_SUMMARY = True
SHOW_COMPARED_REQUEST_RESPONSE_SUMMARIES = True

# MemoryMiddleware2 settings
SHOW_TOP_X_MEMORY_DELTAS = 15

# MemoryUsageMiddleware settings
MEMORY_VIEW_THRESHOLD = 10  # Mb
SHOW_MEMORY_USAGE_PER_REQUEST = True
MEMORY_WARNINGS_RECEIVERS = ['receiver@mail.com']

# General settings (applies to all memory_profiling middlewares)
IGNORE_URLS_CONTAINING = [
    'site_media', 'static', '__debug__', 'undefined', 'pulse'
]
SHOW_ON_DJANGO_DEBUG_TOOLBAR_LOGGIN_PANEL = True

About

Measure memory taken by requested view and response using pympler.muppy and/or psutil

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published