I've got a list of proxy servers.
There is a list of ProxyServer
items. Item holds proxy Address
itself, SucceedCount
, FailedCount
, LastSucceedDate
, LastFailedDate
.
If loading operation succeed, SucceedCount
is incremented, if failed - FailedCount
.
So the items list looks like this (LastFailedDate
is not presented):
I need to implement a simple algorithm to get N best proxy from this list. Best proxy means:
- many
SucceedCount
is good - many
FailedCount
is bad - proxy with succeed/failed 0/0 is better than 0/10
- last success/failed date must have some weight, for example proxy with top
SucceedCount
/FailedCount
10000/100, butLastSucceedDate
month ago counts as bad enough.
I hope you got the idea to get best N proxy for that moment. I guess there are some known algorithms for tasks like this. Looks like the algorithm itself can be something like .OrderBy()
chain.
SucceedCount
, FailedCount
, LastSucceedDate
, LastFailedDate
fields may be replaced by any others, deleted, or may be supplemented by others, I just need the way to achieve the goal.