I couldn't find a bug tracker, so I'm reporting this here.<div><br></div><div>I was stracing a java process that uses the 2.8.2 java amqp client and I noticed that every basicPublish is resulting in 3 sendto syscalls:</div><div><br></div><div><div>3026 &nbsp;00:06:51.269104 sendto(27, "\1\0\1\0\0\0\17\0&lt;\0(\0\0\6hose04\0\0\316", 23, 0, NULL, 0 &lt;unfinished ...&gt;</div><div>3027 &nbsp;00:06:51.269127 &lt;... futex resumed&gt; ) = 0 &lt;0.000030&gt;</div><div>3026 &nbsp;00:06:51.269142 &lt;... sendto resumed&gt; ) = 23 &lt;0.000019&gt;</div><div>3025 &nbsp;00:06:51.269160 sendto(24, "\1\0\1\0\0\0\17\0&lt;\0(\0\0\6hose03\0\0\316", 23, 0, NULL, 0 &lt;unfinished ...&gt;</div><div>3027 &nbsp;00:06:51.269189 futex(0x7f8e5c442b54, FUTEX_WAIT_PRIVATE, 10202495, NULL &lt;unfinished ...&gt;</div><div>3026 &nbsp;00:06:51.269211 sendto(27, "\2\0\1\0\0\0 \0&lt;\0\0\0\0\0\0\0\0\7\302\220\0\20application/json\1\316", 40, 0, NULL, 0 &lt;unfinished ...&gt;</div><div>3025 &nbsp;00:06:51.269237 &lt;... sendto resumed&gt; ) = 23 &lt;0.000058&gt;</div><div>3026 &nbsp;00:06:51.269258 &lt;... sendto resumed&gt; ) = 40 &lt;0.000024&gt;</div><div>3025 &nbsp;00:06:51.269279 sendto(24, "\2\0\1\0\0\0 \0&lt;\0\0\0\0\0\0\0\0\10\206\220\0\20application/json\1\316", 40, 0, NULL, 0 &lt;unfinished ...&gt;</div><div>3026 &nbsp;00:06:51.269314 sendto(27, "\3\0\1\0\0\7\302"..., 1994, 0, NULL, 0 &lt;unfinished ...&gt;</div></div><div><div>3025 &nbsp;00:06:51.269444 &lt;... sendto resumed&gt; ) = 40 &lt;0.000138&gt;</div><div>3026 &nbsp;00:06:51.269463 &lt;... sendto resumed&gt; ) = 1994 &lt;0.000025&gt;</div></div><div><br></div><div>I believe these 3 sendto syscalls per basicPublish is a performance bottleneck and I went looking for a way to make it a single sendto call with all 3 frames included.</div><div><br></div><div>I'm fairly new to Java and AMQP, so bare with me.</div><div><br></div><div>The client is using BufferedOutputStream to wrap socket io in:</div><div><br></div><div>http://hg.rabbitmq.com/rabbitmq-java-client/file/b643c5c8ec23/src/com/rabbitmq/client/impl/SocketFrameHandler.java</div><div><br></div><div>BufferedOutputStream has a default buffer size of 512 bytes which suggests to me that flush() must be called in order to produce these small 23 and 40 byte sendto calls.</div><div><br></div><div>AMQPCommand::transmit seems to be where the real action happens, and I see a connection.flush() at the end of that function:</div><div><br></div><div>http://hg.rabbitmq.com/rabbitmq-java-client/file/b643c5c8ec23/src/com/rabbitmq/client/impl/AMQCommand.java<br></div><div><br></div><div>However I'm still a bit confused because I think a basicPublish should only result in one transmit() and thus one flush() and one sendto(). This is where I'm stuck.</div>