storage/lockfile: shorten the sleeps in TestLockfileMixedConcurrent - #1037
Open
vtushar06 wants to merge 1 commit into
Open
storage/lockfile: shorten the sleeps in TestLockfileMixedConcurrent#1037vtushar06 wants to merge 1 commit into
vtushar06 wants to merge 1 commit into
Conversation
Signed-off-by: Tushar Verma <tusharmyself06@gmail.com>
Author
|
I only did the one sleep @mtrmac u called out, the multiprocess ones look like they actually need the time so I left them alone. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1016.
The 50 writers hold the lock exclusively, so 50 writers x 10 iterations x 100ms is 50 seconds of serialised sleeping and that is most of the test. It runs at about 7% cpu.
1ms is still a lot longer than a goroutine switch, and cutting the sleep instead of the goroutine counts means all 150 goroutines still pile onto the lock. The test goes from 52.6s to 3.2s and the package from 84.3s to 33.8s here.
To check it still catches a broken lock I made the writer take RLock instead of Lock, and it fails at 1ms the same as it does at 100ms, including at GOMAXPROCS=1 and 2. Ran it 20 times with no failures and it passes under -race.
I only touched the sleep @mtrmac mentioned. The 2s ones in TestLockfileTouch and TestLockfileRecordWrite look like filesystem timestamp granularity, and the multiprocess tests seem to need their time, so the package is still around 34s.