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

The server now speaks non-ws NDT with JSON messages. #52

Merged
merged 25 commits into from
Mar 1, 2019

Conversation

pboothe
Copy link
Contributor

@pboothe pboothe commented Jan 4, 2019

This change is Reviewable

@coveralls
Copy link
Collaborator

coveralls commented Jan 4, 2019

Pull Request Test Coverage Report for Build 323

  • 219 of 276 (79.35%) changed or added relevant lines in 6 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+1.0%) to 65.527%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ndt-server.go 59 60 98.33%
legacy/s2c/s2c.go 19 23 82.61%
legacy/testresponder/testresponder.go 11 15 73.33%
legacy/testrunner.go 65 77 84.42%
legacy/protocol/protocol.go 52 88 59.09%
Files with Coverage Reduction New Missed Lines %
ndt-server.go 1 87.14%
legacy/s2c/s2c.go 1 78.15%
Totals Coverage Status
Change from base Build 319: 1.0%
Covered Lines: 709
Relevant Lines: 1082

💛 - Coveralls

@bassosimone
Copy link
Contributor

bassosimone commented Jan 7, 2019

It seems regress tests are failing because of:

./web100clt

That is, the legacy client is missing. We probably don't want to compile it as part of this repository testing process. Maybe we can store it as a binary asset to download for travis?

(If this PR is still WIP, as you asked for no reviewers, please disregard :-)

@pboothe
Copy link
Contributor Author

pboothe commented Jan 7, 2019

Still WIP

When it becomes reviewable, it will have reviewers assigned. :)

The command-line client doesn't work - it fails at the NDT handshake. I
do not (yet) know why.
We need to put in some metrics gathering.
// is okay to break them.
ws.DrainUntil(time.Now().Add(5 * time.Second))
ws.Close()
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@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.

My primary concerns are with the ramifications of the raw-to-ws pass through on performance, data collection, and monitoring.

Reviewed 2 of 10 files at r1.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @pboothe and @stephen-soltesz)


ndt-server.go, line 135 at r1 (raw file):

	// The legacy protocol serving non-HTTP-based tests - forwards to WS-based
	// server if the first three bytes are "GET".
	legacyRawServer := legacy.BasicServer{

There is a lot going on in setup; we're starting 5 services.

I like the flag naming convention you've adopted, i.e. "legacy, legacy_ws, legacy_wss". The variables below do not follow this consistently. For example, it's hard to tell that "legacyServer" below is actually the setup for the "legacy_ws" port.

It looks like the legacy server is not instrumented with prometheus metrics. I think we will want to be able to measure how often the raw-to-ws proxy is operating.


TestDockerfile, line 2 at r1 (raw file):

FROM golang:1.11 as build
COPY --from=pboothe/test-runner /ndt/src/web100clt /bin

This should not reference personal container images. How was pboothe/test-runner built? How can we rebuild it if needed? Can we include that docker file in the ndt-server also?


legacy/testrunner.go, line 151 at r1 (raw file):

	}
	if string(lead) == "GET" {
		// Forward HTTP-like handshakes to the HTTP server. Note that this does NOT

Please ensure that we can count the relative frequency of 3001-raw vs 3001-ws clients using prometheus metrics.

If we never expect direct connections to 3002 then we could use the difference between connections to 3001 - connections to 3002 using the http handler instruments.


legacy/testrunner.go, line 155 at r1 (raw file):

		// HTTP server itself opens the testing port, and that server will not use
		// this TCP proxy.
		fwd, err := net.Dial("tcp", s.HTTPAddr)

Is it too late in the protocol negotiation to issue a 301 Redirect?


legacy/testrunner.go, line 164 at r1 (raw file):

		// Copy the input channel.
		go func() {
			io.Copy(fwd, input)

What impact on performance does this have?

Does this mean tcpinfo will collect two traces?


legacy/protocol/protocol.go, line 180 at r1 (raw file):

	}
	if MessageType(inbuff[0]) != expectedType {
		return nil, fmt.Errorf("Read wrong message type. Wanted %s, got %s", expectedType, MessageType(inbuff[0]))

%q?


legacy/s2c/s2c.go, line 25 at r1 (raw file):

// Result is the result object returned to S2C clients as JSON.
type Result struct {
	ThroughputValue  string

Were the types here totally wrong before? This change must impact clients that parse the value, no? A rate in json quotes is very different from not.


legacy/s2c/s2c.go, line 133 at r1 (raw file):

	}
	protocol.SendJSONMessage(protocol.TestFinalize, "", ws)
	r.Response <- 0.0

Please add comment that this is telling the client thread to shutdown. Maybe a constant like testresponder.Shutdown?


legacy/testresponder/testresponder.go, line 28 at r1 (raw file):

const (
	// RawNoJSON NDT tests correspond to the code integrated into the uTorrent client.
	RawNoJSON = ServerType(iota)

RawNoJSON is not used anywhere, is that expected?

Copy link
Contributor Author

@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.

Performance isn't an issue - only the control channel is a pass-through. Data collection is a mild irritation - tcp-info will generate two traces for passed-through connections (but again, that's only the control channel so it's okay). Monitoring is a thing I would like to talk more about, probably in person.

Initial comments below. No need to respond yet.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @pboothe and @stephen-soltesz)


TestDockerfile, line 2 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

This should not reference personal container images. How was pboothe/test-runner built? How can we rebuild it if needed? Can we include that docker file in the ndt-server also?

Dockerizing old versions of web100clt seems like potentially a lot of work. I'll double-check this to see, but I am worried.


legacy/testrunner.go, line 155 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

Is it too late in the protocol negotiation to issue a 301 Redirect?

Interesting idea. I will see.


legacy/testrunner.go, line 164 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

What impact on performance does this have?

Does this mean tcpinfo will collect two traces?

None (the control channel has minimal performance requirements) and yes, but only for the control channel, which is not the connection over which measurements take place.


legacy/testresponder/testresponder.go, line 28 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

RawNoJSON is not used anywhere, is that expected?

Yes. It is the next server type I have to implement and the last NDT client type that exists in the wild. It is the client type for uTorrent. But the current PR felt like enough of a change that i wanted to stop here and get a review.

Copy link
Contributor Author

@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.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @pboothe and @stephen-soltesz)


TestDockerfile, line 2 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

Dockerizing old versions of web100clt seems like potentially a lot of work. I'll double-check this to see, but I am worried.

As you can see, it sucked and I did it. :P

Copy link
Contributor Author

@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.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @bassosimone, @pboothe, and @stephen-soltesz)


