Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-10190

Reduce cost of toString of MetricKey and MetricName

Details

    • Improvement
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • 2.23.0
    • sdk-java-core

    Description

      Samza runner heavily uses MetricKey.toString() and MetricName.toString() to update Samza metrics. We found that the toString methods have high CPU cost. And according to this article: https://redfin.engineering/java-string-concatenation-which-way-is-best-8f590a7d22a8, we should use "+" operator instead of String.format for string concatenation for better performance.

      We do see a 10% QPS gain in nexmark queries using Samza runner with the change of using "+" operator.

      Attachments

        Issue Links

          Activity

            People

              YixingZhang Yixing Zhang
              YixingZhang Yixing Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m