This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This is a Django management command (as in https://docs.djangoproject.com/en/dev/howto/custom-management-commands/) that analyzes and reports on the size of sessions in the DB. It is intended to make it easier to understand how much space session data takes up.

Why?

I noticed that a relatively small number of sessions in my Django app were consuming 50+KiB of data each, and wanted to understand why. It isn’t feasible or appealing to analyze large numbers of Django sessions by hand, and I couldn’t find any existing tools that did batch analysis, so I wrote this tool.

Installation

Install the distribution from PyPI, e.g. pip install django-analyze-sessions

Then, add analyze_sessions to INSTALLED_APPS in your Django project.

That’s it. You can now run django-admin.py and confirm that the command shows up.

Example Uses

Break down the space usage of all sessions with more than 15KB of session data::

django-admin.py analyze-sessions --bigger-than=15000
Processed 2 sessions out of 5125 total sessions
Average size was 16885.50 bytes
Saw the following keys:
    foo (2 times, avg. size 15723.00 bytes)
    bar (2 times, avg. size 618.50 bytes)
    baz (2 times, avg. size 211.50 bytes)

Break down the space usage of all sessions whose keys are in the given input file (useful for when you want to select sessions on more than encoded size)::

django-admin.py analyze-sessions --ids-from=/tmp/ids-to-check
Processed 2 sessions out of 5125 total sessions
Average size was 16885.50 bytes
Saw the following keys:
    foo (2 times, avg. size 15723.00 bytes)
    bar (2 times, avg. size 618.50 bytes)
    baz (2 times, avg. size 211.50 bytes)

Known Issues and Bugs

  • The custom WHERE clause used to filter on session size may only work on MySQL (I don’t have access to a Django installation on another DBMS, so I can’t vouch for how well it’ll work there).
  • The tool could stand to be smarter about size abbreviations (e.g., by learning how to interpret 100KB, or abbreviating output)
  • The packaging (such as it is) isn’t very good.

Author

Kevan Carstensen <kevan@isnotajoke.com>

Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-analyze-sessions-0.1.1.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Aug 21, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting