Ask Your Question
2

Configuring memcached in Webfaction

asked 2012-04-24 16:49:29 -0500

zaf gravatar image

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?.
edit retag flag offensive 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 gravatar imagezaf ( 2012-04-25 15:07:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-04-28 15:51:25 -0500

Evgeny gravatar image

updated 2012-04-28 16:13:47 -0500

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.

edit flag offensive delete link more

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 gravatar imagezaf ( 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 gravatar imageEvgeny ( 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 gravatar imagezaf ( 2012-04-28 16:43:20 -0500 )edit

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

Evgeny gravatar imageEvgeny ( 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 gravatar imagezaf ( 2012-04-28 16:50:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-04-24 16:49:29 -0500

Seen: 814 times

Last updated: Apr 28 '12