Sunday, November 22, 2009

txamqp vs the java amqp client

Whew, what a difference.

I did some benchmarking with a modified version (not modified for performance) of the java amqp client (for rabbitmq) and txamqp. Man is it a world of hurt for txamqp.
I get a sustained 33k/sec msg rate with the java amqp client and there's some poor code in there which could use some hashtables. This is for the consumer program which I describe below.
The better setup I have in txamqp though only is about 1k/sec for the consumer program... a pretty huge difference.
Both clients are doing the same work - the benchmark consists of two programs for each client: a producer and consumer.
Producers produce a small json object built from the library - it contains some random data per object so we always have to make/serialize a new object.
Consumers register a consumer to a queue and parse the json object for each message and then explicitly basic-ack the message has been processed.

Each is done as fast as possible with the rabbitmq (1.7.0) running completely in ram (no swap). However each is also done at a different time to assure that only one is executing at a time. I do it in bursts of 100k msgs. And finally, both version's producer's are faster than the consumer.
but again it's hugely in the java client's favor. 350 msecs to send 100k msgs. It takes about 20 seconds for the same workload with txamqp.

Here's hoping there's an improvement - I did some profiling though and couldn't figure anything in particular except maybe txamqp's codec implementation. Profile file here: