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

Increase Java Socket Buffer Size

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: 0.12.0
    • Component/s: Java - Library
    • Labels:
      None

      Description

      TSocket.java
        if (isOpen()) {
            try {
              inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024);
              outputStream_ = new BufferedOutputStream(socket_.getOutputStream(), 1024);
            } catch (IOException iox) {
              close();
              throw new TTransportException(TTransportException.NOT_OPEN, iox);
            }
          }
      

      The 1024 buffer size is pretty narrow, especially for modern servers with TCP/IP send and receive buffers ranging from 16K to 64K. Please remove these hard coded values and rely on the underlying JVM default buffer sizes: 8Kib on most implementations.

      https://github.com/apache/thrift/blob/19baeefd8c38d62085891d7956349601f79448b3/lib/java/src/org/apache/thrift/transport/TSocket.java

        Attachments

        1. THRIFT-4494.1.patch
          1 kB
          David Mollitor

          Issue Links

            Activity

              People

              • Assignee:
                jking3 James E. King III
                Reporter:
                belugabehr David Mollitor
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: