GithubHelp home page GithubHelp logo

isabella232 / django-memcached-pool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zapier/django-memcached-pool

0.0 0.0 0.0 117 KB

A Pooled memcached connector for Django

License: Other

Python 100.00%

django-memcached-pool's Introduction

django-memcached-pool

An efficient fast Django Memcached backend with a pool of connectors, based on ultramemcache.

See https://github.com/esnme/ultramemcache

Each connection added in the pool stays connected to Memcache or Membase, drastically limiting the number of reconnections and open sockets your application will use on high load.

If you configure more than one Memcache server, each new connection will randomly pick one.

Everytime a socket timeout occurs on a server, it's blacklisted so new connections avoid picking it for a while.

To use this backend, make sure the package is installed in your environment then use memcachepool.cache.UMemcacheCache as backend in your settings.

Also, make sure you use umemcache >= 1.5

Here's an example:

CACHES = {
    'default': {
        'BACKEND': 'memcachepool.cache.UMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
        'OPTIONS': {
                'MAX_POOL_SIZE': 100,
                'BLACKLIST_TIME': 20,
                'SOCKET_TIMEOUT': 5,
                'MAX_ITEM_SIZE': 1000*100,
            }
        }
    }

Options:

  • MAX_POOL_SIZE: -- The maximum number of connectors in the pool. default: 35.
  • BLACKLIST_TIME -- The time in seconds a server stays in the blacklist. default: 60
  • SOCKET_TIMEOUT -- the time in seconds for the socket timeout. default: 4
  • MAX_ITEM_SIZE -- The maximum size for an item in Memcache.

django-memcached-pool's People

Contributors

almet avatar fernandogrd avatar jamescarr avatar pagles avatar petersanchez avatar piotrbulinski avatar tarekziade avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.