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

Storage benchmarks #460

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Storage benchmarks #460

wants to merge 4 commits into from

Conversation

mrd0ll4r
Copy link
Member

Fixes #447
This also adds a small variant of the announce and scrape benchmarks.
From the data we gathered from public trackers, swarms are usually tiny (probably only having one peer), and only a handful of swarms are actually big. So I thought it would be nice to see how the storage handles small and large swarms :)

func BenchmarkPutDeleteSpreadPeer(b *testing.B) { s.PutDeleteSpreadPeer(b, createNew()) }
func BenchmarkPutDeleteSpreadInfohash(b *testing.B) { s.PutDeleteSpreadInfohash(b, createNew()) }
func BenchmarkPutDeleteSpreadInfohashSpreadPeer(b *testing.B) {
s.PutDeleteSpreadInfohashSpreadPeer(b, createNew())
Copy link
Member

Choose a reason for hiding this comment

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

does gofmt force this into multilines? 😢

Copy link
Member Author

Choose a reason for hiding this comment

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

Just tried it in the playground: yep. (I'm running goimports, which I'm pretty sure does the same formatting, but I had to test :) )

// This uses the same logic as collectGarbage, only that all peers,
// regardless of age, will be deleted.
// In the end, only the counter keys remain.
func (ps *peerStore) Clear() error {
Copy link
Member

Choose a reason for hiding this comment

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

Redis has a concept called databases that are similar to schemas in Postgres or MySQL. We could just create a new database and switch to it. Then we don't have to worry about any keys being in the new context.

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 thought about that too! You probably mean we use a database for our stuff, then delete the entire database in Clear(), or even just start a new one for the next benchmark without clearing the old one?

@mrd0ll4r
Copy link
Member Author

mrd0ll4r commented Jan 15, 2020

Just looked at this again, @jzelinskie can you give me some input on the redis database issue please?

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

Successfully merging this pull request may close these issues.

Update storage benchmarks with a way to clear the storage in between
2 participants