You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by revans2 <gi...@git.apache.org> on 2015/10/01 21:16:32 UTC

[GitHub] storm pull request: STORM-1078: Updated RateTracker to be thread s...

GitHub user revans2 opened a pull request:

    https://github.com/apache/storm/pull/776

    STORM-1078: Updated RateTracker to be thread safe

    , more accurate, and very fast. Removed sub-sampling of rate calculation in disruptor, because sub-sampling was more expensive than just doing the calculation.

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

    $ git pull https://github.com/revans2/incubator-storm STORM-1078

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

    https://github.com/apache/storm/pull/776.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 #776
    
----
commit dbcb138603f55fc9f234d2d3b2404a2bfc92e4d9
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Date:   2015-10-01T18:00:51Z

    Updated RateTracker to be thread safe, more accurate, and very fast.  removed subsampling of rate calculation in disruptor, because sub-sampling was more expensive than just doing the calculation.

----


---
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] storm pull request: STORM-1078: Updated RateTracker to be thread s...

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

    https://github.com/apache/storm/pull/776


---
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] storm pull request: STORM-1078: Updated RateTracker to be thread s...

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

    https://github.com/apache/storm/pull/776#discussion_r40963272
  
    --- Diff: storm-core/test/jvm/backtype/storm/utils/RateTrackerTest.java ---
    @@ -27,36 +27,63 @@
     public class RateTrackerTest extends TestCase {
     
         @Test
    +    public void testExactRate() {
    +        final long interval = 1000l;
    +        long time = 0l;
    +        RateTracker rt = new RateTracker(10000, 10, time);
    +        double [] expected = new double[] {10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0};
    +        for (int i = 0; i < expected.length; i++) {
    +            double exp = expected[i];
    +            rt.notify(10);
    +            time += interval;
    +            double actual = rt.reportRate(time);
    +            rt.forceRotate(1, interval);
    +            assertEquals("Expected rate on iteration "+i+" is wrong.", exp, actual, 0.00001);
    +        }
    +        expected = new double[] {11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0};
    --- End diff --
    
    It would be better to comment that it is continuous test after previous loop, so for each loop earliest bucket (which stores 10) is eclipsed and replaced to 20.
    I was misunderstood L43-51 to a new test, so I spent some times to find out why it is not 20.0.


---
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] storm pull request: STORM-1078: Updated RateTracker to be thread s...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the pull request:

    https://github.com/apache/storm/pull/776#issuecomment-144841531
  
    +1
    It's easier to understand. Great work.


---
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] storm pull request: STORM-1078: Updated RateTracker to be thread s...

Posted by ptgoetz <gi...@git.apache.org>.
Github user ptgoetz commented on the pull request:

    https://github.com/apache/storm/pull/776#issuecomment-145148520
  
    +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] storm pull request: STORM-1078: Updated RateTracker to be thread s...

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

    https://github.com/apache/storm/pull/776#discussion_r41022920
  
    --- Diff: storm-core/test/jvm/backtype/storm/utils/RateTrackerTest.java ---
    @@ -27,36 +27,63 @@
     public class RateTrackerTest extends TestCase {
     
         @Test
    +    public void testExactRate() {
    +        final long interval = 1000l;
    +        long time = 0l;
    +        RateTracker rt = new RateTracker(10000, 10, time);
    +        double [] expected = new double[] {10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0};
    +        for (int i = 0; i < expected.length; i++) {
    +            double exp = expected[i];
    +            rt.notify(10);
    +            time += interval;
    +            double actual = rt.reportRate(time);
    +            rt.forceRotate(1, interval);
    +            assertEquals("Expected rate on iteration "+i+" is wrong.", exp, actual, 0.00001);
    +        }
    +        expected = new double[] {11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0};
    --- End diff --
    
    Great point I will add this in.


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