Skip to content

Goroutine analogue for Node.js, spreads I/O-bound routine calls to utilize thread pool (worker_threads) using balancer with event loop utilization. 🌱

License

Notifications You must be signed in to change notification settings

Ranko95/noroutine

 
 

Repository files navigation

Node Routine (noroutine)

ci status snyk npm version npm downloads/month npm downloads license

Goroutine analogue for Node.js, spreads I/O-bound routine (tasks) to utilize thread pool with worker_threads using balancer with event loop utilization (see perf_hooks API).

Usage

Install: npm install noroutine

const noroutine = require('noroutine');
const module1 = require('./module1.js');
const module2 = require('./module2.js');
noroutine.init({ modules: [module1, module2] });

(async () => {
  const res1 = await module1.method1('value1');
  const res2 = await module2.method2('value2');
  console.log({ res1, res2 });
})();

Initialization options

noroutine.init({
  modules: [module1, module2],
  pool: 5, // number of workers in thread pool
  wait: 2000, // maximum delay to wait for a free thread
  timeout: 5000, // maximum timeout for executing a functions
  monitoring: 5000, // event loop utilization monitoring interval
});

License & Contributors

Copyright (c) 2021-2022 Metarhia contributors. Noroutine is MIT licensed.
Noroutine is a part of Metarhia technology stack.

About

Goroutine analogue for Node.js, spreads I/O-bound routine calls to utilize thread pool (worker_threads) using balancer with event loop utilization. 🌱

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%