diff --git a/js/ioredis/lib/redisManager.js b/js/ioredis/lib/redisManager.js index a895dbd..e739be2 100644 --- a/js/ioredis/lib/redisManager.js +++ b/js/ioredis/lib/redisManager.js @@ -73,34 +73,10 @@ async function runBenchmark(argv) { } ); - // Fetch slot info to build map - const slots = await cluster.cluster('slots'); - if (!slots || slots.length === 0) { - throw new Error('Cluster has no slot assignments. Check node health.'); - } - // Create a standalone client for each slot range - for (const [startSlot, endSlot, [ip, port]] of slots) { - const client = new Redis({ - host: ip, - port, - username: argv.user || undefined, - password: argv.a || undefined, - maxRetriesPerRequest: 1, - enableReadyCheck: true, - lazyConnect: false, - connectTimeout: argv['redis-timeout'], - slotsRefreshInterval: argv['slot-refresh-interval'] - }); - // Save one entry per slot - for (let slot = startSlot; slot <= endSlot; slot++) { - slotClientMap.set(slot, client); - } - - nodeAddresses.push(`${ip}:${port}`); - clients.push(client); - } + clients.push(cluster); + console.log(`Cluster mode - using ${nodeAddresses.length} unique nodes`); } else { const client = new Redis(redisOptions); @@ -153,14 +129,7 @@ async function runBenchmark(argv) { const publisherName = `publisher#${clientId}`; let client; - if (argv.mode === 'spublish' && argv['oss-cluster-api-distribute-subscribers']) { - // For sharded publish in cluster mode, get the appropriate client for the first channel - const slot = clusterKeySlot(channels[0]); - client = slotClientMap.get(slot); - } else { - // For regular publish or non-cluster, round-robin assignment - client = clients[clientId % clients.length]; - } + client = clients[0] if (argv.verbose) { console.log(`Publisher ${clientId} targeting channels ${channels}`); diff --git a/js/ioredis/package-lock.json b/js/ioredis/package-lock.json index e6b58bb..142e3b1 100644 --- a/js/ioredis/package-lock.json +++ b/js/ioredis/package-lock.json @@ -12,7 +12,6 @@ "cluster-key-slot": "^1.1.0", "hdr-histogram-js": "^2.0.1", "ioredis": "^4.30.0", - "limiter": "^3.0.0", "seedrandom": "^3.0.5", "yargs": "^17.7.2" }, @@ -563,12 +562,6 @@ "url": "https://github.com/sponsors/antonk52" } }, - "node_modules/limiter": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/limiter/-/limiter-3.0.0.tgz", - "integrity": "sha512-hev7DuXojsTFl2YwyzUJMDnZ/qBDd3yZQLSH3aD4tdL1cqfc3TMnoecEJtWFaQFdErZsKoFMBTxF/FBSkgDbEg==", - "license": "MIT" - }, "node_modules/lint-staged": { "version": "15.5.1", "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.5.1.tgz",