Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple set commands are sent in single packet to server - no pipeline in code - auto pipeline is also not enabled. #1866

Open
vgnanasekaran opened this issue Mar 11, 2024 · 2 comments

Comments

@vgnanasekaran
Copy link

Please find below the code that sends 100 set commands in a for loop. For some execution each set command is sent as individual packet to redis server and each response ("ok") is received as individual packet.

one-set-one-packet

On some executions multiple set commands are sent in one packet to redis server and the responses are grouped into one packet.

multiple-set-one-packet

const Redis = require('ioredis');

let endpoints = new Array(1)
endpoints[0] = { host: "ip", port: 26379};

const redis = new Redis({
sentinels: endpoints,
password: '',
name: 'mymaster',
role: 'master',
});
console.log(redis)
redis.on('connect', function(err) {
if(err) {
console.log('error: ' + JSON.stringify(err));
return;
}
console.log('[Redis] up and running!');
return;
});
for (let i = 0; i < 100; i++) {
redis.set('hello' + i, 'test' + i, 'EX', 60, function(err,result) {
console.log('set command error response: ' + err)
console.log('set command result: ' + result)
});
}

When the volume of requests is high to the node.js microservice, less packets with more number of set commands are sent to redis sentinel host. The microservice memory keeps growing and crashes with OOM.

Trying to understand how the grouping of commands happens when pipeline is not used and also the auto pipeline is not enabled.

can this grouping behavior cause memory issues as observed in my case? Is there a way to force one command per request?

ioredis version - 4.11.2

Please advice. Any pointers will be of great help. Thank you

@vgnanasekaran
Copy link
Author

@TysonAndre You have mentioned about protocol pipeline (RESP) - #1377 Is this related?

@vgnanasekaran
Copy link
Author

@luin request you to look into this issue and share your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant