To illustrate the possibilities of the next generation routing algorithm I've implemented a class which gathers information about the performance of remote nodes, and uses that information to estimate the time required to retrieve some information from that note.
The most important part of this is the RoutingTimeEstimator class, however it will also take into consideration the likelihood that a contact attempt will fail, and further it will monitor the ratio of DataNotFound responses, watching out for anything unusual. See the attached file. Ian. -- Ian Clarke ian at locut.us Coordinator, The Freenet Project http://freenetproject.org/ Founder, Locutus http://locut.us/ Personal Homepage http://locut.us/ian/ -------------- next part -------------- package freenet.node.rt; public class RemoteNodeExpert { protected static int averageDataSize = 1000000; protected static int globalRetrievals = 0; protected static int globalFailures = 0; protected int contactsSucceeded = 0, contactsFailed = 0, contactFailureTime=0; protected int retrievals = 0, failures = 0; protected ResponseTimeEstimator rte; public RemoteNodeExpert(int accuracy) { rte = new ResponseTimeEstimator(accuracy); } public RemoteNodeExpert(byte[] b) { // TBD } public static void setAverageDataSize(int averageDataSize) { RemoteNodeExpert.averageDataSize = averageDataSize; } public byte[] serialize() { // TBD } public int estimateRoutingTime(Key key) { // Return the estimated time for retrieval plus the potential // time wasted if the connection fails normalized by the liklihood // of it failing. return rte.guess(key) + (contactFailureTime / contactsSucceeded); } public void reportDataRetrieval(Key key, int timeToResponse, int timeForCompletion, int dataSize) { retrievals++; globalRetrievals++; int normalizedTime = timeToResponse+ (timeForCompletion * (averageDataSize / dataSize)); rte.report(key, normalizedTime); } public void reportDataRetrievalFailure() { failures++; globalFailures++; } public void reportContactSuccess() { contactsSucceeded++; } public void reportContactFailure(int time) { contactFailureTime+= time; } public float failureRatioRelativeToAverage() { return (((float) retrievals) / ((float) failures)) - (((float) globalRetrievals) / ((float) globalFailures)); } } -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <https://emu.freenetproject.org/pipermail/devl/attachments/20030530/880c55eb/attachment.pgp>
