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

[GitHub] activemq-artemis pull request #1081: ARTEMIS-1011 adjust slow-consumer detec...

GitHub user jbertram opened a pull request:

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

    ARTEMIS-1011 adjust slow-consumer detection logic

    Adjust slow-consumer detection logic to use the number of messages in
    the queue and not just the number of messages added since the last
    check. This means the getRate() method now returns the rate of messages
    which it *could* have dispatched since the last check rather than the
    rate at which it received messages. This is a more reliable metric to
    ensure the slow-consumer detection logic doesn't flag a consumer as
    slow unfairly. Althoug the reliability will come at a performance cost
    since getMessageCount() must lock the queue.

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

    $ git pull https://github.com/jbertram/activemq-artemis ARTEMIS-1011

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

    https://github.com/apache/activemq-artemis/pull/1081.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 #1081
    
----
commit 85ddb298bc97a4caddd1cedbfad8d03eb8a725da
Author: Justin Bertram <jb...@apache.org>
Date:   2017-03-09T14:11:00Z

    ARTEMIS-1011 adjust slow-consumer detection logic
    
    Adjust slow-consumer detection logic to use the number of messages in
    the queue and not just the number of messages added since the last
    check. This means the getRate() method now returns the rate of messages
    which it *could* have dispatched since the last check rather than the
    rate at which it received messages. This is a more reliable metric to
    ensure the slow-consumer detection logic doesn't flag a consumer as
    slow unfairly. Althoug the reliability will come at a performance cost
    since getMessageCount() must lock the queue.

----


---
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 #1081: ARTEMIS-1011 adjust slow-consumer detec...

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/1081#discussion_r105276124
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java ---
    @@ -244,6 +245,49 @@ public void testSlowConsumerSpared() throws Exception {
        }
     
        @Test
    +   public void testSlowConsumerWithBurst() throws Exception {
    +      ClientSessionFactory sf = createSessionFactory(locator);
    +
    +      ClientSession session = addClientSession(sf.createSession(true, true));
    +
    +      ClientProducer producer = addClientProducer(session.createProducer(QUEUE));
    +
    +      final int numMessages = 20;
    +
    +      for (int i = 0; i < numMessages; i++) {
    +         producer.send(createTextMessage(session, "m" + i));
    +      }
    +
    +      assertPaging();
    +
    +      final Queue queue = server.locateQueue(QUEUE);
    +
    +      queue.getRate();
    +
    +      logger.info("Creating consumer...");
    +
    +      ClientConsumer consumer = addClientConsumer(session.createConsumer(QUEUE));
    +      session.start();
    +
    --- End diff --
    
    Little java8 trick:
    
          Wait.waitFor(() -> queue.getConsumerCount() == 0);
    
    
    not asking a chnage.. just a tip for future use


---
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 #1081: ARTEMIS-1011 adjust slow-consumer detec...

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/1081#discussion_r105275625
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java ---
    @@ -244,6 +245,49 @@ public void testSlowConsumerSpared() throws Exception {
        }
     
        @Test
    +   public void testSlowConsumerWithBurst() throws Exception {
    +      ClientSessionFactory sf = createSessionFactory(locator);
    +
    +      ClientSession session = addClientSession(sf.createSession(true, true));
    +
    +      ClientProducer producer = addClientProducer(session.createProducer(QUEUE));
    +
    +      final int numMessages = 20;
    +
    +      for (int i = 0; i < numMessages; i++) {
    +         producer.send(createTextMessage(session, "m" + i));
    +      }
    +
    +      assertPaging();
    +
    +      final Queue queue = server.locateQueue(QUEUE);
    +
    +      queue.getRate();
    +
    +      logger.info("Creating consumer...");
    +
    +      ClientConsumer consumer = addClientConsumer(session.createConsumer(QUEUE));
    +      session.start();
    +
    +      Wait.waitFor(new Wait.Condition() {
    +         @Override
    +         public boolean isSatisfied() throws Exception {
    +            forceGC();
    --- End diff --
    
    was this needed? forceGC is heavy


---
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 #1081: ARTEMIS-1011 adjust slow-consumer detec...

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

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


---
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.
---