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

Fix netx.Conn metrics and reduce ndt7 websocket buffer #299

Merged
merged 4 commits into from Jun 16, 2020

Conversation

stephen-soltesz
Copy link
Contributor

@stephen-soltesz stephen-soltesz commented Jun 15, 2020

During load testing, I discovered that ndt5 can close netx.Conns multiple times. This change guarantees that the metric is only decremented once.

During load testing, I discovered that ndt7 RAM requirements limit maximum concurrent connections to 1/3 ndt5's level with ndt-server RSS maxing out around 9.5GB before the system failed. This appears to be due to the extremely large websocket buffers. This change adds a new constant for the websocket buffer sizes of 1MB. Buffer sizes are independent of websocket message sizes.

With these settings load testing was able to comfortably support 300 concurrent connections (the previous water mark from NDT5) or ~1700 tests/min (very close to the theoretical limit of 1800 / min for 10sec tests, which is much tighter run time than ndt5's 15sec/test).


This change is Reviewable

@coveralls
Copy link
Collaborator

coveralls commented Jun 15, 2020

Pull Request Test Coverage Report for Build 1370

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 80.784%

Totals Coverage Status
Change from base Build 1368: 0.1%
Covered Lines: 1690
Relevant Lines: 2092

💛 - Coveralls

@stephen-soltesz
Copy link
Contributor Author

@stephen-soltesz
Copy link
Contributor Author

Copy link
Contributor

@pboothe pboothe left a comment

Choose a reason for hiding this comment

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

LGTM. One comment about a comment.

@@ -110,7 +112,7 @@ func (ln *Listener) Accept() (net.Conn, error) {
// returned by LocalAddr and RemoteAddr should be released before calling Close.
func (mc *Conn) Close() error {
mc.fp.Close()
CurrentOpenConns.Dec()
mc.once.Do(CurrentOpenConns.Dec)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for this.

// message sizes defined above (which may be larger) and used to optimize read
// and write operations. However, larger buffers will practically limit the
// total number of concurrent connections possible.
const DefaultWebsocketBufferSize = 1 << 20
Copy link
Contributor

Choose a reason for hiding this comment

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

Would prefer a comment after this // 1 MB or maybe // 1 MiB if you are feeling pedantic.

Copy link
Contributor Author

@stephen-soltesz stephen-soltesz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @pboothe and @stephen-soltesz)


ndt7/spec/spec.go, line 30 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

Would prefer a comment after this // 1 MB or maybe // 1 MiB if you are feeling pedantic.

Done. I call out 1MB explicitly in the comment now. The other constants in this file do not have annotations. So, I hope this captures the spirit of your feedback.

@pboothe
Copy link
Contributor

pboothe commented Jun 16, 2020

It very much captures the spirit of my feedback. The other constants also need to have units, and this seemed as good a place to start as any. Now all the other constants (that aren't unitless or durations) look a little underdocumented, which is as it should be. The next person who touches their comments will now (hopefully) put a little extra in there.

@stephen-soltesz stephen-soltesz merged commit 5daf100 into master Jun 16, 2020
@stephen-soltesz stephen-soltesz deleted the soltesz-fix-netx-dec branch June 16, 2020 16:30
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.

None yet

3 participants