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
Type | Protocol | No. of Msg | Start 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 Producer | TCP | 20,000 | 1269968751130 | 1269968755299 | 4169 | 4797 | ||
Java Consumer | TCP | 20,000 | 1269968751176 | 1269968755299 | 46 | less than 1 | 4123 | 4850 |
PHP Consumer | STOMP | 20,000 | 1269968751143 | 1269968758755 | 13 | 3456 | 7612 | 2627 |
Table 2 PHP as Message Producer
Type | Protocol | No. of Msg | Start 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 Producer | STOMP | 20,000 | 1269969049287 | 1269969052019 | 2732 | 7321 | PHP Consumer | STOMP | 20,000 | 1269969049383 | 1269969056375 | 96 | 4356 | 6992 | 2860 | JAVA Consumer | TCP | 20,000 | 1269969049329 | 1269969052127 | 42 | 108 | 2798 | 7148 |
---|
No comments:
Post a Comment