performance(network): shutdown faster with parallelization #5029
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.
I found these things while trying to figure out why MTE tests take so long, though its not using much CPU for a lot of it.
The changes to NetworkSystemImpl help some by themselves, and by explicitly passing the "quiet time" parameter to shutdown(), we lay the groundwork for changing that value. I don't know if we ever want to wait two seconds for that, but in tests we very much do not!
The values of 2 and 15 seconds are the defaults netty has been using when we don't specify.
Thread.onSpinWait() tells the JVM this thread is just waiting, not doing useful work.
How to test
The changes are mostly about shutting down the network server (or client). I guess make sure that still behaves as expected without stalling?
The other extreme would be "too fast" instead of "too slow (stalling)", but I don't know "shuts down too fast" would show up as any sort of problem.