Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meter network activity #6885

Merged
merged 20 commits into from
Dec 10, 2020
Merged

Meter network activity #6885

merged 20 commits into from
Dec 10, 2020

Conversation

imeckler
Copy link
Member

@imeckler imeckler commented Dec 1, 2020

This PR "meters" all networking activity in the sense of putting a limit (for each peer ID and IP) on

  • how many external transitions it sends us
  • for each RPC, how many calls (and of what "size", whatever size may mean) it makes on us
  • how many SNARKs it sends us
  • how many transactions it sends us

in any given 5 minute interval.

I'm not 100% confident about all the concrete limits I put, so any feedback on that would be welcome.

@imeckler imeckler requested a review from a team as a code owner December 1, 2020 02:26
@@ -2600,7 +2600,12 @@ module Hooks = struct
: (Get_epoch_ledger.query, Get_epoch_ledger.response) rpc

type rpc_handler =
| Rpc_handler : ('q, 'r) rpc * ('q, 'r) rpc_fn -> rpc_handler
| Rpc_handler :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to avoid repeating this type definition?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent a while trying and it was difficult to do without repeating a lot of code or changing some stuff around significantly.

@aneesharaines
Copy link
Contributor

Need more info to make sure the thresholds are correct

@psteckler
Copy link
Member

Can we call this "Rate_limiter" instead of "Meter"?

@imeckler imeckler added the ci-build-me Add this label to trigger a circle+buildkite build for this branch label Dec 9, 2020
@imeckler
Copy link
Member Author

imeckler commented Dec 9, 2020

Can we call this "Rate_limiter" instead of "Meter"?

That makes sense, will do that

-> Envelope.Sender.t
-> now:Time.t
-> score:int
-> [`Ok | `Capacity_exceeded]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change Ok to something like Within_capacity, to avoid confusion with an Or_error type.

Some (do_ f)
| Consensus_rpc rpc_a, Rpc_handler (Consensus_rpc rpc_b, f) ->
Consensus.Hooks.Rpcs.match_handler (Rpc_handler (rpc_b, f)) rpc_a ~do_
| Consensus_rpc rpc_a, Consensus_rpc rpc_b ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the case for Get_telemetry_data omitted intentionally?

@@ -626,7 +626,12 @@ module Rpcs = struct
| Consensus_rpc : ('q, 'r) Consensus.Hooks.Rpcs.rpc -> ('q, 'r) rpc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment for ADDING A NEW RPC should probably mention updating match_handler

@imeckler imeckler merged commit 1c15e07 into develop Dec 10, 2020
@imeckler imeckler deleted the feature/metering branch December 10, 2020 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-build-me Add this label to trigger a circle+buildkite build for this branch ready-to-merge-into-develop
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants