#Throttling quic-go?

5 messages · Page 1 of 1 (latest)

radiant hearth
#

In this example but with hclient.Post(addr, 'application/x-mpegURL', bytes.NewReader([]byte("Hello, world!"))), any ideas on how I could throttle the upload speed (in bytes)?

e.g. the first URL should be allow a max rate of 100Kbps, while all the URLs after only get 10Kbps.

https://github.com/lucas-clemente/quic-go/blob/master/example/client/main.go#L85-L106

My guess is that I can throttle the reader, but unsure if this is the best approach.

violet tinsel
#

yes, throttling the io.Copy operation should be the way to go, you can use io.CopyN and define the chunk of data to read and have some ticker

#

im sure there are libraries that do all of that more efficiently

radiant hearth
upper crag
#

@radiant hearth just FYI throttling add more CPU overhead on your server (extra context switches, timer operations, ...).
Maybe this is a fine tradeoff for you, but I usually don't bother with this personally.
QUIC-go should share more or less fairly the network ressources already.