man pages section 1M: System Administration Commands

Exit Print View

Updated: July 2014

memcached (1m)


memcached - high performance memory object caching system


memcached [-l <ip-addr>] [-d] [-u <username>]
[-m <num>] [-c <num>] [-k] [-L ]
[-p <num>] [-U <num>] [-s <filename>]
[-a <perms>] [-M] [-r] [-b]
[-f <factor>] [-n <size>] [-h] [-v] [-vv] [-i]
[-P <filename>] [-t <threads>] [-D <char>]


Administration Commands                             memcached(1M)

     memcached - high performance memory object caching system

     memcached [-l <ip-addr>] [-d] [-u <username>]
     [-m <num>] [-c <num>] [-k] [-L ]
     [-p <num>] [-U <num>] [-s <filename>]
     [-a <perms>] [-M] [-r] [-b]
     [-f <factor>] [-n <size>] [-h] [-v] [-vv] [-i]
     [-P <filename>] [-t <threads>] [-D <char>]

     memcached   is  a  flexible  memory  object  caching  daemon
     designed to alleviate database load in dynamic web  applica-
     tions by storing objects in memory.  It is based on libevent
     to scale to any size needed, and is  specifically  optimized
     to  avoid swapping and always use non-blocking I/O. This man
     page documents briefly the memcached memory  object  caching

     The options supported by the memcached command are described

     -l <ip-addr>     Listen on <ip-addr>; default to INADDR_ANY.
                      This is an important option to  consider as
                      there is no other way to secure the instal-
                      lation.  Binding  to  an   internal or fire
                      walled network interface is suggested.

     -d               Run memcached as a daemon.

     -u <username>    Assume the identity of <username> only when
                      run as a super user (root).

     -m <num>         Use  the maximum <num> MB memory for object
                      storage; the default is 64 MB.

     -c <num>         Use the specified number of maximum  simul-
                      taneous connections; the default is 1024.

     -k               Lock down all paged memory.

                      Use  this  option  with  caution with large
                      caches. For information about the  configu-
                      ration  suggestions, see the README and the

SunOS 5.11           Last change: March 2008                    1

Administration Commands                             memcached(1M)

                      memcached home page.

     -L               Preallocate memory  and  use  large  memory
                      pages if possible.

                      This  option  will preallocate cache memory
                      for object storage.  See description of  -m
                      option  for  a specification of the size of
                      the memory.  If supported by the  platform,
                      large memory pages will be allocated.  This
                      should reduce  number  of  TLB  misses  and
                      increase performance.

     -p <num>         Listen  on the TCP port <num>.  The default
                      port is 11211.

     -U <num>         Listen on the UDP port <num>.  The  default
                      is 0, meaning that the UDP protocol is dis-

     -s <filename>    Unix socket path  to  listen  on  (disables
                      listening support for TCP and UDP).

     -a <perms>       Permissions  (in  octal  format)  for  Unix
                      socket created  with  -s  option.   Default
                      value is 0700.

     -M               Disable automatic removal of items from the
                      cache when out of  memory.  Additions  will
                      not  be  possible  until  adequate space is
                      freed up.

     -r               Raise the core file size limit to the maxi-
                      mum allowable.

     -b               Run a managed instance.

     -f <factor>      Use  this option to specify <factor> as the
                      multiplier for computing the sizes of  mem-
                      ory  chunks  that  items  are  stored in. A
                      lower value may result in less wasted  mem-
                      ory depending on the total amount of memory
                      available  and  the  distribution  of  item

SunOS 5.11           Last change: March 2008                    2

