Question: How do I measure latency and throughput?
Latency, also known as response time or access time, is a measure of how long it takes the the database to respond to a single request.
The "Heartbeat / Sample Times" columns are the primary measurements of latency displayed by Foxhound. The Heartbeat is the round-trip elapsed time for a single SELECT dummy_col FROM DUMMY statement issued by Foxhound to the target database; the time is rounded upwards to the nearest tenth of a second so the minimum displayed value is 0.1s.
The Sample time is the round-trip time it takes Foxhound to request and receive three sets of performance statistics from the target database. The workload varies with the number of connections on the target database so the sample time is an indication of how long a non-trivial transaction takes rather than a benchmark measurement.
The Heartbeat time is usually smaller than the Sample time, but it is possible for the Hearbeat time to be larger; here is an example:
Samples Interval Times
May 16 11:00:29 PM 50.1s 39.7s / .9s
The heartbeat query and the sample gathering process are performed separately, one after another, and their elapsed times are calculated separately: the Sample time does not include the Heartbeat time. It is possible that the target database did not respond to the heartbeat query for a long time, but then did respond to the subsequent sample queries on a timely basis.
Throughput, also known as bandwidth, is a measure of how many requests the database can respond to per unit of time.
The following Foxhound Monitor columns provide an indication of throughput:
The "Req" column shows the rate at which the server started processing a new
request or resumed processing an existing request during the preceding interval.
In this context, a request is defined as an atomic unit of work performed for a connection.
The "Commits" column shows the approximate rate at which COMMIT operations
were performed in the previous interval. This number is approximate because
a connection may issue a commit and disconnect between two Foxhound samples,
and that commit won't be counted in this rate. Depending on how the database
workload is structured, the commit count may or may not be the same as the transaction count.
The "Bytes In / Out" columns show the rates at which data was received by and
sent back by the server from and to client connections in the previous interval.
Low latency is a generally a good thing, but so is high throughput, and the trick is to achieve a balance between the two.