Closed GaryWilber closed 1 year ago
Ping @webmakersteve , @iradul, @eandersson , @BlizzTom
Hello,
I am currently experiencing the same issue. I have 4 consumers listening and I am not longer able to use my express API.
Is it still planned to merge this PR?
Thank you in advance and thank you for the work you are doing.
Regards.
The current consume method works like this:
That logic is not great. The while() loop is essentially blocking one of the 4 node.js worker threads from doing any other work because it took over with its infinite loop. You can confirm this yourself by starting an HTTP server & then calling the consume method. The HTTP server will not process any requests because it’s unable to schedule the work since that node.js worker thread is blocked – this repro’s 100% of the time for me on node.js 16 with a fastify webserver.
Some reading regarding node.js & it’s worker threads / thread pool to learn more:
This PR does the following:
These changes result in a 30% latency reduction for my scenario. My application has been running with these changes for a while now and it has been stable.
This PR should be checked in as a squash commit due to the amount of commits.