Administration Commands                             memcached(1M)

                      sizes. The default value is 1.25.

     -n <size>        Allocate  a minimum of <size> bytes for the
                      item key, value,  and  flags.  The  default
                      value  is  48.  If  you have a lot of small
                      keys and values, you can get a  significant
                      memory  efficiency gain with a lower value.
                      If you use a high chunk growth factor, that
                      is  -f option, you may want to increase the
                      size to allow a bigger percentage  of  your
                      items  to  fit  in  the most densely packed
                      smallest chunks.

     -h               Show the version of memcached and a summary
                      of options.

     -v               Be verbose during the event loop; print out
                      errors and warnings.

     -vv              Be even more verbose; same as -v option but
                      also  print client commands and  responses.

     -i               Display memcached and libevent licenses.

     -P <filename>    Print pidfile to the specified file.

                      Note -

                        This  option  can  be  used   only   when
                        mechached is run as a daemon (-d option).

     -t <threads>     Number of threads to use to process  incom-
                      ing requests. The default is 4.  It is typ-
                      ically not useful to set this  much  higher
                      than  the  number  of CPU cores on the mem-
                      cached server.

     -D <char>        Use the <char> as the delimiter between key
                      prefixes and IDs. This is used for per-pre-
                      fix statistics reporting.  The default is :
                      (colon).  If this option is specified, sta-
                      tistics collection is turned  on  automati-
                      cally;  if not, then it can be turned on by
                      sending the stats detail on command to  the

SunOS 5.11           Last change: March 2008                    3

Administration Commands                             memcached(1M)


     The following exit values are returned:

     0    command executed successfully

     1    error in executing the command

     memcached  package  for Solaris (service/memcached) includes
     files necessary to  register  with  the  Service  Management
     Facility   described  in  SMF(5).  The  following  procedure
     describes the steps to automate the service management using

         1.   Add  other parameters to be passed to the memcached
              service instance.

              example: specify the server to use 1024 MB of  mem-

                example% svccfg
                svc:> select memcached
                svc:/application/database/memcached> setprop memcached/options=("-m" "1024")
                svc:/application/database/memcached> quit
                example% svcadm refresh memcached

         Note -

           The  arguments  cannot  be  passed  as a single string
           because of a limitation in svccfg.

         2.   Enable memcached .

                example% svcadm enable memcached

              The  state  of  the  service  instance  changes  to
              online,  and the memcached service instance must be

                example% svcs memcached
                STATE          STIME    FMRI
                online          1:19:15 svc:/application/database/memcached:default

         3.   To  disable  shutdown  and  automatic  restart   of

SunOS 5.11           Last change: March 2008                    4

Administration Commands                             memcached(1M)

              memcached service instance,

                example% svcadm disable memcached

     You  can  use  RBAC(5) to authorize otherwise non-privileged
     users to manage memcached services.  To  let  a  user  named
     myuser  change  memcached  value  properties and manage mem-
     cached  service  states,   add   the   following   line   to

       myuser::::type=role;profiles=Memcached Administration,All

     The  memcached  package consists of the memcached server and
     man pages for the server.

     Client libraries can be made available by  installing  other

     The  memcached  server is based on the memcached open-source
     software available from

     When the memcached server is started, it listens for network
     requests  on  a  TCP port and/or a UDP port. It is important
     for the security of the network that you protect this  port,
     for  example, by blocking access to this port in a firewall.

     The default TCP port number to use is 11211.

     You may use the -p option to set another  TCP  port  number.
     There  is  no  default  UDP  port number. You can use the -U
     option to set a UDP port number.

     If you are running memcached on a server with multiple  net-
     work  interfaces,  you can restrict vulnerability by binding
     memcached to a single interface by using the -l option.

     Caution -

       Note that memcached was designed for  speed  and  not  for
       security.  There  is no authentication of requests that go
       in to the memcached  servers,  and  communication  is  not
       encrypted.  The  network  that  your memcached servers and

SunOS 5.11           Last change: March 2008                    5

Administration Commands                             memcached(1M)

       clients run within should be safe-guarded against  network

     See   attributes(5)   for   descriptions  of  the  following

     |Availability   | service/memcached |
     |Stability      | Uncommitted       |

     Additional   documentation   (FAQ)   can   be    found    at


     The  memcached  daemon is copyright Danga Interactive and is
     distributed under  the BSD license.  memcached  clients  are
     licensed separately.

     This   software   was   built   from   source  available  at   The   original
     community    source   was   downloaded   from    http://mem-

     Further information about this software can be found on  the
     open source community website at

SunOS 5.11           Last change: March 2008                    6