Difference between revisions of "Memcache"
(Creating memcache page with instructions for using it on a Dreamhack.) |
Foxfirefey (Talk | contribs) |
||
Line 1: | Line 1: | ||
Memcache is a system used by Dreamwidth to lessen the amount of database access needed, by temporarily storing frequently-accessed information in memory for quick access. It was developed by Brad Fitzpatrick and is used in many high-profile websites, including Slashdot, Wikipedia, and, of course, LiveJournal (for which it was developed). Dreamwidth Studios also uses this system. | Memcache is a system used by Dreamwidth to lessen the amount of database access needed, by temporarily storing frequently-accessed information in memory for quick access. It was developed by Brad Fitzpatrick and is used in many high-profile websites, including Slashdot, Wikipedia, and, of course, LiveJournal (for which it was developed). Dreamwidth Studios also uses this system. | ||
− | ==Using Memcache on a Dreamhack== | + | == Using Memcache on a Dreamhack == |
+ | |||
To use memcache on a [[Dreamhacks|Dreamhack]], do the following: | To use memcache on a [[Dreamhacks|Dreamhack]], do the following: | ||
Line 15: | Line 16: | ||
Your Dreamhack should now be set up for memcache. | Your Dreamhack should now be set up for memcache. | ||
+ | |||
+ | == Using Memcache on your own setup == | ||
+ | |||
+ | First, install the daemon: | ||
+ | |||
+ | sudo apt-get install memcached | ||
+ | |||
+ | You can run it in kind of a debug mode like this: | ||
+ | |||
+ | memcached -vv -m 25 -l 127.0.0.1 -p 8080 | ||
+ | |||
+ | Or in the background like this: | ||
+ | |||
+ | memcached -d -m 25 -l 127.0.0.1 -p 8080 | ||
+ | |||
+ | For more help on the options, | ||
+ | |||
+ | memcached -h | ||
+ | |||
+ | You'll also have to set up your installation to use it: | ||
+ | |||
+ | vi etc/config-local.pl | ||
+ | |||
+ | And edit the appropriate information: | ||
+ | |||
+ | # MemCache information, if you have MemCache servers running | ||
+ | @MEMCACHE_SERVERS = ('127.0.0.1:8080'); | ||
+ | $MEMCACHE_COMPRESS_THRESHOLD = 1_000; # bytes | ||
+ | |||
+ | Note that the memcache server doesn't have to be on your web server; you can set it up and configure it with the IP of a different server. | ||
+ | |||
+ | [[Category: Dreamwidth Installation]] |
Revision as of 19:13, 12 September 2009
Memcache is a system used by Dreamwidth to lessen the amount of database access needed, by temporarily storing frequently-accessed information in memory for quick access. It was developed by Brad Fitzpatrick and is used in many high-profile websites, including Slashdot, Wikipedia, and, of course, LiveJournal (for which it was developed). Dreamwidth Studios also uses this system.
Using Memcache on a Dreamhack
To use memcache on a Dreamhack, do the following:
- Contact the owner of the Dreamhack box you're using for a port to use with the
memcached
program; this will either be Sophie or Afuna. - Use
screen
to run this command:
memcached -m 8 -l 127.0.0.1 -p <port>
- ...replacing <port> with the port number assigned to you in the previous step. If you need help with
screen
, feel free to contact Sophie. (A wiki page on this should be available in the future.)
- Edit your
etc/config-local.pl
file and look for the line:
#@MEMCACHE_SERVERS = ('hostname:port');
- Change this to:
@MEMCACHE_SERVERS = ('127.0.0.1:<port>');
- again replacing <port> with the appropriate port number. (Make sure also that the line is uncommented by removing the # at the front.)
Your Dreamhack should now be set up for memcache.
Using Memcache on your own setup
First, install the daemon:
sudo apt-get install memcached
You can run it in kind of a debug mode like this:
memcached -vv -m 25 -l 127.0.0.1 -p 8080
Or in the background like this:
memcached -d -m 25 -l 127.0.0.1 -p 8080
For more help on the options,
memcached -h
You'll also have to set up your installation to use it:
vi etc/config-local.pl
And edit the appropriate information:
# MemCache information, if you have MemCache servers running @MEMCACHE_SERVERS = ('127.0.0.1:8080'); $MEMCACHE_COMPRESS_THRESHOLD = 1_000; # bytes
Note that the memcache server doesn't have to be on your web server; you can set it up and configure it with the IP of a different server.