Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-3058

App.Metrics usage is very inefficient

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.5.0
    • None
    • library
    • None
    • 1

    Description

      The current implementation of App.Metrics is very inefficient.

      For example, I recently ran a memory profile on 300k GET operations. In this profile, there were approximately 28.6MB of strings allocated. Of those, 25.3MB (88.6%) were allocated by DefaultMetricContextRegistry.Timer<T> calling String.Concat on every GET operation (as part of OperationBase.StopRecording). There's also a further 19.3MB of related App.Metrics.Internal.DefaultMetricContextRegistry+<>c__DisplayClass33_0<ITimerMetric> allocations I can see.

      A quick glance seems to indicate that we could prevent this by simply persisting an ITimer instance for reuse, or some similar approach. However, another option may be to drop App.Metrics entirely and use the .NET metric system. This is partially completed by https://review.couchbase.org/c/couchbase-net-client/+/165973, but this change still uses App.Metrics to support the LoggingMeter. Another means of building the histogram data would be required.

      Attachments

        For Gerrit Dashboard: NCBC-3058
        # Subject Branch Project Status CR V

        Activity

          People

            btburnett3 Brant Burnett
            btburnett3 Brant Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty