Node-redis: DEL limit on the number of parameters

Created on 23 Oct 2017  路  2Comments  路  Source: NodeRedis/node-redis

Is there any limit on the number of arguments that command del can handle?

question

Most helpful comment

Everything has a limit. This question intrigued me so I wrote a small script to test it out:

var
    argv    = require('yargs')
            .demand('connection')
            .demand('arglimit')
            .argv,
    redis   = require('redis'),
    connection  = require(argv.connection),
    client  = redis.createClient(connection),
    delArgs = [];

for (let i = 0; i < argv.arglimit; i += 1) {
    delArgs.push('i'+i);
}
client.del(delArgs,function(err,resp) {
    console.log(err);
    console.log(resp);
    client.quit();
});

Long story short, here is what I found:

  • Redis will throw a Protocol error: invalid multibulk length error between 1,004,000 arguments and 1,005,000 arguments..
  • Node does fine until about 8,000,000 arguments, after that FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory errors start cropping up.

So, there is a limit, but it's gigantic.

All 2 comments

Everything has a limit. This question intrigued me so I wrote a small script to test it out:

var
    argv    = require('yargs')
            .demand('connection')
            .demand('arglimit')
            .argv,
    redis   = require('redis'),
    connection  = require(argv.connection),
    client  = redis.createClient(connection),
    delArgs = [];

for (let i = 0; i < argv.arglimit; i += 1) {
    delArgs.push('i'+i);
}
client.del(delArgs,function(err,resp) {
    console.log(err);
    console.log(resp);
    client.quit();
});

Long story short, here is what I found:

  • Redis will throw a Protocol error: invalid multibulk length error between 1,004,000 arguments and 1,005,000 arguments..
  • Node does fine until about 8,000,000 arguments, after that FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory errors start cropping up.

So, there is a limit, but it's gigantic.

That's pretty cool! Thanks @stockholmux

Was this page helpful?
0 / 5 - 0 ratings

Related issues

id0Sch picture id0Sch  路  4Comments

shmendo picture shmendo  路  6Comments

adamgajzlerowicz picture adamgajzlerowicz  路  4Comments

dotSlashLu picture dotSlashLu  路  5Comments

Mickael-van-der-Beek picture Mickael-van-der-Beek  路  6Comments