skip to Main Content

I’m newbie in Memcached. By defualt, I know that the minimum item size is 1MB. However, I want to increase this value to 4MB because I’ve got an item with 2.8MB size.

Following some instructions I have edited my /etc/memcached.conf file and add this entry: -I 4MB

enter image description here

After add this entry, I have saved the file and restart memcached with:
sudo service memcached restart

Checking the variable of configuration with this command:
echo "stats settings" | nc localhost 11211

I can see that the value of item_size_max setting to 4MB (4194304)

enter image description here

But, If I try to load information in memcached after restart the server, I’v got an error when I try to insert an item with more than 1MB.

enter image description here

What am I doing wrong in my configuration? How can I add items to memcached with more than 1MB of size?

My memcached version is:

enter image description here



  1. Due to answer of @Will from Increase Memcached Max Item Size

    You could try in command prompt

    memcached -I 4M -u

    -u is used to specify the user under which Memcached should run


    memcached -d -m 512 -I 4m

    -d memcached using this flag, it runs in the background as a service
    -m Maximum memory used by memcached

    Login or Signup to reply.
  2. The memcached package has a bunch of default props so you need to set the maxValue to 4m too. Passing in an options object when setting up the client will do the job:

    const Memcached = require('memcached');
    const memcached = new Memcached('localhost:11211', {maxValue:4194304});

    Or you can do this globally:

    const Memcached = require('memcached');
    Memcached.config.maxValue = 4194304;
    const memcached = new Memcached('localhost:11211');
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top