NGINX Unit and vibe.d Integration Performance

Kyle Ingraham kyle at kyleingraham.com
Mon Oct 28 19:57:41 UTC 2024


On Monday, 28 October 2024 at 18:37:18 UTC, Salih Dincer wrote:
> Apparently, vibe.d's event loop is not fully compatible with 
> NGINX Unit's loop, causing performance loss. I wonder if it 
> would be wise to use something like an IntrusiveQueue or task 
> pool to make it compatible? For example, something like this:
> ...

You are right that they aren't compatible. Running them in the 
same thread was a no-go (which makes sense given they both want 
to control when code is run).

How would you suggest reading from the queue you provided in the 
vibe.d thread? I tried something similar with 
[lock-free](https://code.dlang.org/packages/lock-free). It was 
easy to push into the queue efficiently from Unit's thread but 
popping from it in vibe.d's was difficult:
- Polling too little killed performance and too often wrecked CPU 
usage.
- Using message passing reduced performance quite a bit.
- Batching reads was hard because it was tricky balancing 
performance for single requests with performance for streams of 
them.


More information about the Digitalmars-d-learn mailing list