32

I am currently on a Xeon 7550 server running Redhat x86_64 es5 with 32gb RAM. I have memcache installed and the only step remaining in the configuration is to set how much memory it uses. I had done this on my old server, where I downloaded a file on through Filezilla (root access) and edited it. Now, I cant remember which file I edited and exactly how the process went. I want to set the memery to use 1 GB.

Anyone with some insight? Please be thorough if you will assist, as my linux server knowledge is limited.

1
  • Also, what was the command that I run to view the current memcache settings...? Nov 15, 2010 at 15:10

3 Answers 3

44

I use Ubuntu, and Debian mostly, so this answer is based on those, but I suspect the answer for other distros is largely the same.

In /etc/memcached.conf -- If it's not in exactly the same place, a) I'd be surprised, and b) you could find it with locate

# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
-m 64

So all you need do, is change the -m 64 line to

-m 4096

Or similarly large value in Megabytes.

There's some other yummy tuning parameters in there, such as the user it runs as, and what to do when it runs out of memory, and the IP address to bind the daemon to.. Have a look for yourself.

4
  • This doesnt work for RedHat however
    – Arenstar
    Nov 15, 2010 at 15:30
  • I don't have a /etc/memcached.conf and locate returns no results. Memcached is definitely running. Nov 6, 2014 at 14:30
  • 1
    Works for me on Ubuntu 16.04 LTS May 5, 2017 at 3:27
  • 3
    Don't forget to restart memcached after making changes to conf file: service memcached restart May 5, 2017 at 3:27
25

Settings are maintained here..

   /etc/sysconfig/memcached

Change

# set ram size to 2048 - 2GiB

    CACHESIZE="4096"

Type the following command:

memcached-tool IP_ADDRESS:Port
memcached-tool 127.0.0.1:11211 display
memcached-tool 127.0.0.1:11211 stats
6
  • Im not to sure if this is correct, I typed the memcached-tool and it gave me: "# Item_Size Max_age Pages Count Full? Evicted Evict_Time OOM" Nov 15, 2010 at 15:19
  • oooooooooooops.. my mistake..... i linked you to the stats tool.. let me fix that.. use "stats" memcached tool
    – Arenstar
    Nov 15, 2010 at 15:25
  • As far as viewing the stats is concerned, I tend to just telnet localhost 11211, but that's because I can't guarantee the installation or portability of memcached-tool, but nc or telnet are often available. Nov 15, 2010 at 15:28
  • Your totally right, fortunately in RH and Centos, its packaged together..
    – Arenstar
    Nov 15, 2010 at 15:29
  • Did this work???
    – Arenstar
    Nov 17, 2010 at 15:45
1

For some distro it's location at /etc/init.d/ with the file name memcached

   /etc/init.d/

Change

# set ram size to 8MBytes to 256MBytes

    MEMSIZE=256

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .