netty/netty — pull request #70 by jeffgriffith (2011-11-21 21:02:53+00:00)
Title: Modification to allow multiple boss threads in client

During load test, our wacko testers decide to shutdown our loopback servers which receive very large numbers of long lived tcp connections via a netty-based client (400-500k). On the success path we were doing 800tps without any problem really. So in the test with the remote server shut down, I hadn't really expected any sort of problem with 800tps of connection refused exceptions. I was surprised then to see that it started falling behind in handling the requests. After some debugging and adding monitoring for requests queue size, I discovered that it was the boss thread getting behind in the connection refused case because the exception is passed down through the handlers in the boss thread rather than being passed off to a worker. at 800tps this leaves 1.5ms for each transaction to be handled. Monitoring on the boss's request queue confirmed that it fell far behind (into the thousands). The code I submitted on this branch (tested on 3.2.6) seemed to alleviate the situation by letting me specify multiple boss threads. Thoughts?