Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store: use k-way merging for proxying logic
Use k-way merging for merging multiple responses coming from multiple StoreAPIs. This avoids having a bottleneck of a Go channel that can only hold 10 responses at once. So, now we will Recv() messages as fast as possible. Users should be able to see much quicker queries because network will be used as much as possible. Benchmarks: ``` name old time/op new time/op delta ProxySeries/1000000SeriesWith1Samples/4_client_with_1_samples,_250000_series_each-16 1.01s ± 7% 0.24s ± 2% -76.62% (p=0.008 n=5+5) ProxySeries/1000000SeriesWith1Samples/single_client_with_1_samples,_1000000_series-16 926ms ± 3% 454ms ± 2% -50.99% (p=0.008 n=5+5) ProxySeries/100000SeriesWith100Samples/4_client_with_25_samples,_25000_series_each-16 95.6ms ± 1% 23.4ms ± 3% -75.52% (p=0.016 n=4+5) ProxySeries/100000SeriesWith100Samples/single_client_with_100_samples,_100000_series-16 93.1ms ± 2% 45.1ms ± 1% -51.63% (p=0.008 n=5+5) ProxySeries/1SeriesWith10000000Samples/4_client_with_2500000_samples,_1_series_each-16 39.5µs ± 1% 25.2µs ± 1% -36.22% (p=0.008 n=5+5) ProxySeries/1SeriesWith10000000Samples/single_client_with_10000000_samples,_1_series-16 22.6µs ± 0% 15.2µs ± 0% -32.71% (p=0.008 n=5+5) name old alloc/op new alloc/op delta ProxySeries/1000000SeriesWith1Samples/4_client_with_1_samples,_250000_series_each-16 186MB ± 0% 108MB ± 0% -41.87% (p=0.008 n=5+5) ProxySeries/1000000SeriesWith1Samples/single_client_with_1_samples,_1000000_series-16 186MB ± 0% 107MB ± 0% -42.18% (p=0.008 n=5+5) ProxySeries/100000SeriesWith100Samples/4_client_with_25_samples,_25000_series_each-16 18.5MB ± 0% 10.0MB ± 0% -45.79% (p=0.008 n=5+5) ProxySeries/100000SeriesWith100Samples/single_client_with_100_samples,_100000_series-16 18.5MB ± 0% 10.6MB ± 0% -42.69% (p=0.008 n=5+5) ProxySeries/1SeriesWith10000000Samples/4_client_with_2500000_samples,_1_series_each-16 10.9kB ± 0% 6.1kB ± 0% -44.06% (p=0.008 n=5+5) ProxySeries/1SeriesWith10000000Samples/single_client_with_10000000_samples,_1_series-16 5.09kB ± 0% 3.06kB ± 0% -39.83% (p=0.008 n=5+5) name old allocs/op new allocs/op delta ProxySeries/1000000SeriesWith1Samples/4_client_with_1_samples,_250000_series_each-16 5.00M ± 0% 1.00M ± 0% -80.00% (p=0.008 n=5+5) ProxySeries/1000000SeriesWith1Samples/single_client_with_1_samples,_1000000_series-16 5.00M ± 0% 1.00M ± 0% -80.00% (p=0.008 n=5+5) ProxySeries/100000SeriesWith100Samples/4_client_with_25_samples,_25000_series_each-16 500k ± 0% 100k ± 0% -79.96% (p=0.008 n=5+5) ProxySeries/100000SeriesWith100Samples/single_client_with_100_samples,_100000_series-16 500k ± 0% 100k ± 0% -79.98% (p=0.016 n=5+4) ProxySeries/1SeriesWith10000000Samples/4_client_with_2500000_samples,_1_series_each-16 180 ± 0% 125 ± 0% -30.56% (p=0.008 n=5+5) ProxySeries/1SeriesWith10000000Samples/single_client_with_10000000_samples,_1_series-16 109 ± 0% 80 ± 0% -26.61% (p=0.008 n=5+5) ``` `TestProxyStore_SeriesSlowStores` also passes which tests how everything works with slow stores. Rewritten chunk deduplication logic to use hashing. In the future we could get some more marginal gains by using a selection/tournament tree. Signed-off-by: Giedrius Statkevičius <[email protected]>
- Loading branch information