You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the Golang SDK use github.com/gofrs/uuid for UUIDv4 generation. Due to randomness requirement of UUIDv4, the performance is decided by the entropy pool of runtime, which usually means a IO bottleneck.
Another package github.com/google/uuid could provide better performance by optionally enable the random pool. Here is the benchmark on my server running Linux :
> go test -bench=. -test.count=16 ./uuid_benchmark_test.go | summary
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) Gold 6133 CPU @ 2.50GHz
Name Count-Avg (N) AvgTime - Avg,Max,Min,Stdeva (ns/op)
BenchmarkGofrsUUID-8 1408388.188 845.35 854 840.6 3.63
BenchmarkGoogleUUIDEnablePool-8 9252526.375 129.15 133.2 128.2 1.35
BenchmarkGoogleUUIDDisablePool-8 1408379.063 853.21 865.5 845 6.29
Hello @davendu, thank you for opening your first issue in InLong 🧡 We will respond as soon as possible ⏳
If this is a bug report, please provide screenshots or error logs for us to reproduce your issue, so we can do our best to fix it.
If you have any questions in the meantime, you can also ask us on the InLong Discussions 🔍
davendu
changed the title
[Improve]Speed up UUID generate for Golang SDK
[Improve]Optimize the generation speed of UUIDv4 for Golang SDK
Dec 13, 2024
Description
Currently the Golang SDK use
github.com/gofrs/uuid
for UUIDv4 generation. Due to randomness requirement of UUIDv4, the performance is decided by the entropy pool of runtime, which usually means a IO bottleneck.Another package
github.com/google/uuid
could provide better performance by optionally enable the random pool. Here is the benchmark on my server running Linux :Here is the test code:
Note that users should enable the feature by calling
google.EnableRandPool()
manually, which does not provides concurrent safety.InLong Component
InLong SDK
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: