Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-593

LaxConnPool could be fairer in allocating connections

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

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.0-beta8
    • 5.0-beta9
    • HttpCore
    • None

    Description

      LaxConnPool may assign an available connection to a new lease request even though it has pending requests already queued. Though the class makes no guarantees of fairness, it doesn't require a major change to check if there are already queued requests before attempt to allocate a connection to the new lease. This still wouldn't establish any fairness guarantee, but would improve general fairness behaviour (presuming that is a desirable thing ).

      Indeed, the code already partially has such a test, only creating new pool entries to fulfill the lease if the pending queue is empty:
                  PoolEntry<T, C> entry = getAvailableEntry(state);
                  if (entry == null && pending.isEmpty()) {
                      entry = createPoolEntry();
      The change would be just to move the pending test to prior to the entire allocation process.

      This fairness does come at the price of the (small) extra expense of the pending queue test on every lease (as opposed to just some of them). It could be that it's preferable to maintain absolute maximum performance for lease when there are available connections.

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            linton.miller Linton Miller
            Votes:
            0 Vote for this issue
            Watchers:
            3 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 - 20m
                20m

                Issue deployment