Track and report peer load:

* PeerImp::charge only calls fail if dispatched from the peer
* Add "load" to output of RPC command "peer"
* Add Resource::Charge values for peer commands
* Impose some fee for every peer command
* Cleanup fee imposition
This commit is contained in:
David Schwartz
2015-03-05 15:11:26 -08:00
committed by Nik Bougalis
parent ff7dc0b446
commit e44e75fa6b
5 changed files with 54 additions and 27 deletions

View File

@@ -43,15 +43,17 @@ extern Charge const feeMediumBurdenRPC; // A somewhat burdensome RPC load
extern Charge const feeHighBurdenRPC; // A very burdensome RPC load
extern Charge const feePathFindUpdate; // An update to an existing PF request
// Peer loads
extern Charge const feeLightPeer; // Requires no reply
extern Charge const feeLowBurdenPeer; // Quick/cheap, slight reply
extern Charge const feeMediumBurdenPeer; // Requires some work
extern Charge const feeHighBurdenPeer; // Extensive work
// Good things
extern Charge const feeNewTrustedNote; // A new transaction/validation/proposal we trust
extern Charge const feeNewValidTx; // A new, valid transaction
extern Charge const feeSatisfiedRequest; // Data we requested
// Requests
extern Charge const feeRequestedData; // A request that is hard to satisfy, disk access
extern Charge const feeCheapQuery; // A query that is trivial, cached data
// Administrative
extern Charge const feeWarning; // The cost of receiving a warning
extern Charge const feeDrop; // The cost of being dropped for excess load

View File

@@ -26,7 +26,7 @@ namespace Resource {
Charge const feeInvalidRequest ( 10, "malformed request" );
Charge const feeRequestNoReply ( 1, "unsatisfiable request" );
Charge const feeInvalidSignature ( 100, "invalid signature" );
Charge const feeUnwantedData ( 5, "useless data" );
Charge const feeUnwantedData ( 15, "useless data" );
Charge const feeBadData ( 20, "invalid data" );
Charge const feeInvalidRPC ( 10, "malformed RPC" );
@@ -38,13 +38,15 @@ Charge const feeMediumBurdenRPC ( 40, "medium RPC" );
Charge const feeHighBurdenRPC ( 300, "heavy RPC" );
Charge const feePathFindUpdate ( 100, "path update" );
Charge const feeLightPeer (1, "trivial peer request" );
Charge const feeLowBurdenPeer (2, "simple peer request" );
Charge const feeMediumBurdenPeer (50, "moderate peer request" );
Charge const feeHighBurdenPeer (250, "heavy peer request" );
Charge const feeNewTrustedNote ( 10, "trusted note" );
Charge const feeNewValidTx ( 10, "valid tx" );
Charge const feeSatisfiedRequest ( 10, "needed data" );
Charge const feeRequestedData ( 50, "costly request" );
Charge const feeCheapQuery ( 10, "trivial query" );
Charge const feeWarning ( 200, "received warning" );
Charge const feeDrop ( 300, "dropped" );