netty-socketio
netty-socketio copied to clipboard
Load Test - Netty writeAndFlush
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:
- A user joins a room.
- 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.
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.