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
Use of rand.Float64() reduces parallelism #80
Comments
Hi @eliaslevy, This looks like it would be a nice improvement. Having an alternative API would work but I am wondering if using a separate |
That would work. Although it would require folks using the buffered client to reconfigure the timeout or buffer size value so the system to output roughly the same number of packets as when using a single global client. I went a somewhat different route. I used |
Once #108 is merged I should be able to simply add a rand per "worker". |
Hey - I no longer work on this repo |
#178 was merged and release (see |
The global default
math/rand
generator is protected by a mutex. In a highly concurrent application making lots of calls to the DD library and making use of therate
parameter to the API sample metrics so as to not drop packets and overload the statsd server, the use ofrand.Float64
instatsd.Client.send
can become a bottleneck.Ideally, there would be an alternative API that allows the caller to pass in goroutine local
math.rand.Rand
, which is not protected by a mutex.The text was updated successfully, but these errors were encountered: