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

AddCat Bitswap Integration Tests #444

Merged
merged 12 commits into from
Dec 13, 2014
Merged

AddCat Bitswap Integration Tests #444

merged 12 commits into from
Dec 13, 2014

Conversation

btc
Copy link
Contributor

@btc btc commented Dec 13, 2014

features

  • adds delay/latency configuration to the datastore, Bitswap.VirtualNetwork, and mockrouting types.
  • adds benchmarks to observe the effect that (each type of) latency has on AddCat performance.
  • adds long-running integration tests. execute with env variable IPFS_EPIC_TEST

learnings

status

  • Still playing around with variables.
  • Will squash commit history before merging
  • we may want to rebase the new bitswap changes on top of this for testing @whyrusleeping
  • nice-to-have: mock out the network at a lower layer
  • I hereby dedicate this PR to Riff Raff. https://www.youtube.com/watch?v=TL0RqEsF_mY

@btc btc added the status/in-progress In progress label Dec 13, 2014
@jbenet
Copy link
Member

jbenet commented Dec 13, 2014

this is awesome. you are a god among mortals.

Brian Tiger Chow added 7 commits December 13, 2014 05:17
Real version doesn't expose this

License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
@btc btc force-pushed the test/mocks-on-mocks-on-mocks branch from e92d48b to 1cfe479 Compare December 13, 2014 13:17
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
@btc btc force-pushed the test/mocks-on-mocks-on-mocks branch from 1cfe479 to ed9b3f5 Compare December 13, 2014 13:34
Brian Tiger Chow added 3 commits December 13, 2014 05:43
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
@btc btc force-pushed the test/mocks-on-mocks-on-mocks branch from ed9b3f5 to c00a7a2 Compare December 13, 2014 13:43
@btc
Copy link
Contributor Author

btc commented Dec 13, 2014

RFCR @jbenet

BenchmarkInstantaneousAddCat32MB            4159322045 ns/op       8.07 MB/s
BenchmarkRoutingSlowAddCat32MB              40494165777 ns/op      0.83 MB/s # AHHHH
BenchmarkNetworkSlowAddCat32MB              4168220210 ns/op       8.05 MB/s
BenchmarkBlockstoreSlowAddCat32MB           6712107451 ns/op       5.00 MB/s

adder.SetBlockstoreLatency(0) // disable blockstore latency during add operation
var data bytes.Buffer
// FIXME replace with a random data generator that reproduces data given a seed value
io.Copy(&data, &io.LimitedReader{R: randcrypto.Reader, N: conf.DataAmountBytes})
Copy link
Member

Choose a reason for hiding this comment

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

you can use go-random for a Reader with much faster randomness generation. dont really need cryptographic strength for these tests, and randcrypto is slow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. Wonderful. I was looking for a way to get determinism.

71d6e5c

The icing on the cake would be for random to provide an io.Reader. It would cut down peak memory usage and make it possible to create larger tests. Not critical yet. The blockstore will limit test size before that will.

random.NewPseudoRandomReader(count, seed)

Copy link
Member

Choose a reason for hiding this comment

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

huh, i thought it did. oh well

On Sat, Dec 13, 2014 at 7:41 AM, Brian Tiger Chow [email protected]
wrote:

In epictest/addcat_test.go
#444 (diff):

+func AddCatBytes(conf Config) error {
+

  • sessionGenerator := bitswap.NewSessionGenerator(
  •   tn.VirtualNetwork(delay.Fixed(conf.NetworkLatency)), // TODO rename VirtualNetwork
    
  •   mockrouting.NewServerWithDelay(delay.Fixed(conf.RoutingLatency)),
    
  • )
  • adder := sessionGenerator.Next()
  • catter := sessionGenerator.Next()
  • catter.SetBlockstoreLatency(conf.BlockstoreLatency)
  • adder.SetBlockstoreLatency(0) // disable blockstore latency during add operation
  • var data bytes.Buffer
  • // FIXME replace with a random data generator that reproduces data given a seed value
  • io.Copy(&data, &io.LimitedReader{R: randcrypto.Reader, N: conf.DataAmountBytes})

Ah. Wonderful. I was looking for a way to get determinism.

71d6e5c
71d6e5c

The icing on the cake would be for random to provide an io.Reader

random.NewPseudoRandomReader(count, seed)


Reply to this email directly or view it on GitHub
https://github.com/jbenet/go-ipfs/pull/444/files#r21788868.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

before

BenchmarkInstantaneousAddCat1MB       20      91798436 ns/op      11.42 MB/s
BenchmarkInstantaneousAddCat2MB       10     180849588 ns/op      11.60 MB/s
BenchmarkInstantaneousAddCat4MB        5     360574235 ns/op      11.63 MB/s
BenchmarkInstantaneousAddCat8MB        2     719927342 ns/op      11.65 MB/s

after

BenchmarkInstantaneousAddCat1MB       50      32412242 ns/op      32.35 MB/s
BenchmarkInstantaneousAddCat2MB       50      64622451 ns/op      32.45 MB/s
BenchmarkInstantaneousAddCat4MB       20     199377593 ns/op      21.04 MB/s
BenchmarkInstantaneousAddCat8MB        5     419447024 ns/op      20.00 MB/s

License: MIT
Signed-off-by: Brian Tiger Chow <[email protected]>
type D interface {
Set(time.Duration) time.Duration
Wait()
}
Copy link
Member

Choose a reason for hiding this comment

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

I really like this setup. 👍

@jbenet
Copy link
Member

jbenet commented Dec 13, 2014

LGTM. RTM So far, my favorite PR of the month. 👍 👍 🌟 🌟 👏 👏

btc pushed a commit that referenced this pull request Dec 13, 2014
@btc btc merged commit 19894c4 into master Dec 13, 2014
@btc btc removed the status/in-progress In progress label Dec 13, 2014
@whyrusleeping
Copy link
Member

This is awesome. Ill rebase my changes over this.

@btc
Copy link
Contributor Author

btc commented Dec 13, 2014

In case you're not interested in wading through a bayou knee-deep in merge conflicts, I got my socks wet here: https://github.com/jbenet/go-ipfs/tree/bitswap-rounds-rebase-whyohmy

@btc btc deleted the test/mocks-on-mocks-on-mocks branch December 18, 2014 15:29
@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 tasks
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
…com/multiformats/go-multihash-0.0.13

build(deps): bump github.com/multiformats/go-multihash from 0.0.10 to 0.0.13
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.

3 participants