Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-838

Redundant AttributeKey allocation resulting in high garbage collector activity

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.3
    • 2.0.8
    • Filter
    • None
    • java version "1.6.0_22"
      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
      Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

    Description

      The classes CumulativeProtocolDecoder and ProtocolCodecFilter (there are others too, but these two are the important ones for our project) have members of type AttributeKey declared as:
      private final AttributeKey ENCODER = new AttributeKey(ProtocolCodecFilter.class, "encoder");

      As can be seen, these are not static, so each time ProtocolCodecFilter is created, AttributeKey objects get created as well, which in turn involves creation of a lot of String and char[] objects. jProfiler indicates that AttributeKey is accountable for creation of about 85% of all Strings and char[] in runs of our project, so it makes a significant difference for us.

      Is it OK for these attribute key objects to be singletons? If not, what would take to make them singletons?
      Some of other MINA filters have AttributeKeys as static members (e.g. MdcInjectionFilter, SslFilter).

      To summarize: the improvement being requested is to make the pre-defined AttributeKey objects static within classes such as CumulativeProtocolDecoder and ProtocolCodecFilter.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            minisaw Platon Potapov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment