Using LMAX Disruptor for event handling reduces performance compared to Netty Handlers

512 Views Asked by At

I have written a Netty HTTP Server.

I am figuring out right way to handle Http requests
Options: (1. Netty Handlers 2. LMAX Disruptor).

I have read it somewhere that LMAX Disruptor are good for async event handling.
But after the load testing, server with LMAX Disruptor for event handling provided 70% less throughput than Netty Handler. And latency also increased by 200%.
I was getting 30k qps on an 8 core 16gb box. After using Lmax Disruptor, I am getting 10k qps.
Currently my service is just reading Json request and returning static response. I am just trying to compare raw performance as of now.

I am reading HttpRequest from SimpleChannelInboundHandler and sending to LMAX Disruptor event handler and freeing the netty worker handler whose configuration is mentioned below:

Netty IO threads: 24 and worker threads: 48

Disruptor disruptor = new Disruptor<>(new EventFactory(), 65536, DaemonThreadFactory.INSTANCE);

Is it because Disruptor creates new Daemon thread for each event?

1

There are 1 best solutions below

0
On

To get performance from disruptor, you need to hav mechanical sympathy on mind at first... Than make sure:

  1. you have pre-allocated events (please start with lower number. For example 512). Ideally they should fit into cache
  2. make sure that you do not do any allocation when setting data to event
  3. attach as many handlers as you want to events. They will run one-by-one on each event. So your first handler can pass its result to event instance and second one can read it from there and there is no need to any locking.

To more precise answer, please provide some basic info about how you create disruptor and what is your processing handler look like.