Here is how I propose to implement selective accept on NGR:

We keep two numbers:
int totalRequestsAccepted
double totalRequestsConsideredTimesLoad

We have the function targetAcceptRatio(), which tells us what proportion
of requests we want to accept, based on the current estimated load (if
anyone has a non-alchemical way to do this...) - one possibility is that
it is 1-load, another is that we accept everything up to some value (say
overloadLow) and reject everything above some value (overloadHigh), and
increase linearly in between. Because of the hoped for effects, I am not
sure that the first option isn't the better one.

When we get a request:
totalRequestsConsideredTimesLoad += targetAcceptRatio()
If totalRequestsAccepted > totalRequestsConsideredTimesLoad ,
we know that we have accepted too many, so reject.
Otherwise, accept, and totalRequestsAccepted++.

Thus, we don't need to queue requests, there is no additional latency,
and the implementation is really rather straightforward, apart from
calculating the target acceptance ratio. And we accept the right
fraction. We need to do some maintenance to maintain accuracy (subtract
the largest whole part of both numbers from both numbers periodically),
and we need one lock, but that's it.

I will implement this on unstable soon, unless there are any objections.

It requires NGRouting...
-- 
Matthew J Toseland - [EMAIL PROTECTED]
Freenet Project Official Codemonkey - http://freenetproject.org/
ICTHUS - Nothing is impossible. Our Boss says so.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Devl mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to