What you will need
1. My fork of johnny cache that adds a new cacheing backend with support for
django-pylibmc-sasl==0.2.4
pylibmc==1.2.3
2. A heroku memcachier addon
3. The settings.
STEP 1
For development install my fork locally
pip install git+git://github.com/grillermo/johnny-cache.git
Now add these lines to your requirements.txt, at the end of it
git+git://github.com/grillermo/johnny-cache.git
django-pylibmc-sasl==0.2.4pylibmc==1.2.3
STEP 2
Install the addon on your app
heroku addons:add memcachier:dev --app yourHerokuApp
STEP 3
Add these to your settings file
os.environ['MEMCACHE_SERVERS'] = os.environ.get('MEMCACHIER_SERVERS', '')
os.environ['MEMCACHE_USERNAME'] = os.environ.get('MEMCACHIER_USERNAME', '')
os.environ['MEMCACHE_PASSWORD'] = os.environ.get('MEMCACHIER_PASSWORD', '')
CACHES = {}
CACHES['default'] = {
'BACKEND': 'johnny.backends.memcached.PyLibMCCacheSasl',
'BINARY': True,
'JOHNNY_CACHE': True,
'LOCATION': 'localhost:11211',
'OPTIONS': {
'ketama': True,
'tcp_nodelay': True,
},
'TIMEOUT': 500,
}
JOHNNY_MIDDLEWARE_KEY_PREFIX='a_nice_string_of_your_choosing'
# The first middleware on the list
MIDDLEWARE_CLASSES = (
'johnny.middleware.LocalStoreClearMiddleware',
'johnny.middleware.QueryCacheMiddleware',
...
)
By all means if you encounter problems, contact me @grillermo or leave a comment here, i suffered this installation and my experience could help somebody in need.
On a related issue i couldnt uninstall already installed packages by pip so i had to fix my buildpack so heroku respects these command
heroku labs:enable user_env_compile --app bandtastic
heroku config:add CLEAN_VIRTUALENV=true
What these will do is make heroku reinstall all the packages from your requirements.txt everytime you push, so make sure you only do this once you update your johnny cache installation with my repo and then you should do
heroku config:remove CLEAN_VIRTUALENV
To go back to normalityTo use my build pack run
heroku config:add BUILDPACK_URL=git://github.com/grillermo/heroku-buildpack-python.git
DONT DO IT, do not install johnny cache on heroku, at least using Memcachier this is my new relic performance log
Look at that! wtf im using the C client pylibmc, response time almost trippled!