Permalink
Browse files

Added INFO level messages to better understand the performance of per…

…-request instrumentation. Expect to remove most of this after debugging.
  • Loading branch information...
1 parent 7b8d30c commit e29b2228f99923d7a76726abb3b3c2832667fdf7 @jayjwylie jayjwylie committed Nov 14, 2012
@@ -180,6 +180,10 @@ public void addRequest(long timeNS,
long numEmptyResponses,
long bytes,
long getAllAggregatedCount) {
+ // TODO: Remove this instrumentation
+ final long infoCutoffNs = 100 * 1000; // 100 us cut off for INFO display
+ long startTimeNs = System.nanoTime();
+
long timeMs = timeNS / Time.NS_PER_MS;
if(this.useHistogram) {
histogram.insert(timeMs);
@@ -198,8 +202,15 @@ public void addRequest(long timeNS,
oldv.getAllAggregatedCount + getAllAggregatedCount,
getAllAggregatedCount > oldv.getAllMaxCount ? getAllAggregatedCount
: oldv.getAllMaxCount);
- if(values.compareAndSet(oldv, newv))
+ if(values.compareAndSet(oldv, newv)) {
+ long durationNs = System.nanoTime() - startTimeNs;
+ if(durationNs > infoCutoffNs) {
+ logger.info("addRequest (histogram.insert and accumulator update) took more than "
+ + infoCutoffNs + " ns: " + durationNs + " ns.");
+ }
+
return;
+ }
}
// TODO: Make this DEBUG level
logger.info("addRequest lost data because three retries was insufficient.");
@@ -448,20 +448,20 @@ public Pool(ResourcePoolConfig resourcePoolConfig) {
if(!nonBlockingPut(resource)) {
this.size.decrementAndGet();
objectFactory.destroy(key, resource);
- if (currentCreatesInFlight>0) {
- logger.info("attemptGrow established new connection for key "
- + key.toString() + " with " + currentCreatesInFlight
- + " other connection establishments in flight."
- + " And then promptly destroyed the new connection.");
+ if(currentCreatesInFlight > 0) {
+ logger.info("attemptGrow established new connection for key "
+ + key.toString() + " with " + currentCreatesInFlight
+ + " other connection establishments in flight."
+ + " And then promptly destroyed the new connection.");
}
return false;
}
- if (currentCreatesInFlight>0) {
- logger.info("attemptGrow established new connection for key "
- + key.toString() + " with " + currentCreatesInFlight
- + " other connection establishments in flight."
- + " After checking in to KeyedResourcePool, there are "
- + queue.size() + " destinations checked in.");
+ if(currentCreatesInFlight > 0) {
+ logger.info("attemptGrow established new connection for key "
+ + key.toString() + " with " + currentCreatesInFlight
+ + " other connection establishments in flight."
+ + " After checking in to KeyedResourcePool, there are "
+ + queue.size() + " destinations checked in.");
}
}
} catch(Exception e) {

0 comments on commit e29b222

Please sign in to comment.