I'd want to make a new attempt to discuss JCache metrics, especially
time-based metrics.
As discussed earlier (
http://apache-ignite-developers.2346864.n4.nabble.com/Cache-Metrics-tt19699.html
),
there are two approaches (and at first glance, the second one is
preferable):
#1 Node that starts some operation is responsible for updating the
cache metrics.
#2 Primary node (node that actually executes a request)
I have one question/concern about time-based metrics for transactional
caches.
The JCache specification does not have definition like a transaction,
partitioned cache etc,
and, therefore, cannot provide convenience and clear understanding about
the average time for that case.
Let's assume, for example, we have the following code:
try (Transaction tx =
transactions.txStart(TransactionConcurrency.OPTIMISTIC,
TransactionIsolation.READ_COMMITTED)) {
value = cache.get(key);
// calculate new value for the given key
...
cache.put(key, new_value); // (1)
// some additional operations
// another update
value = cache.get(key); // (2)
...
cache.put(key, new_value);
tx.commit(); // (3)
}
What is the average time for write operation? Is it a time needed for
enlisting an entry in the transaction scope, acquiring locks, committing
changes?
For that particular case, current implementation accumulates both timings
(1)&(2) on the local node during performing put operation, but 'write'
counter is updated only once on data node during commit phase.
I think this behavior is not obvious at least.
Thanks,
Slava.