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

Accurate Metrics #756

Closed
Stebalien opened this issue Mar 22, 2018 · 4 comments
Closed

Accurate Metrics #756

Stebalien opened this issue Mar 22, 2018 · 4 comments

Comments

@Stebalien
Copy link
Member

Now that transports do stream multiplexing/encryption, it's impossible to externally track bandwidth metrics.

Proposal: Introduce an (optional) interface that transports can implement to internally (and more accurately) track bandwidth usage. Transports that use the transport upgrader will get this for free but transports like QUIC will have to implement this manually.

type BwStats struct {
	TotalIn, TotalOut int64
	RateIn, RateOut   float64
}

type MeteredConn interface {
	Conn
	BandwidthStats() BandwidthStats
}

If a transport Conn doesn't implement this interface, the Network will fallback on tracking bandwidth usage by summing the bandwidth across all open streams over the connection.

Open question: How will we disable this? Can we just make it fast enough that we don't care (go-flow-metrics is pretty damn fast)? Global flag (yuck!).

@Stebalien Stebalien transferred this issue from libp2p/go-libp2p-transport Dec 6, 2019
@marten-seemann
Copy link
Contributor

What is the problem here with QUIC? Why is it not ok to sum over the streams?
Do you want to include ACKs and other control frames in the bandwidth measurement? Or distinguish between goodput and throughput?

@Stebalien
Copy link
Member Author

Do you want to include ACKs and other control frames in the bandwidth measurement?

Yes. I'd like to measure the total bandwidth (including control, crypto, etc.). (I guess to be accurate for TCP we'd have to ask the OS).

@marten-seemann
Copy link
Contributor

I guess to be accurate for TCP we'd have to ask the OS.

That’s correct. Furthermore, we’d have to specify at which layer we draw the boundary (does the TCP header count? The QUIC header? The UDP header? What about IP itself?).

Or to rephrase my question, under which circumstances does summing up over all streams give us a result that would make us act in a different way than if we measured the total bandwidth (however we end up defining it)?

@Stebalien
Copy link
Member Author

Or to rephrase my question, under which circumstances does summing up over all streams give us a result that would make us act in a different way than if we measured the total bandwidth.

Good point. Summing is probably sufficient.

I know we have some users billing based on the network statistics but, really, billing for effective bandwidth is probably better anyways. I'm not even sure if we can get accurate measurements from the OS as we'd need to include retransmissions, etc.

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

No branches or pull requests

2 participants