Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-6455

ConnectionCount logic does not produce a sensible ConnectionFactory max pool size for some scenarios

    XMLWordPrintable

Details

    • Rank:
      1|hzljyn:
    • Sustaining Sprint 10

    Description

      The ConnectionCount#getConnectionCount method is used to calculate an 'adjusted' maximum connection pool size for different connection pool types.

         public int getConnectionCount(int max, ConnectionType type) {
              Reject.ifTrue(max < MINIMUM_CONNECTIONS);
              switch (type) {
                  case CTS_ASYNC:
                      if (storeMode == StoreMode.DEFAULT) {
                          max = max / 2;
                      } else {
                          max = max - 2;
                      }
                      return findPowerOfTwo(max);
                  case CTS_REAPER:
                      return 1;
                  case DATA_LAYER:
                      /**
                        * Ensure that the DATA_LAYER connection type fits into the available
                        * connection space alongside CTS_REAPER and CTS_ASYNC
                        */
                      int async = getConnectionCount(max, ConnectionType.CTS_ASYNC);
                      int reaper = getConnectionCount(max, ConnectionType.CTS_REAPER);
                      return max - (async + reaper);
                  default:
                      throw new IllegalStateException();
              }
          }
      

      However, with some input parameters this can lead to odd results:

      For example, a standard installation with an external config store, when calculating a DATA_LAYER maximum, would have the following inputs:

      max = 10
      storeMode = EXTERNAL
      type = DATA_LAYER

      This results in:

      10 - (8+1) = 1

      Even with higher connection pools configured, this could sometimes lead to just 1 connection.

      max = 130

      leads to

      130 - (128 + 1) = 1

      Attachments

        Issue Links

          Activity

            People

              peter.major Peter Major [X] (Inactive)
              ian.packer Ian Packer [X] (Inactive)
              Nemanja Lukic Nemanja Lukic
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0h
                  0h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h