Added WithConnLimiter option for resource manager#1
Open
sstanculeanu wants to merge 2 commits intomasterfrom
Open
Added WithConnLimiter option for resource manager#1sstanculeanu wants to merge 2 commits intomasterfrom
sstanculeanu wants to merge 2 commits intomasterfrom
Conversation
| - [Flow](https://github.com/onflow/flow-go) - A blockchain built to support games, apps, and digital assets built by [Dapper Labs](https://www.dapperlabs.com/) | ||
| - [Swarm Bee](https://github.com/ethersphere/bee) - A client for connecting to the [Swarm network](https://www.ethswarm.org/) | ||
| - [Elrond Go](https://github.com/multiversx/mx-chain-go) - The Go implementation of the the Elrond network protocol | ||
| - [MultiversX Node](https://github.com/multiversx/mx-chain-go) - The Go implementation of the MultiversX network protocol |
| return func(rm *resourceManager) error { | ||
| connLimiterInstance, ok := rm.connLimiter.(*connLimiter) | ||
| if !ok { | ||
| return nil // early exit, it might be a custom implementation |
There was a problem hiding this comment.
or maybe throw an error here? Just to signal that the method call did not produce the expected result. Valid also on L100
|
|
||
| if ipv4 != nil { | ||
| rm.connLimiter.connLimitPerSubnetV4 = ipv4 | ||
| connLimiterInstance.connLimitPerSubnetV4 = ipv4 |
There was a problem hiding this comment.
we need to protect this set method with the same connLimiter.mu mutex. Maybe extract these set methods in the implementation + interface and get rid of the casts?
iulianpascalau
approved these changes
Jul 15, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Considering the case where multiple hosts are running on the same ip, it would be very hard to decide what would be the proper limit in terms of using one. Although the default options, with ConnCount set to math.MaxInt would be fix this problem, the internal array of maps would still consume a lot of memory.
WithConnLimiter option would be a great option in order to allow clients their own custom implementation of the connLimiter. In our case, simply use an empty limiter would be the best option for the moment.
Also added a tiny change request on the readme, in order to completely align with our new naming.