Skip to content

Instantly share code, notes, and snippets.

View GavinDmello's full-sized avatar
🏠
Working from home

Gavin D'mello GavinDmello

🏠
Working from home
  • Dublin, Ireland
View GitHub Profile
@GavinDmello
GavinDmello / gist:d614940e0f89383f3f471b90ec121360
Last active May 13, 2016 08:20
This is the test client that we are trying to run.
//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.
*/
@GavinDmello
GavinDmello / gist:b5f3329244ffa8263fe34cf0b9cf44da
Created September 2, 2016 20:55
Test implementation of client list
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)
}))
@GavinDmello
GavinDmello / bench.js
Last active January 10, 2017 11:01
Bench connections in mqtt
/*
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
@GavinDmello
GavinDmello / fastbench.js
Created January 16, 2017 06:24
bench connections using fastq
// 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()
@GavinDmello
GavinDmello / JavaDate.java
Last active May 10, 2017 12:06
Readable dates in java
/**
*
* @author gavindmello
*/
import java.time.*;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;