netty-socketio icon indicating copy to clipboard operation
netty-socketio copied to clipboard

Load Test - Netty writeAndFlush

Open ffarhanaamin opened this issue 2 years ago • 1 comments

Hi,

Currently, I'm evaluating netty-sockio for the development of our next-generation real-time connect platform. I've conducted stress tests and everything seems to be working fine until I encountered some performance issues when broadcasting events to the connected clients.

Allow me to explain the use case briefly:

  1. A user joins a room.
  2. The netty-socketio server broadcasts the join event to all connected clients.

Regarding load testing, we've simulated a scenario with 2000 clients, and every 10ms, a new client joins the channel. However, when running this test with broadcasting enabled, we noticed a significant increase in CPU load. After analyzing with a profiler, we observed contention on the following netty call:

writeAndFlush

To overcome this issue, we are looking for potential workarounds. Are there any configurable parameters within the socketio server that can be tuned to optimize performance? Additionally, is it possible to use the FlushConsolidationHandler to avoid the writeAndFlush call on every event?

In summary, our main objective is to effectively scale the broadcast events to connected clients. We would greatly appreciate your advice on the best approach to achieve this.

ffarhanaamin avatar Aug 05 '23 11:08 ffarhanaamin

You can add FlushConsolidationHandler in extended SocketIOChannelInitializer object through com.corundumstudio.socketio.SocketIOServer#setPipelineFactory() method. Let me know if you'll have a success with this handler.

mrniko avatar Aug 23 '23 05:08 mrniko