5252 */
5353
5454public class ConnectionFactory {
55- // We explicitly set some minimum buffer sizes for consistent reasonable behaviour
56- // These will only be applied if that platform's default is not larger than this.
57-
58- // Due to our disabling of Nagle's algorithm, small buffers can very easily result in us
59- // sending a very large number of buffer sized packets. When we write messages faster than
60- // we can send them across the network, this quickly becomes a performance bottleneck.
61- // Empirically, the throughput for with and without Nagle's seems to equalise around a
62- // send buffer size of 8-10k for local messages. We need to do more benchmarking to verify
63- // whether there's a better choice of default number for typical ethernet setups.
64- public static final int DEFAULT_SOCKET_SEND_BUFFER_SIZE = 10 * 1024 ;
65-
66- public static final int DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE = 50 * 1024 ;
67-
6855 private final ConnectionParameters _params ;
6956
7057 /**
@@ -180,8 +167,7 @@ protected FrameHandler createFrameHandler(Address addr)
180167 * to connect to an AMQP server before they connect.
181168 *
182169 * The default behaviour of this method is to disable Nagle's algorithm to get
183- * more consistently low latency and set the buffer size to a reasonable figure
184- * that seems to work well as a performance / size trade of.
170+ * more consistently low latency.
185171 * However it may be overridden freely and there is no requirement to retain
186172 * this behaviour.
187173 *
@@ -190,16 +176,6 @@ protected FrameHandler createFrameHandler(Address addr)
190176 protected void configureSocket (Socket socket ) throws IOException {
191177 // disable Nagle's algorithm, for more consistently low latency
192178 socket .setTcpNoDelay (true );
193-
194- // disabling Nagle's algorithm seems to come at a significant performance cost
195- // at small buffer sizes. Empirically, buffer sizes of 10K seem to be enough to
196- // equalise the throughput for local traffic. This needs more investigation at to
197- // how it behaves over a network.
198-
199- if (socket .getSendBufferSize () < DEFAULT_SOCKET_SEND_BUFFER_SIZE )
200- socket .setSendBufferSize (DEFAULT_SOCKET_SEND_BUFFER_SIZE );
201- if (socket .getReceiveBufferSize () < DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE )
202- socket .setReceiveBufferSize (DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE );
203179 }
204180
205181 private Connection newConnection (Address [] addrs ,
0 commit comments