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

Django Scaler

Degrade gracefully by automatically replacing heavy pages with static pages while a server is taking strain.

Installation

  1. Install or add django-scaler to your Python path.
  2. Add scaler to your INSTALLED_APPS setting.
  3. Add scaler.middleware.ScalerMiddleware to the top of your MIDDLEWARE_CLASSES setting.
  4. Add (r’^scaler/’, include(‘scaler.urls’)) to urlpatterns.

Overview

Servers may at times get overloaded due to a variety of reasons. When that happens you don’t want expensive requests to bring down your entire site. The site must redirect expensive requests to a “server busy” page while the server is under load, and then automatically remove the redirects once the load has dropped enough.

django-scaler addresses this situation in two ways. Firstly, it knows which requests to redirect by itself. Secondly, it can be instructed to redirect the N most expensive requests. It stores response time data in in-memory caches enabling it to make these decisions.

Usage

Pasted from test_settings.py:

DJANGO_SCALER = {
    'server_busy_url_name': 'server-busy',

    # How many response times to consider for an URL. A small value means slow
    # response times are quickly acted upon, but it may be overly aggressive.
    # A large value means an URL must be slow for a number of requests before
    # it is acted upon. The default is 100.
    'trend_size': 10,

    # How much slower than average the trend must be before redirection kicks
    # in. The default is 4.0.
    'slow_threshold': 2.0,

    # How many seconds to keep redirecting an URL before serving normally. The
    # default is 60.
    'redirect_for': 10,

    # A function that returns how many of the slowest URLs must be redirected.
    # Depending on the site, data and load on the server this may be a large
    # number. This allows external processes to instruct the middleware to
    # redirect. The default is 0.
    'redirect_n_slowest_function': lambda: 0,

    # A function that returns what percentage of the slowest URLs must be
    # redirected. Depending on the site, data and load on the server this may
    # approach 100. The default is 0.
    'redirect_percentage_slowest_function': lambda: 0,

    # A function that returns a list of regexes. URLs matching the regexes are
    # redirected. Each regex is a simple string. Do not prefix with r''. The
    # default is an empty list.
    'redirect_regexes_function': lambda: [],
}

Authors

Praekelt Foundation

  • Hedley Roos

Changelog

0.2

  1. Regex URL matching for explicit redirection.
  2. Percentage slowest explicit redirection.

0.1

  1. First release.
Release History

Release History

0.2

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

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_scaler-0.2-py2.6.egg (13.6 kB) Copy SHA256 Checksum SHA256 2.6 Egg May 31, 2012
django_scaler-0.2-py2.7.egg (13.5 kB) Copy SHA256 Checksum SHA256 2.7 Egg May 31, 2012
django-scaler-0.2.tar.gz (8.7 kB) Copy SHA256 Checksum SHA256 Source May 31, 2012

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