First time here? Check out the FAQ!
2

Configuring memcached in Webfaction

I try to install memcached coz I've realized it solves many things. I have actually 3 askbot sites, one is the production environment and the other two are for development/testing purposes.

I'm hosted on Webfaction, in a plan with 256MB allowed memory. I read their instructions about memcached here and here which explain a lot but I still have questions coz I m new in python and django:

  1. At command memcached -d -m memory -s ~/memcached.sock how much memory should I set?
  2. Do I have to download anything from the refered link, or I just run PYTHONPATH=$HOME/webapps/django_app/lib/python2.7/ easy_install-2.7 --install-dir=$HOME/webapps/django_app/lib/python2.7/ --script-dir=$HOME/webapps/django_app/bin/ python-memcached ?
  3. How can I be sure that memcached is set up and works properly?
  4. Is it better to configure memcached for all my 3 sites?.
zaf's avatar
512
zaf
asked 2012-04-24 16:49:29 -0500
edit flag offensive 0 remove flag close merge delete

Comments

I asked also in webfaction, but I still don't know how much memory should I give to memcached. Any suggestions I would really appreciate! Thank you! (webfaction post is here)

zaf's avatar zaf (2012-04-25 15:07:46 -0500) edit
add a comment see more comments

1 Answer

1

For the application it does not matter how much memory you assign to the memcached instance (or any other type of cache). If you give less - the application might appear a little slower and that will be all.

Give as much as you can without running out of available memory.

Django application requires between 30 and 40 megabytes per process (that memory for the process itself - cache is a separate issue), if internationalization is enabled (in askbot it is mandatory).

Regarding your setup - I would do development on your home computer. It does help to have identical setup for the staging instance, but if you feel you are limited in the amount of memory - you can have cache-less staging instance (using "dummy" cache backend). Also, you can try setting it up so that you use only one python process to conserve even more memory.

Evgeny's avatar
13.2k
Evgeny
answered 2012-04-28 15:51:25 -0500, updated 2012-04-28 16:13:47 -0500
edit flag offensive 0 remove flag delete link

Comments

I have some caching issues, with answers not appearing etc, and I have seen posts here like this and this, so I suppose it solves many things not just getting things faster.

zaf's avatar zaf (2012-04-28 16:22:01 -0500) edit
3

It could be that you have stale cache, to fix that, start django shell in the same virtual environment and clear the cache manually.

python manage.py shell #in the virtual env
#then in the shell type:
from django.core.cache import cache
cache.clear()

We might need to add a management command that does the same... Please try the command above.

Evgeny's avatar Evgeny (2012-04-28 16:32:24 -0500) edit

thanks buddy, I tried it and I'll check the results and let you know (the caching issues do not appear always, so i'll test it few days. thanks again.

zaf's avatar zaf (2012-04-28 16:43:20 -0500) edit

It also could be that your several sites compete for the same cache.

Evgeny's avatar Evgeny (2012-04-28 16:46:22 -0500) edit

I have no idea if cache and memcache are the same or are correlated anyhow, just to mention, I ve set up memcache only in one site (production is not live yet).

zaf's avatar zaf (2012-04-28 16:50:04 -0500) edit
add a comment see more comments