title: How to tune Java InputStream size
body: <p>I am developing file upload functionality in CentOS7 and Jetty9 environment. Everything is working fine but I have noticed that data in my inputstream is very small. I have counted bytes after each read in while loop as bellow.</p>
  
  <pre><code>  while ((bytesCount = inStream.read(byteArray)) != -1) {
        ...
        logger.trace("bytecount: " + bytesCount);
        ...
     }
  </code></pre>
  
  <p>Log:</p>
  
  <pre><code> ... bytecount: 3844
   ... bytecount: 4052
   ... bytecount: 44
   ... bytecount: 4052
     .....
     .....
  </code></pre>
  
  <p>My TCP socket buffer size:</p>
  
  <pre><code> cat /proc/sys/net/ipv4/tcp_rmem
   4096   87380   6291456
  </code></pre>
  
  <p>Is my Jetty9 server reducing the data, so inputstream receiving only around 4KB data each read call? or do I need tune my Linux TCP Socket?</p>
  
  <p>Thanks.</p>