You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by franz1981 <gi...@git.apache.org> on 2017/04/06 09:40:59 UTC

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

GitHub user franz1981 opened a pull request:

    https://github.com/apache/activemq-artemis/pull/1176

    ARTEMIS-1095 Netty's WriteBufferWaterMark configuration via TransportConstants

    By default Netty uses the write buffer high/low water mark to perform flow control while on the event loop.
    I've added the configuration (+ default) of these values and the documentation that explain their purpose.
    I've not changed too much the original default values defined by Netty to not impact the current tests and known behaviours around the Netty transport usage.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/franz1981/activemq-artemis write_buffer_water_mark_config

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/1176.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1176
    
----
commit 999659f4e2e70e0d5a064a6dcd84cb78eb4bcfd3
Author: Francesco Nigro <ni...@gmail.com>
Date:   2017-04-06T09:33:29Z

    ARTEMIS-1095 Netty's WriteBufferWaterMark configuration via TransportConstants

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis issue #1176: ARTEMIS-1095 Netty's WriteBufferWaterMark conf...

Posted by franz1981 <gi...@git.apache.org>.
Github user franz1981 commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1176
  
    @clebertsuconic @mtaylor This setting could (positively, hopefully) impact on some of your use cases we have discussed. Defining "sane" values seems to affect when Netty's event loop "wakeup" and perform   any writes. [Here](http://normanmaurer.me/presentations/2014-twitter-meetup-netty/slides.html#9.0) is the critical point about it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by franz1981 <gi...@git.apache.org>.
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1176#discussion_r110152785
  
    --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java ---
    @@ -125,6 +125,10 @@
         */
        public static final String NIO_REMOTING_THREADS_PROPNAME = "nioRemotingThreads";
     
    +   public static final String NETTY_WRITE_BUFFER_LOW_WATER_MARK_PROPNAME = "nettyWriteBufferLowWaterMark";
    --- End diff --
    
    You're right, I've used the Netty prefix just because that values are valid only under Netty transport, but a different name is welcome 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1176#discussion_r110152124
  
    --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java ---
    @@ -183,6 +187,10 @@
     
        public static final int DEFAULT_TCP_RECEIVEBUFFER_SIZE = 1024 * 1024;
     
    +   public static final int DEFAULT_NETTY_WRITE_BUFFER_LOW_WATER_MARK = 32 * 1024;
    --- End diff --
    
    This clashes with DEFAULT_TCP_RECEIVERBUFFER_SIZE, doesn't? 
    
    We need to put this value down though.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by franz1981 <gi...@git.apache.org>.
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1176#discussion_r110154681
  
    --- Diff: docs/user-manual/en/configuring-transports.md ---
    @@ -239,6 +239,17 @@ Netty for simple TCP:
     -   `tcpReceiveBufferSize`. This parameter determines the size of the
         TCP receive buffer in bytes. The default value for this property is
         `32768` bytes (32KiB).
    +    
    +-   `nettyWriteBufferLowWaterMark`. This parameter determines the low water mark of 
    +    the Netty write buffer. Once the number of bytes queued in the write buffer exceeded 
    +    the high water mark and then dropped down below this value, Netty's channel 
    +    will start to be writable again. The default value for this property is 
    +    `32768` bytes (32KiB).
    + 
    +-   `nettyWriteBufferHighWaterMark`. This parameter determines the high water mark of 
    +    the Netty write buffer. If the number of bytes queued in the write buffer exceeds 
    +    this value, Netty's channel will start to be not writable. The default value for 
    +    this property is `131072` bytes (128KiB).
    --- End diff --
    
    yes, I'll change it in no time :+1: 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by franz1981 <gi...@git.apache.org>.
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1176#discussion_r110154545
  
    --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java ---
    @@ -183,6 +187,10 @@
     
        public static final int DEFAULT_TCP_RECEIVEBUFFER_SIZE = 1024 * 1024;
     
    +   public static final int DEFAULT_NETTY_WRITE_BUFFER_LOW_WATER_MARK = 32 * 1024;
    --- End diff --
    
    In theory the 2 values are not dependent:  TCP will fragment the data if bigger than its MTU (1460 bytes for Ethernet + TCPv4), hence you could have any size for the TCP buffer (>=MTU AFAIK).
    The water marks values affect only the buffering performed by Netty and how many times it will call channelWritabilityChanged, dependently by our writing rate and size.
    By consequence it will change how many times channel::isWritable will be true.
    I've used the doc and http://normanmaurer.me/presentations/2014-twitter-meetup-netty/slides.html#9.0 and http://normanmaurer.me/presentations/2014-twitter-meetup-netty/slides.html#10.0 to have an idea about it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1176#discussion_r110152342
  
    --- Diff: docs/user-manual/en/configuring-transports.md ---
    @@ -239,6 +239,17 @@ Netty for simple TCP:
     -   `tcpReceiveBufferSize`. This parameter determines the size of the
         TCP receive buffer in bytes. The default value for this property is
         `32768` bytes (32KiB).
    +    
    +-   `nettyWriteBufferLowWaterMark`. This parameter determines the low water mark of 
    +    the Netty write buffer. Once the number of bytes queued in the write buffer exceeded 
    +    the high water mark and then dropped down below this value, Netty's channel 
    +    will start to be writable again. The default value for this property is 
    +    `32768` bytes (32KiB).
    + 
    +-   `nettyWriteBufferHighWaterMark`. This parameter determines the high water mark of 
    +    the Netty write buffer. If the number of bytes queued in the write buffer exceeds 
    +    this value, Netty's channel will start to be not writable. The default value for 
    +    this property is `131072` bytes (128KiB).
    --- End diff --
    
    Can you add a test where you validate this parameter through an URI?
    
    Look for a test parsing the Connector and Acceptor, and validate if the value was parsed, please?
    
    
    
    I will need this PR done ASAP, as I was doing something similar on my replication tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/1176


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1176: ARTEMIS-1095 Netty's WriteBufferWaterMa...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1176#discussion_r110151986
  
    --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java ---
    @@ -125,6 +125,10 @@
         */
        public static final String NIO_REMOTING_THREADS_PROPNAME = "nioRemotingThreads";
     
    +   public static final String NETTY_WRITE_BUFFER_LOW_WATER_MARK_PROPNAME = "nettyWriteBufferLowWaterMark";
    --- End diff --
    
    If you are exposing the parameter to users, can you rename it as bufferLowWatermark
    and bufferHighWaternark?
    
    It's more independent from Netty and more user friendly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---