Go to main content

man pages section 1M: System Administration Commands

Exit Print View

Updated: July 2017

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(1M)               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 alle-
       viate database load in dynamic web applications 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 daemon.

       The options supported by the memcached command are described below.

       -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 installation. 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 simultaneous con-
                        nections; the default is 1024.

       -k               Lock down all paged memory.

                        Use this option with caution with  large  caches.  For
                        information  about  the configuration suggestions, see
                        the README and the memcached home page.

       -L               Preallocate memory and use large memory pages if  pos-

                        This  option  will preallocate cache memory for object
                        storage.  See description of -m option for a  specifi-
                        cation 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 per-

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

       -U <num>         Listen on the UDP port <num>.  The default is 0, mean-
                        ing that the UDP protocol is disabled.

       -s <filename>    Unix socket path to listen on (disables listening sup-
                        port 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  maximum  allow-

       -b               Run a managed instance.

       -f <factor>      Use  this option to specify <factor> as the multiplier
                        for computing the sizes of memory  chunks  that  items
                        are stored in. A lower value may result in less wasted
                        memory depending on the total amount of memory  avail-
                        able  and  the distribution of item 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 signifi-
                        cant 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 per-
                        centage of your items  to  fit  in  the  most  densely
                        packed smallest chunks.

       -h               Show  the  version  of  memcached  and  a  summary  of

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

       -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 incoming requests.
                        The default is 4.  It is typically not useful  to  set
                        this  much  higher than the number of CPU cores on the
                        memcached server.

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

       The following exit values are returned:

       0    command executed successfully

       1    error in executing the command

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

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

                  example: specify the server to use 1024 MB of memory

                    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 started:

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

           3.     To  disable shutdown and automatic restart of memcached ser-
                  vice instance,

                    example% svcadm disable memcached

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

         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 packages.

       The memcached server is based on  the  memcached  open-source  software
       available from http://www.danga.com/memcached/.

       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

       If you are running memcached on a server with multiple  network  inter-
       faces,  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  clients  run  within  should be safe-guarded
         against network attacks.

       See attributes(5) for descriptions of the following attributes:

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

       Additional documentation (FAQ) can be  found  at  http://www.eu.social-


       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
       https://java.net/projects/solaris-userland.    The  original  community
       source    was    downloaded    from     http://memcached.org/files/mem-

       Further information about this software can be found on the open source
       community website at http://memcached.org/.

SunOS 5.11                        March 2008                     memcached(1M)