org.apache.qpid.tools
Class PerfConsumer
java.lang.Object
org.apache.qpid.tools.PerfBase
org.apache.qpid.tools.PerfConsumer
- All Implemented Interfaces:
- MessageListener
public class PerfConsumer
- extends PerfBase
- implements MessageListener
PerfConsumer will receive x no of messages in warmup mode.
Once it receives the Start message it will then signal the PerfProducer.
It will start recording stats from the first message it receives after
the warmup mode is done.
The following calculations are done.
The important numbers to look at is
a) Avg Latency
b) System throughput.
Latency.
=========
Currently this test is written with the assumption that either
a) The Perf Producer and Consumer are on the same machine
b) They are on separate machines that have their time synced via a Time Server
In order to calculate latency the producer inserts a timestamp
hen the message is sent. The consumer will note the current time the message is
received and will calculate the latency as follows
latency = rcvdTime - msg.getJMSTimestamp()
Through out the test it will keep track of the max and min latency to show the
variance in latencies.
Avg latency is measured by adding all latencies and dividing by the total msgs.
You can also compute this by (rcvdTime - testStartTime)/rcvdMsgCount
Throughput
===========
System throughput is calculated as follows
rcvdMsgCount/(rcvdTime - testStartTime)
Consumer rate is calculated as
rcvdMsgCount/(rcvdTime - startTime)
Note that the testStartTime referes to when the producer sent the first message
and startTime is when the consumer first received a message.
rcvdTime keeps track of when the last message is received.
All throughput rates are given as msg/sec so the rates are multiplied by 1000.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
consumer
MessageConsumer consumer
maxLatency
long maxLatency
minLatency
long minLatency
totalLatency
long totalLatency
rcvdMsgCount
int rcvdMsgCount
testStartTime
long testStartTime
startTime
long startTime
rcvdTime
long rcvdTime
transacted
boolean transacted
transSize
int transSize
lock
final Object lock
PerfConsumer
public PerfConsumer()
setUp
public void setUp()
throws Exception
- Overrides:
setUp
in class PerfBase
- Throws:
Exception
warmup
public void warmup()
throws Exception
- Throws:
Exception
startTest
public void startTest()
throws Exception
- Throws:
Exception
printResults
public void printResults()
throws Exception
- Throws:
Exception
notifyCompletion
public void notifyCompletion(Destination replyTo)
throws Exception
- Throws:
Exception
tearDown
public void tearDown()
throws Exception
- Throws:
Exception
onMessage
public void onMessage(Message msg)
- Specified by:
onMessage
in interface MessageListener
test
public void test()
main
public static void main(String[] args)
Licensed to the Apache Software Foundation