Thanks Robert, Uli and Ian for your suggestions. I think what I will probably do is use a Ticker with a duration of 1ms. At every 1ms, I will "wake-up" N number of goroutines to trigger HTTP requests. That number N = (request rate per second / 1000) = requests per ms. So, if I need to ensure a rate of 10000 requests per second, I believe it should be possible for the Ticker to return after every 1ms and then fire about 10 requests at every such interval. >From the tests that I have performed, I can see that a Ticker pretty accurately fires at every 1ms interval. I think it's only when the Ticker duration falls below 1ms, that I see issues.
If my desired rate is less than 1000 per second, then I will create a Ticker to return every 1000/request rate milliseconds, which will be a number greater than 1ms. This approach is closely based on Robert's suggestion about using a higher duration for Ticker time and waking up a small subset of goroutines. I think it should be ok for a client to be accurate at the level of granularity of 1ms. On Thursday, 3 February 2022 at 01:14:20 UTC+11 ren...@ix.netcom.com wrote: > Because 20000 is a magnitude larger than 2000. > > > On Feb 1, 2022, at 1:44 PM, Uli Kunitz <uli.k...@gmail.com> wrote: > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/364fee9a-35c8-4161-a051-53a5d527f967n%40googlegroups.com.