Open yangkkkk opened 7 years ago
By design, when publishing messages, SimpleAmqpClient sends the message, then waits for a notification from the broker that the message has been received before returning from BasicPublish. For small messages, this is effectively 1 network round-trip. Assuming that the network cost dominates (that the cost in the broker and the client is ~small), you won't get any better performance out of SimpleAmqpClient. For persistent messages - the broker is required to perform an fsync()
to durable storage before acknowledging the message (so 4-50ms makes a lot of sense).
What sort of message publishing latency are you hoping to get out of SimpleAmqpClient?
Note: Unlike other AMQP clients, SimpleAmqpClient does not allow users of the API to do asynchronous acknowledgement of message (effectively having more messages in flight), nor do we allow users to skip this acknowledgement. This decision was made to make the API easy to use correctly above performance.
I have been using the SimpleAmqpClient in my Single-threaded programa recently,and I did a test on the speed of the sending messages to a queue.
The sample above takes about 4~50 milliseconds.
The sample above takes about 0.4~5milliseconds.
May I have some methods to improve it?