WebFaction
Community site: login faq

This has been discussed a bit in the past. However, in the old forum there were a couple of links to django apps that you should be able to use to view the stats. links in old post. I have tried the one app from ericflo. However it doesn't seem to work with socket files.

Can memcache be set up without using socket files on WebFaction? Are there any other options?

Anyone have any success with this one or the views option?

asked 25 Nov '10, 15:15

bmeyer71 ♦♦
1.5k3613
accept rate: 33%


It can be set up on localhost to an assigned port. To do this first create a "custom app" in the control panel so you are assigned a port and than execute memecahced like this,

$ memcached -l 127.0.0.1 -p 1234

Replacing 1234 with the port assigned by the custom app.

permanent link

answered 25 Nov '10, 15:45

johns
5.4k312
accept rate: 23%

edited 25 Nov '10, 15:48

Yes, this looks like what I was thinking of. A couple of additions to the command line were the -d and the -m. I ended up using: memcached -l 127.0.0.1 -p 22723 -d -m 10

As always, great support from the staff at WebFaction.

(25 Nov '10, 16:08) bmeyer71 ♦♦

This method should be indicated in the Webfaction documentation. You need to make a custom app (listening on port), and start up memcached as above in order to use django-memcached. I was having problems until I realized this. To be clear:

No custom app required (and no django-memcached support):

[webfaction]$ memcached -d -m <cache_size> ~/memcached.sock

settings.py: CACHE_BACKEND = 'memcached://unix:/home/swihart/memcached.sock'

If you want to use django-memcached:

my.webfaction.com: Create "Custom app (listening on port)"

[webfaction]$ memcached -l 127.0.0.1 -p <port> -d -m <cache_size>

settings.py: CACHE_BACKEND = 'memcached://127.0.0.1:<port>'

...where <port> is the port indicated in your "Custom app" and <cache_size> is the size in MB you want to give memcached (although this seems to get ignored anyway: http://community.webfaction.com/questions/4545/memcached-using-way-more-memory-than-ive-assigned).

(24 Jul '11, 10:06) swiharta

hi found the steps for memcache my django app:

1: http://docs.webfaction.com/software/memcached.html#memcached-setting-up 2: http://docs.webfaction.com/software/django/config.html#django-memcached

(if this is not the case , please correct me!)

In 1 , it asks us to : Enter memcached -d -m memory -s ~/memcached.sock where memory is the maximum number of megabytes of memory you want Memcached to use, and press Enter.

What would the value of "memory" be? I know it probably depends! But how on could figure out like an optimum number...Like for example they say that max swap partition for linux should be approx 512MB (I know my example sucks :) ) Anyway... you get the point, I am looking for an approx number , a range maybe...!

permanent link

answered 26 Nov '10, 06:08

plafon
1
accept rate: 0%

1

It would depend on how much traffic you get to your site as well as database activity. I decided to start out with a 10MB cache, With django-memcached installed and using the configuration that I mention above, I am hoping that I will be able to see if I need to increase, decrease or leave the cache size as it is. I did a ps -ef |grep memcached on the server I am on and noticed that a lot of others are setting their cache to 40MB. The size will also depend on the share plan that you signed up for as you will be limited by that amount of RAM as well. Hope this helps.

(26 Nov '10, 11:28) bmeyer71 ♦♦

Fair enough! So it is a try and see...will start with 10 also and c how it goes. Thanks for that bmeyer71 :)

P.S. I do not think you need django-memcached. According to http://docs.webfaction.com/software/memcached.html#memcached-setting-up

It is installed in all machines.

(26 Nov '10, 14:47) plafon
1

Actually Django-memcached is for viewing the stats on your memcached installation. Have a look at https://github.com/ericflo/django-memcached

(26 Nov '10, 15:32) bmeyer71 ♦♦

Sure...

My mistake.

(27 Nov '10, 04:14) plafon

To add to this, I have also added a script and a cron job to check to make sure that memcached stays running. The server I was on needed a reboot, and memcached of course didn't start back up.

In case anyone is interested, here is the script.

    #!/bin/bash
    if ps -U (account_name) |grep memcached > /dev/null
    then
      echo "memcached is running."
    else
      memcached -l 127.0.0.1 -p (your_port) -d -m 10
    fi

(03 Dec '10, 11:23) bmeyer71 ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×4
×4

question asked: 25 Nov '10, 15:15

question was seen: 7,296 times

last updated: 24 Jul '11, 10:07

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM