Nodejsλ Single Threadκ° μλλ€.
const crypto = require('crypto');
const startDate = Date.now();
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 1 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 2 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 3 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 4 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 5 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 6 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 7 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 8 : ', Date.now() - startDate);
});
crypto.pbkdf2('bugtype', 'javascript', 100000, 512, 'sha512', () => {
console.log('JOB 9 : ', Date.now() - startDate);
});
// κ²°κ³Ό ( νμλ μΏΌλμ½μ΄ )
JOB 2 : 542
JOB 4 : 548
JOB 3 : 549
JOB 1 : 552
// λ€μ μμ
JOB 7 : 1077
JOB 5 : 1077
JOB 8 : 1077
JOB 6 : 1079
// λ€μ μμ
JOB 9 : 1584
process.env.UV_THREADPOOL_SIZE = 8; // μ μΌ μμ μ μΈ
μμ κ°μ μ΅μ
μ μ€μ λ°κΏ μ μλ€.
JOB 1 : 1222
JOB 7 : 1245
JOB 2 : 1247
JOB 3 : 1253
JOB 6 : 1255
JOB 4 : 1262
JOB 8 : 1265
JOB 5 : 1270
// λ€μ μμ
JOB 9 : 1747
κ²°κ³Όλ μμ κ°λ€. κ·Όλ° κ²°κ³Όλ₯Ό 보면 μκ² μ§λ§, 1~4λ²μ μμ
μ΄ μ²μλ³΄λ€ 2λ°°μ μκ°μ΄ κ±Έλ Έλ€.