-
Notifications
You must be signed in to change notification settings - Fork 110
pushsync: optimize TestPushsyncSimulation #1819
Conversation
@@ -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") |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow good find
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.