[ 
https://issues.apache.org/jira/browse/THRIFT-4494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16640342#comment-16640342
 ] 

ASF GitHub Bot commented on THRIFT-4494:
----------------------------------------

jeking3 closed pull request #1608: THRIFT-4494: Increase Java Socket Buffer 
Size (BELUGA BEHR)
URL: https://github.com/apache/thrift/pull/1608
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/java/src/org/apache/thrift/transport/TSocket.java 
b/lib/java/src/org/apache/thrift/transport/TSocket.java
index 148122f7e5..b20b32b781 100644
--- a/lib/java/src/org/apache/thrift/transport/TSocket.java
+++ b/lib/java/src/org/apache/thrift/transport/TSocket.java
@@ -80,8 +80,8 @@ public TSocket(Socket socket) throws TTransportException {
 
     if (isOpen()) {
       try {
-        inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024);
-        outputStream_ = new BufferedOutputStream(socket_.getOutputStream(), 
1024);
+        inputStream_ = new BufferedInputStream(socket_.getInputStream());
+        outputStream_ = new BufferedOutputStream(socket_.getOutputStream());
       } catch (IOException iox) {
         close();
         throw new TTransportException(TTransportException.NOT_OPEN, iox);
@@ -219,8 +219,8 @@ public void open() throws TTransportException {
 
     try {
       socket_.connect(new InetSocketAddress(host_, port_), connectTimeout_);
-      inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024);
-      outputStream_ = new BufferedOutputStream(socket_.getOutputStream(), 
1024);
+      inputStream_ = new BufferedInputStream(socket_.getInputStream());
+      outputStream_ = new BufferedOutputStream(socket_.getOutputStream());
     } catch (IOException iox) {
       close();
       throw new TTransportException(TTransportException.NOT_OPEN, iox);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Increase Java Socket Buffer Size
> --------------------------------
>
>                 Key: THRIFT-4494
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4494
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Library
>    Affects Versions: 0.11.0
>            Reporter: BELUGA BEHR
>            Priority: Minor
>             Fix For: 0.12.0
>
>         Attachments: THRIFT-4494.1.patch
>
>
> {code:title=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);
>       }
>     }
> {code}
> 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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to