frisbee-go
frisbee-go copied to clipboard
Feat: Automatic Reconnects
Description
This PR adds support for automatic reconnects (with exponential backoff) for clients
Type of change
Please update the title of this PR to reflect the type of change. (Delete the ones that aren't required).
- [x] New feature (non-breaking change which adds functionality) [title: 'feat:']
- [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Testing
Please make sure that existing test cases pass (with go test ./... -race and go test -bench=. ./... -race),
and if required please add new test cases and list them below:
- [x] TestIndividualOptions
Benchmarking
Frisbee tries to adhere to strict performance requirements, so please make sure to run go test -bench=. ./... and paste the results below:
Benchmarking Results:
goos: darwin
goarch: arm64
pkg: github.com/loopholelabs/frisbee-go
BenchmarkAsyncThroughputPipe/32_Bytes-12 27585 43115 ns/op 74.22 MB/s 10337 B/op 212 allocs/op
BenchmarkAsyncThroughputPipe/512_Bytes-12 24459 49021 ns/op 1044.46 MB/s 10341 B/op 212 allocs/op
BenchmarkAsyncThroughputPipe/1024_Bytes-12 23536 51412 ns/op 1991.74 MB/s 10356 B/op 212 allocs/op
BenchmarkAsyncThroughputPipe/2048_Bytes-12 20256 59271 ns/op 3455.32 MB/s 10496 B/op 215 allocs/op
BenchmarkAsyncThroughputPipe/4096_Bytes-12 15124 79279 ns/op 5166.55 MB/s 10828 B/op 220 allocs/op
BenchmarkAsyncThroughputNetwork/32_Bytes-12 27540 42323 ns/op 75.61 MB/s 258 B/op 4 allocs/op
BenchmarkAsyncThroughputNetwork/512_Bytes-12 23466 51148 ns/op 1001.02 MB/s 259 B/op 4 allocs/op
BenchmarkAsyncThroughputNetwork/1024_Bytes-12 22731 52539 ns/op 1949.04 MB/s 259 B/op 4 allocs/op
BenchmarkAsyncThroughputNetwork/2048_Bytes-12 18820 63915 ns/op 3204.28 MB/s 262 B/op 4 allocs/op
BenchmarkAsyncThroughputNetwork/4096_Bytes-12 12865 92423 ns/op 4431.80 MB/s 261 B/op 4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_32_Bytes-12 27988 42717 ns/op 74.91 MB/s 346 B/op 4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_32_Bytes-12 27302 43866 ns/op 72.95 MB/s 706 B/op 8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_32_Bytes-12 16668 61707 ns/op 51.86 MB/s 2040 B/op 20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_32_Bytes-12 10047 116379 ns/op 27.50 MB/s 5018 B/op 40 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_32_Bytes-12 16660 91794 ns/op 34.86 MB/s 2442 B/op 24 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_32_Bytes-12 9156 136936 ns/op 23.37 MB/s 6291 B/op 48 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_32_Bytes-12 5202 236738 ns/op 13.52 MB/s 17310 B/op 97 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_512_Bytes-12 23415 51052 ns/op 1002.89 MB/s 363 B/op 4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_512_Bytes-12 23559 50708 ns/op 1009.71 MB/s 734 B/op 8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_512_Bytes-12 16711 82835 ns/op 618.09 MB/s 2038 B/op 20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_512_Bytes-12 8625 143138 ns/op 357.70 MB/s 5374 B/op 40 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_512_Bytes-12 10352 115357 ns/op 443.84 MB/s 2977 B/op 24 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_512_Bytes-12 7924 153348 ns/op 333.88 MB/s 6772 B/op 48 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_512_Bytes-12 4680 259377 ns/op 197.40 MB/s 18563 B/op 97 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/1_Pair,_4096_Bytes-12 13003 92436 ns/op 4431.19 MB/s 481 B/op 4 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/2_Pair,_4096_Bytes-12 11792 97989 ns/op 4180.08 MB/s 1015 B/op 8 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/5_Pair,_4096_Bytes-12 3132 372307 ns/op 1100.17 MB/s 5629 B/op 20 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/10_Pair,_4096_Bytes-12 1665 675288 ns/op 606.56 MB/s 18570 B/op 42 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Half_CPU_Pair,_4096_Bytes-12 2796 429033 ns/op 954.70 MB/s 7440 B/op 25 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/CPU_Pair,_4096_Bytes-12 1412 812258 ns/op 504.27 MB/s 25044 B/op 50 allocs/op
BenchmarkAsyncThroughputNetworkMultiple/Double_CPU_Pair,_4096_Bytes-12 744 1575329 ns/op 260.01 MB/s 85839 B/op 103 allocs/op
BenchmarkThroughputClient/test-12 58 18838904 ns/op 1781.10 MB/s 5318 B/op 19 allocs/op
BenchmarkThroughputResponseClient/test-12 62 18743487 ns/op 1790.16 MB/s 4745 B/op 16 allocs/op
BenchmarkThroughputServerSingle/test-12 58 18704711 ns/op 1793.88 MB/s 8365 B/op 21 allocs/op
BenchmarkThroughputServerUnlimited/test-12 30 36769924 ns/op 912.54 MB/s 11406364 B/op 151311 allocs/op
BenchmarkThroughputServerLimited/test-12 51 198704479 ns/op 168.86 MB/s 7572158 B/op 134134 allocs/op
BenchmarkThroughputResponseServerSingle/test-12 63 18816794 ns/op 1783.19 MB/s 4862 B/op 2 allocs/op
BenchmarkThroughputResponseServerSlowSingle/test-12 1 4733102875 ns/op 7.09 MB/s 37970152 B/op 260965 allocs/op
BenchmarkThroughputResponseServerSlowUnlimited/test-12 33 34632316 ns/op 968.86 MB/s 7405838 B/op 132658 allocs/op
BenchmarkThroughputResponseServerSlowLimited/test-12 14 84293911 ns/op 398.06 MB/s 7299149 B/op 131544 allocs/op
BenchmarkSyncThroughputPipe/32_Bytes-12 7051 164381 ns/op 19.47 MB/s 1856 B/op 204 allocs/op
BenchmarkSyncThroughputPipe/512_Bytes-12 7106 165798 ns/op 308.81 MB/s 1856 B/op 204 allocs/op
BenchmarkSyncThroughputPipe/1024_Bytes-12 7020 167397 ns/op 611.72 MB/s 1856 B/op 204 allocs/op
BenchmarkSyncThroughputPipe/2048_Bytes-12 7008 168892 ns/op 1212.61 MB/s 1858 B/op 204 allocs/op
BenchmarkSyncThroughputPipe/4096_Bytes-12 6789 171084 ns/op 2394.14 MB/s 1858 B/op 204 allocs/op
BenchmarkSyncThroughputNetwork/32_Bytes-12 1920 530592 ns/op 6.03 MB/s 1857 B/op 204 allocs/op
BenchmarkSyncThroughputNetwork/512_Bytes-12 2078 560851 ns/op 91.29 MB/s 1857 B/op 204 allocs/op
BenchmarkSyncThroughputNetwork/1024_Bytes-12 1956 570445 ns/op 179.51 MB/s 1859 B/op 204 allocs/op
BenchmarkSyncThroughputNetwork/2048_Bytes-12 2089 581327 ns/op 352.30 MB/s 1861 B/op 204 allocs/op
BenchmarkSyncThroughputNetwork/4096_Bytes-12 2176 577566 ns/op 709.18 MB/s 1862 B/op 204 allocs/op
BenchmarkAsyncThroughputLarge/1MB-12 104 11307135 ns/op 9273.58 MB/s 333 B/op 4 allocs/op
BenchmarkAsyncThroughputLarge/2MB-12 57 21606251 ns/op 9706.23 MB/s 76306 B/op 4 allocs/op
BenchmarkAsyncThroughputLarge/4MB-12 25 47742262 ns/op 8785.31 MB/s 430 B/op 4 allocs/op
BenchmarkAsyncThroughputLarge/8MB-12 12 95968552 ns/op 8741.00 MB/s 1409962 B/op 7 allocs/op
BenchmarkAsyncThroughputLarge/16MB-12 6 208816688 ns/op 8034.42 MB/s 8422966 B/op 11 allocs/op
BenchmarkSyncThroughputLarge/1MB-12 80 12986613 ns/op 8074.28 MB/s 132895 B/op 204 allocs/op
BenchmarkSyncThroughputLarge/2MB-12 42 24315538 ns/op 8624.74 MB/s 506187 B/op 205 allocs/op
BenchmarkSyncThroughputLarge/4MB-12 28 49939199 ns/op 8398.82 MB/s 1509676 B/op 206 allocs/op
BenchmarkSyncThroughputLarge/8MB-12 10 102207958 ns/op 8207.39 MB/s 4172319 B/op 208 allocs/op
BenchmarkSyncThroughputLarge/16MB-12 4 261995240 ns/op 6403.63 MB/s 76979638 B/op 238 allocs/op
BenchmarkTCPThroughput/32_Bytes-12 21454 55315 ns/op 57.85 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/512_Bytes-12 12693 93485 ns/op 547.68 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/1024_Bytes-12 7976 147680 ns/op 693.39 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/2048_Bytes-12 4574 262443 ns/op 780.36 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/4096_Bytes-12 2486 483888 ns/op 846.48 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/1MB-12 100 13334011 ns/op 7863.92 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/2MB-12 50 26019077 ns/op 8060.06 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/4MB-12 20 60771173 ns/op 6901.80 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/8MB-12 10 120858004 ns/op 6940.88 MB/s 304 B/op 4 allocs/op
BenchmarkTCPThroughput/16MB-12 4 254559886 ns/op 6590.68 MB/s 304 B/op 4 allocs/op
PASS
ok github.com/loopholelabs/frisbee-go 151.611s
? github.com/loopholelabs/frisbee-go/internal/dialer [no test files]
goos: darwin
goarch: arm64
pkg: github.com/loopholelabs/frisbee-go/pkg/metadata
BenchmarkEncode-12 88558629 13.43 ns/op
BenchmarkDecode-12 290731274 4.122 ns/op
BenchmarkEncodeDecode-12 68587594 17.27 ns/op
PASS
ok github.com/loopholelabs/frisbee-go/pkg/metadata 5.059s
PASS
ok github.com/loopholelabs/frisbee-go/pkg/packet 0.154s
Final Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
- [x] I have checked my code and corrected any misspellings
- [x] I have signed-off my commits with
git commit -s(see the developer's certificate of origin)
This PR needs to be tested much more thoroughly before it can be merged.