Skip to content

Commit 48c7af6

Browse files
author
David R. MacIver
committed
some explanatory commenting regarding buffer sizes
1 parent 74a6967 commit 48c7af6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@
5252
*/
5353

5454
public 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.
5564
public static final int DEFAULT_SOCKET_SEND_BUFFER_SIZE = 10 * 1024;
65+
5666
public static final int DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE = 50 * 1024;
5767

5868
private final ConnectionParameters _params;

0 commit comments

Comments
 (0)