Re:Piscina – The Node.js Worker Pool
by rektide on Tuesday March 23, 2021 @04:06PM
(#26559749)
Knex, the SQL query builder, uses Tarn.js[1] for connection pooling to the db.
I've been using Tarn a bunch at work recently. We're doing some batch jobs, and I'm queuing work at each stage in Tarn.js pools. I created my own enqueue function that waits until the pool is less than a high-water mark in size before enqueueing. Then the pool has however many workers running.
Neither of these are off-thread pools. But they help a lot of for managing multiple async operations.
I've been using Tarn a bunch at work recently. We're doing some batch jobs, and I'm queuing work at each stage in Tarn.js pools. I created my own enqueue function that waits until the pool is less than a high-water mark in size before enqueueing. Then the pool has however many workers running.
Neither of these are off-thread pools. But they help a lot of for managing multiple async operations.
[1] https://github.com/vincit/tarn.js/