-
-
Save galderz/ba1bb305b8c592cbece3da566edfb12b to your computer and use it in GitHub Desktop.
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
var _ = require('underscore'); | |
var infinispan = require('../lib/infinispan'); | |
var Promise = require('promise'); | |
var heapdump = require('heapdump'); | |
var connected = infinispan.client({port: 11222, host: '127.0.0.1'},{cacheName: 'namedCache'}); | |
console.log("Connected to JDG server"); | |
connected.then(function (client) { | |
var sessionA = "Arnav"; | |
var put = client.put(sessionA, "test"); | |
var afterPut = put.then(function() { | |
//console.log("After put, heapUsed: "+process.memoryUsage().heapUsed); | |
heapdump.writeSnapshot('/tmp/' + Date.now() + '.heapsnapshot'); | |
}); | |
var get1 = afterPut.then(function test_get1() { | |
return client.get(sessionA); | |
}); | |
var logGet1 = get1.then(function test_log_get1(value) { | |
console.log("[get1] value: " + value); | |
}); | |
var get2 = logGet1.then(function test_get2() { | |
return client.get(sessionA); | |
}); | |
var logGet2 = get2.then(function test_log_get2(value) { | |
console.log("[get2] value: " + value); | |
}); | |
var get3 = logGet2.then(function test_get3() { | |
return client.get(sessionA); | |
}); | |
var logGet3 = get3.then(function test_log_get3(value) { | |
console.log("[get3] value: " + value); | |
}); | |
var dumpAfterGet3 = logGet3.then(function test_dump_after_get3() { | |
global.gc(); | |
//console.log("After get2, heapUsed: "+process.memoryUsage().heapUsed); | |
heapdump.writeSnapshot('/tmp/' + Date.now() + '.heapsnapshot'); | |
}); | |
return dumpAfterGet3.then(function test_disconnect() { | |
return client.disconnect(); | |
}); | |
}).catch(function(err) { | |
console.log("connect error", err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment