Last active
October 9, 2018 11:53
-
-
Save pilshchikov/8a4bdb03a8304136c22c9bf7217ee447 to your computer and use it in GitHub Desktop.
Ignite Nodejs thin client bench
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
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