Saturday, October 9, 2010

JMS (ActiveMQ) Performance Verification

Here is the performance report from my local machine.

Specs:
* Machine: Fedora 11, Quad CPU, 4GB DDR2 667MHz RAM, 2.1GB of which is already used.
* JDK version: 1.6
* Message size: 1024 bytes (1kb)

The Broker ran with:
* Two Transport Connectors
* One Message Producer
* Two Message Consumer (One Java and One PHP)

broker.addConnector("tcp://localhost:61616");
broker.addConnector("stomp://localhost:61613");


20,000 messages are produced in two different languages, Java and PHP. The result is shown on Table 1 and 2.

As you can see, overall, Java performs better. Although PHP as a message producer can generate more messages (about 7000 per second), the latency is too much for consuming message as PHP is a single threaded language.

Java produced less message per second, however, this is due to ActiveMQ Broker, and both message producer and consumer (three instances) are running on the same JVM. When I only run JAVA producer, which still share JVM with the Broker, the rate is about the same as PHP, about 7000 per second.

Also, PHP can only use STOMP (Streaming Text Orientated Messaging Protocol), but Java can use TCP, SSL, NIO (New I/O), UDP, multicast and VM (Virtual Machine) protocol. According to ActiveMQ documentation, NIO should performance better as it uses less resources when the traffic is heavy.

Table 1 Java as Message Producer

TypeProtocolNo. of MsgStart Timestamp
(ms)
End Timestamp
(ms)
First Msg
Latency (ms)
Last Msg
Latency (ms)
Total Time to
handle 20,000 msg(ms)

Rate
(msg/sec)
Java ProducerTCP20,00012699687511301269968755299 41694797
Java ConsumerTCP20,0001269968751176 126996875529946less than 141234850
PHP ConsumerSTOMP20,0001269968751143126996875875513345676122627

Table 2 PHP as Message Producer

TypeProtocolNo. of MsgStart Timestamp
(ms)

End Timestamp
(ms)
First Msg
Latency (ms)
Last Msg
Latency (ms)
Total Time to
handle 20,000 msg(ms)

Rate
(msg/sec)
PHP ProducerSTOMP20,00012699690492871269969052019 27327321
PHP ConsumerSTOMP20,0001269969049383126996905637596435669922860
JAVA ConsumerTCP20,000126996904932912699690521274210827987148

No comments:

Post a Comment