TestDockerfile, line 2 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

As you can see, it sucked and I did it. :P

Done.


legacy/testrunner.go, line 164 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

None (the control channel has minimal performance requirements) and yes, but only for the control channel, which is not the connection over which measurements take place.

Done.


legacy/c2s/c2s.go, line 43 at r1 (raw file):

Previously, bassosimone (Simone Basso) wrote…

👍

Done.


legacy/protocol/protocol.go, line 180 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

%q?

Done.


legacy/s2c/s2c.go, line 133 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

Please add comment that this is telling the client thread to shutdown. Maybe a constant like testresponder.Shutdown?

Changed to close()

@pboothe
Copy link
Contributor Author

pboothe commented Feb 28, 2019


legacy/s2c/s2c.go, line 25 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

Were the types here totally wrong before? This change must impact clients that parse the value, no? A rate in json quotes is very different from not.

The types were wrong before. The old server code to generate the JSON is: https://github.com/m-lab/ndt/blob/master/src/test_s2c_srv.c#L625

It turns out that the web100clt binary expects them to be strings, and javascript clients will silently convert between strings and numbers because javascript is like that. Computers are terrible.

Copy link
Contributor Author

@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.

PTAL

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @bassosimone, @pboothe, and @stephen-soltesz)


ndt-server.go, line 135 at r1 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

There is a lot going on in setup; we're starting 5 services.

I like the flag naming convention you've adopted, i.e. "legacy, legacy_ws, legacy_wss". The variables below do not follow this consistently. For example, it's hard to tell that "legacyServer" below is actually the setup for the "legacy_ws" port.

It looks like the legacy server is not instrumented with prometheus metrics. I think we will want to be able to measure how often the raw-to-ws proxy is operating.

Done and done.

Copy link
Contributor

@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.

:lgtm:

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @bassosimone)


TestDockerfile, line 2 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

Done.

Thank you. This is much better.


legacy/s2c/s2c.go, line 133 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

Changed to close()

Even better.


legacy/testrunner.go, line 155 at r1 (raw file):

Previously, pboothe (Peter Boothe) wrote…

Interesting idea. I will see.

We discussed offline that while redirect might be the "right thing" we're doing this at all to support legacy clients, which evidently, may not all support redirection [which is ridiculous]. And, we would only ever consider doing something like this for the legacy protocol.

Copy link
Contributor

@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 @bassosimone and @pboothe)


ndt-server_test.go, line 154 at r2 (raw file):

	}{
		// Test legacy raw JSON clients
		{

Please add TODO for web100clt-without-json-support

Copy link
Contributor Author

@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.

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


ndt-server_test.go, line 154 at r2 (raw file):

Previously, stephen-soltesz (Stephen Soltesz) wrote…

Please add TODO for web100clt-without-json-support

Done.

@pboothe pboothe merged commit d111cca into master Mar 1, 2019
@pboothe pboothe deleted the non-ws-with-json branch March 1, 2019 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants