Add exhaustive NATS factorial, MQTT/UDP probes, and optimal-config report.
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
Compares r=1 vs r=3, file vs memory, reconnect tax, and projects three HP DL360 Gen10 NVMe + 10GbE boxes. Keep NATS; do not switch to MQTT/UDP.
This commit is contained in:
parent
a7a7ec86ce
commit
c83f1c6717
77 changed files with 5089 additions and 4 deletions
33
packages/verae-nats-cluster/scripts/mqtt-probe.mjs
Executable file
33
packages/verae-nats-cluster/scripts/mqtt-probe.mjs
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env node
|
||||
/** MQTT QoS0 publish rate against nats-server MQTT gateway. */
|
||||
import mqtt from "mqtt";
|
||||
|
||||
const url = process.argv[2] || "mqtt://10.10.10.21:1883";
|
||||
const count = Number(process.argv[3] || 5000);
|
||||
const size = Number(process.argv[4] || 128);
|
||||
const payload = Buffer.alloc(size, 9);
|
||||
const topic = `bench/mqtt/${process.pid}`;
|
||||
|
||||
const c = mqtt.connect(url, { reconnectPeriod: 0, connectTimeout: 5000 });
|
||||
await new Promise((res, rej) => {
|
||||
c.on("connect", res);
|
||||
c.on("error", rej);
|
||||
});
|
||||
const t0 = process.hrtime.bigint();
|
||||
for (let i = 0; i < count; i++) {
|
||||
await new Promise((res, rej) => c.publish(topic, payload, { qos: 0 }, (err) => (err ? rej(err) : res())));
|
||||
}
|
||||
const ns = Number(process.hrtime.bigint() - t0);
|
||||
c.end(true);
|
||||
const sec = ns / 1e9;
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
mode: "mqtt-qos0",
|
||||
count,
|
||||
size,
|
||||
url,
|
||||
secs: Number(sec.toFixed(3)),
|
||||
pubs_per_sec: Math.round(count / sec),
|
||||
mb_per_sec: Number(((count * size) / sec / 1e6).toFixed(2)),
|
||||
}),
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue