Skip to content

Instantly share code, notes, and snippets.

@pilshchikov
Last active October 9, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pilshchikov/8a4bdb03a8304136c22c9bf7217ee447 to your computer and use it in GitHub Desktop.
Save pilshchikov/8a4bdb03a8304136c22c9bf7217ee447 to your computer and use it in GitHub Desktop.
Ignite Nodejs thin client bench
IgniteClient = require('apache-ignite-client');
IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;
ENDPOINT = '[grid ip]:10800';
igniteClient = new IgniteClient();
async function start() {
await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT));
setTimeout(run, 7);
}
async function run() {
start_time = Math.round(new Date().getTime() /1000);
end_time = start_time + 120;
last_displayed_time = start_time;
counter = 0;
last_key = 0;
cache = await igniteClient.getOrCreateCache("cache_for_js");
while (end_time > Math.round(new Date().getTime() /1000)) {
current_time = Math.round(new Date().getTime() /1000);
if (current_time != last_displayed_time) {
last_displayed_time = current_time;
time_to_pass = current_time - start_time;
console.log("time: %d | counter: %d | values count: %d", time_to_pass, counter, last_key);
counter = 0;
}
counter++;
last_key++;
await cache.put(last_key, last_key * 2);
}
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment