Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major point of this is to create a pool of processors and a connection pool. The connection pool holds concurrency + 2 connections to the faktory server and each processor has it's own work loop and fetch cycle. The connection pool is managed by the manager and all lifecycle hooks are syndicated to the pool of workers. A processor is an object that polls for jobs--checking out a connection for each command it executes. It's working loop is an infinite for loop with awaiting on the fetch and job execution. ,_______________, | faktory | ----------------- | ,________________ / | \ ,___________, ,___________, ,___________, | processor | | processor | | processor | ------------- ------------- ------------- \ | / --------------- | ,-------------, | manager | --------------- Where each processor has its own connection to the faktory server and processor pools are managed by a manager. A manager has n concurrency and that's the number of processors and connections that will be started to serve that pool. All of this lives within one node process. Benchmarks: pool: › bench/push pushed: 30000 duration: 1.35946858s jobs/s: 22067 › bench/push pushed: 30000 duration: 1.430357713s jobs/s: 20974 › bench/push pushed: 30000 duration: 1.3823066609999999s jobs/s: 21703 › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 6.7563684649999995s Jobs/s: 4440 › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 6.653886883s Jobs/s: 4509 › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 6.515825339s Jobs/s: 4604 =============================================================== pool without await this.execute and sleeping in the loop Jobs processed: 30000 Concurrency: NaN Duration: 5.220679224s Jobs/s: 5746 ================================================================ pool without log › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 3.288809578s Jobs/s: 9122 › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 3.31144746s Jobs/s: 9059 › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 3.2611014s Jobs/s: 9199 ================================================================ master: › bench/push pushed: 30000 duration: 1.382443728s jobs/s: 21701 › bench/push pushed: 30000 duration: 1.378380277s jobs/s: 21765 › bench/push pushed: 30000 duration: 1.376629829s jobs/s: 21792 › bench/work Jobs processed: 30000 Concurrency: 20 Duration: 4.639131743s Jobs/s: 6467 › bench/push Jobs processed: 30000 Concurrency: NaN Duration: 4.458317899s Jobs/s: 6729 › bench/push Jobs processed: 30000 Concurrency: NaN Duration: 4.361462364s Jobs/s: 6878 ================================================ master w/ connection pool › bench/work Jobs processed: 30000 Concurrency: NaN Duration: 4.595406734s Jobs/s: 6528 › bench/work Jobs processed: 30000 Concurrency: NaN Duration: 4.602304733s Jobs/s: 6518
- Loading branch information