Camel
  1. Camel
  2. CAMEL-4531

Expose workerCount parameter of Netty NioServerSocketChannelFactory in Camel-Netty

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.8.2, 2.9.0
    • Component/s: camel-netty
    • Labels:
      None
    • Environment:

      ALL

    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Unknown

      Description

      Camel-netty component did not implement oio model of netty, we can only use nio one, however it uses default workerCount parameter from Netty, which is cpu_core_threads*2.

      This is far from enough when the underlying app is a little bit slow, e.g. a traditional transactional application. In this situation NioWorker threads become an obvious bottle neck.

      I think that exposing workerCount is a very practical yet effective way for one to broaden the usage scenario of camel-netty in various network communication/application environment.

      I add a workerCount parameter in the configuration, one can use it in the Endpoint URL: "netty:tcp://0.0.0.0:1111?...&workerCount=256&...". I leave the default value to 0 so that one can use Netty default policy by omit the param.

      I have tested the patch in a 2 core(4 Threads) machine, using 256 workers, it significantly improves the performance by 15 times, than the default parameter of only 8 workers, while CPU usage only increase 5 times.

      1. workerCount-2.9.patch
        2 kB
        edge wang
      2. workerCount.patch
        2 kB
        edge wang

        Activity

        Hide
        edge wang added a comment -

        Hi, glad seeing my suggestion is adopted, thanks.

        Show
        edge wang added a comment - Hi, glad seeing my suggestion is adopted, thanks.
        Willem Jiang made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.8.2 [ 12317866 ]
        Fix Version/s 2.9.0 [ 12316374 ]
        Resolution Fixed [ 1 ]
        Hide
        Willem Jiang added a comment -

        Applied patch with thanks to Edge.

        Show
        Willem Jiang added a comment - Applied patch with thanks to Edge.
        ningjiang committed 1182387 (3 files)
        Willem Ning Jiang <ningjiang@apache.org> committed 4b3c664735d7f147fe2f084c2cce7250ac9a1ac3 (2 files)
        Reviews: none

        Merged revisions 1182369 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
        ........
          r1182369 | ningjiang | 2011-10-12 21:54:32 +0800 (Wed, 12 Oct 2011) | 1 line
          
          CAMEL-4531 Added the option of workCount
        ........


        git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x@1182387 13f79535-47bb-0310-9956-ffa450edef68

        Willem Jiang made changes -
        Assignee Willem Jiang [ njiang ]
        edge wang made changes -
        Attachment workerCount-2.9.patch [ 12498608 ]
        Hide
        edge wang added a comment -

        Upload a patch against 2.9-RC, the last patch is only for 2.8.1, since there is some difference in NettyConsumer.java between 2.8.1 and 2.9, the last patch cannot be applied to 2.9 directly.

        Show
        edge wang added a comment - Upload a patch against 2.9-RC, the last patch is only for 2.8.1, since there is some difference in NettyConsumer.java between 2.8.1 and 2.9, the last patch cannot be applied to 2.9 directly.
        edge wang made changes -
        Field Original Value New Value
        Attachment workerCount.patch [ 12498355 ]
        edge wang created issue -

          People

          • Assignee:
            Willem Jiang
            Reporter:
            edge wang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development