Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Throttling enabled #227

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

lruggieri
Copy link
Contributor

Added a simple throttler to limit the mps. Nothing fancy, just a limiter on the number of messages (of any kind) sent each second.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

cmd/magneticod/dht/mainline/protocol.go Show resolved Hide resolved
cmd/magneticod/dht/mainline/protocol.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/protocol.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Outdated Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

cmd/magneticod/dht/mainline/protocol.go Outdated Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

cmd/magneticod/dht/mainline/transport.go Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

pkg/util/util.go Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

cmd/magneticod/dht/mainline/transport.go Show resolved Hide resolved
cmd/magneticod/dht/mainline/transport.go Show resolved Hide resolved
@@ -140,7 +141,8 @@ func parseFlags() (*opFlags, error) {
IndexerInterval uint `long:"indexer-interval" description:"Indexing interval in integer seconds." default:"1"`
IndexerMaxNeighbors uint `long:"indexer-max-neighbors" description:"Maximum number of neighbors of an indexer." default:"10000"`

LeechMaxN uint `long:"leech-max-n" description:"Maximum number of leeches." default:"200"`
LeechMaxN uint `long:"leech-max-n" description:"Maximum number of leeches." default:"200"`
MaxThrottle uint `long:"max-throttle" description:"Maximum requests per second." default:"0"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably called this variable more precisely. Probably MaxRps and --max-rps or something more self-describing as a parameter name.

@theblazehen
Copy link

I'm trying to build it, but I'm getting

root@torrentsearch:~/magnetico/magnetico/cmd/magneticod# go build .
# _/root/magnetico/magnetico/cmd/magneticod
./main.go:188:2: undefined: mainline.DefaultThrottleRate

@lruggieri
Copy link
Contributor Author

I'm trying to build it, but I'm getting

root@torrentsearch:~/magnetico/magnetico/cmd/magneticod# go build .
# _/root/magnetico/magnetico/cmd/magneticod
./main.go:188:2: undefined: mainline.DefaultThrottleRate

@theblazehen

cd ~
git clone https://github.com/boramalper/magnetico.git
cd magnetico
git fetch origin +refs/pull/227/merge
git checkout FETCH_HEAD
cd cmd/magneticod/
go build .

This seems to work pretty fine.
If it does not for you, I would guess something is wrong either with the way you checked out this PR or the way you set your GOPATH (even though working with go mod should not yield any problem).

@boramalper
Copy link
Owner

Hi @lruggieri

Added a simple throttler to limit the mps

What is mps? It seems requests per second but which requests are you talking about? DHT or BitTorrent?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants