This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author gavindmello | |
*/ | |
import java.time.*; | |
import java.sql.Timestamp; | |
import java.text.SimpleDateFormat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install mqtt fastq | |
// command to run : node fastbench 25000 | |
'use strict' | |
var queue = require('fastq')(worker, 1) | |
var mqtt = require('mqtt') | |
var connected = 1 | |
var clients = [] | |
var count = 0 | |
var st = Date.now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
run file with command node bench 10000 | |
where 10000 is the number of clients you want to connect | |
*/ | |
'use strict' | |
var queue = require('fastq')(worker, 10) | |
var mqtt = require('mqtt') | |
var connected = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MemoryPersistence.prototype.getClientList = function (topic, cb) { | |
var that = this | |
getClients(topic, function getClients(clientList) { | |
var count = 0 | |
cb(from2.obj(function match(size, next) { | |
if (count >= clientList.length) return next(null, null) | |
var chunk = clientList[count] | |
count++ | |
next(null, chunk) | |
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Sender client | |
/* | |
The sample command to run is this : | |
node --expose-gc filname.js 1 2 20000 | |
So, | |
the process.argv[2] = lower limit of CPU. | |
the process.argv[3] = upper limit of CPU. | |
the process.argv[4] = Number of messages. | |
*/ |