Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

pushsync: optimize TestPushsyncSimulation #1819

Merged
merged 4 commits into from
Sep 27, 2019

Conversation

janos
Copy link
Member

@janos janos commented Sep 26, 2019

This PR addresses issues when running TestPushsyncSimulation with larger number of chunks.

The main problem was in the download function trying to get all the chunks at once.

It was noticed in profiling that storage.GenerateRandomChunk took a noticeable time to acquire a mutex lock. It is replaced by a faster variant which does not generate a valid chunk, but a chunk that is good enough for the simulation.

@@ -52,7 +53,7 @@ var (

var (
nodeCntFlag = flag.Int("nodes", 4, "number of nodes in simulation")
chunkCntFlag = flag.Int("chunks", 4, "number of chunks per upload in simulation")
chunkCntFlag = flag.Int("chunks", 1000, "number of chunks per upload in simulation")
testCasesFlag = flag.Int("cases", 4, "number of concurrent upload-download cases to test in simulation")
Copy link
Contributor

Choose a reason for hiding this comment

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

4 * 32 concurrent gets seems to be too many for Travis.

g.Go(func() error {
defer func() { <-sem }()
_, err := store.Get(ctx, chunk.ModeGetRequest, storage.NewRequest(addr))
Copy link
Contributor

Choose a reason for hiding this comment

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

Context is used incorrectly here - it has no timeout, which means that we have no global timeout for any retrieve requests.

I am not sure if Netstore.Get has the best interface, but it assumes that you set some timeout for the context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR, just making a mental node, maybe we want to change this in the future.

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

wow good find

@janos janos merged commit 674c352 into master Sep 27, 2019
@janos janos deleted the pushsync-simulation-optimization branch September 27, 2019 08:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants