Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5490

Improve memory efficiency in go THeader implementation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.15.0
    • 0.16.0
    • Go - Library
    • None

    Description

      Currently in go's THeaderTransport implementation, due to THeader's framed nature, there are 2 buffers used, one for read and one for write. The 2 buffers are part of THeaderTransport and have the same lifecycle with the transport itself.

      This caused an issue with idle connections (e.g. connections sitting in a pool). For idle connections, their buffers were grew to handle the request/response, but never shrink, even when the connection is sitting in idle. So when a connection pool is used, every idle connection sitting in the pool has a memory profile of largest read + largest write they have ever had in their whole lifecycle, and when we have a server handling large request/response payloads with a lot of idle connections, the memory footprint can grow significant.

      We should use a resource pool, and return the buffers to the pool after done reading/writing, to better manage memory footprint.

      Attachments

        Activity

          People

            fishywang Yuxuan Wang
            fishywang Yuxuan Wang
            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 - 2h 20m
                2h 20m