Update of /cvsroot/freenet/freenet/src/freenet/node/states/FNP
In directory sc8-pr-cvs1:/tmp/cvs-serv4015/freenet/src/freenet/node/states/FNP
Modified Files:
FNPFeedbackToken.java
Log Message:
Version.java 6284
Fix bug in LoadStats.java decayingTimeWeightedAverage.
Put this node's average into the global pool, which
is checkpointed. Initialize the average from the
saved value.
Change default half life to 1.2 hours. Other nodes don't
receive updates much more frequently that that.
Change mode lines from "tabwidth: 4" to "indent-tabs-mode:
nil" since some developers don't use emacs so it is best to
use no tabs at all in the text. (Their Java IDE must also
wrap long lines in a legible manner, since they seem to
regard long lines as more legible than manually wrapped and
indented lines).
Add configuration parameter tfTolerableQueueDelay to
YThreadFactory, default 100ms.
Core.java
Mode line. Remove tabs.
Add tfTolerableQueueDelay configurable parameter.
NodeStatusServlet.java
Mode line. Remove tabs. Print the "why" data from estimatedLoad,
rejectingConnections, and rejectingRequests.
Change "Active pooled jobs" to "Pooled threads running jobs"
Change "Available threads" to "Pooled threads which are idle"
Use NumberFormat instead of ad-hoc code.
LoadStats.java
Improve display of global stats: show which were rejected
as outliers or as too old.
Make the text only dump give same info as html dump.
Carefully check the locking in LoadStats.java. In the
first cut, putting localQueryTraffic into the checkpointed
pool added a lock in a path that didn't have one before.
Make all constant class members final.
Eliminate volatile. JLS 2nd ed. gives useful semantics
for volatile, but who knows if all JVM's do it right?
Some old one's didn't. This code doesn't run often enough
for the slight speed improvement (over synchronize) to
matter.
logDEBUG, logMINOR
(LoadStats constructor) add myRef. Initialize local queries
per hour from this node's entry in the global queries per
hour.
(receivedQuery) Do not call localQueryTraffic(), which
can block on a synchronize and which does unnecessary
stuff. Just grab the data and run queriesPerHour.average
whenever timesPos wraps.
(storeTraffic) move code which cannot get IOException out of
the try/catch block. Remove the once in a lifetime call
to checkpoint() since checkpoint() now calls
storeTraffic() and hence we might already be inside
checkpoint(). The checkpoint will be done soon enough (10
minutes).
(QueryTrafficInfo) Name changed from LocalQueryTrafficInfo.
Save the local queries per hour into the global queries
per hour checkpointed list. Remove special case for early
period when there is not much data, since the average
localQueryTraffic starts from a saved value. Move the
statistics calculations from checkpoint() into this class,
so that the web page can show more information about those
calculations.
(localQueryTraffic) Remove special case for early period
when there is not much data, since the average
localQueryTraffic starts from a saved value. Never return
a value less than 1.0. Avoids testing for divide by zero
elsewhere.
(DecayingTimeWeightedAverage) Fix a really stupid bug.
Essentially, I had 1-(1/2)^(hl/dt) instead of (1/2)^(dt/hl).
It was right at hl=dt, and at dt=0 (since (1/2)^oo = 0).
But at dt < 0.2 hl, it gave no weight to the new data.
Add initial value arg to constructor. Clean up the
comments.
(globalQueryTraffic) make synchronized since class member
globalQueryTraffic is no longer marked volatile.
(shouldReset) reference resetProbability() rather than the
class member since class member is no longer volatile.
Other cosmetic changes, use logMINOR to avoid logging call
if unnecessary.
(nextCheckpoing) make synchronized. lastCheckpoint is not
volatile.
(checkpoint) Move the statistics calculations to
QueryTrafficInfo inner class constructor. Logging.
lastCheckpoint reference must be synchronized.
QueryTrafficInfo calls storeTraffic() to save the
localQueryTraffic value into the checkpoint file, so
storeTraffic() can't call checkpoint().
(dump) Print mostly the same data as dumpHtml. Use
QueryTrafficInfo to get the values.
(dumpHtml) Use QueryTrafficInfo. Include information about
which samples were too old, too small, or too big.
(LoadEntry inner class) Make all members final.
Main.java
Mode line, indenting.
(main) Copy tfTolerableQueueDelay parameter into Node. Pass
myRef to LoadStats constructor
(startNode) Pass tfTolerableQueueDelay to YThreadFactory.
Node.java
Mode line. indenting.
Add java.text.NumberFormat.
Check numbers from diagnostics for isNaN.
(static) Initialize NumberFormats. Change default
lsHalfLifeHours to 1.2 so localQueryTraffic value does
full decay in 12 hours. Reword some of the parameter
descriptions and correct some errors.
(rejectingConnections) Add an optional StringBuffer
argument, which if non-null gets filled with
details about why we are rejecting connections.
(rejectingRequests) same thing.
(estimatedLoad) same thing. Why the load is what it is.
GeneralInfolet.java
Mode line. Remove tabs. Print the "why" data from estimatedLoad,
rejectingConnections, and rejectingRequests.
Change "Active pooled jobs" to "Pooled threads running jobs"
Change "Available threads" to "Pooled threads which are idle"
Use NumberFormat instead of ad-hoc code.
FNPFeedbackToken.java
(storeData) Round the average before cast to long.
YThreadFactory.java
Add tfTolerableQueueDelay configurable parameter.
Index: FNPFeedbackToken.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/FNP/FNPFeedbackToken.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -w -r1.23 -r1.24
--- FNPFeedbackToken.java 27 Oct 2003 14:45:19 -0000 1.23
+++ FNPFeedbackToken.java 28 Oct 2003 05:10:02 -0000 1.24
@@ -98,7 +98,7 @@
if (!n.isTransient() && (nr == null || n.loadStats.shouldReset())) {
nr = n.getNodeReference();
// Send our request rate estimate too.
- rate = (long)n.loadStats.localQueryTraffic();
+ rate = (long)(n.loadStats.localQueryTraffic() + 0.5);
hopsSinceReset = 0;
}
Message m = new StoreData(id, nr, rate, hopsSinceReset);
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs