Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

[WIP] Add a P-sharded Object Pool #191

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

prateek
Copy link
Contributor

@prateek prateek commented Sep 27, 2018

Benchmark results for ShardedPool v ObjectPool on my laptop look quite promising: 9x better with GOMAXPROCS=4 for concurrent gets/puts, very similar in other categories

❯ go test -bench=Pool -cpu 1,2,4 -run '^$' ./pool
goos: darwin
goarch: amd64
pkg: github.com/m3db/m3x/pool
BenchmarkObjectPoolGetPut                	10000000	       111 ns/op
BenchmarkObjectPoolGetPut-2              	20000000	       102 ns/op
BenchmarkObjectPoolGetPut-4              	20000000	        93.9 ns/op
BenchmarkShardedPoolGetPut               	20000000	        93.4 ns/op
BenchmarkShardedPoolGetPut-2             	20000000	        90.6 ns/op
BenchmarkShardedPoolGetPut-4             	20000000	        91.3 ns/op
BenchmarkShardedPoolConcurrentGetPut     	50000000	        38.0 ns/op
BenchmarkShardedPoolConcurrentGetPut-2   	100000000	        20.4 ns/op
BenchmarkShardedPoolConcurrentGetPut-4   	100000000	        16.3 ns/op
BenchmarkChannelPoolConcurrentGetPut     	20000000	        91.0 ns/op
BenchmarkChannelPoolConcurrentGetPut-2   	10000000	       142 ns/op
BenchmarkChannelPoolConcurrentGetPut-4   	10000000	       175 ns/op
BenchmarkShardedPoolOverflow             	  300000	      5866 ns/op
BenchmarkShardedPoolOverflow-2           	  500000	      3979 ns/op
BenchmarkShardedPoolOverflow-4           	  500000	      2783 ns/op
BenchmarkChannelPoolOverflow             	  200000	      5852 ns/op
BenchmarkChannelPoolOverflow-2           	  500000	      3233 ns/op
BenchmarkChannelPoolOverflow-4           	  500000	      2669 ns/op

@jeromefroe
Copy link
Contributor

What do you think of following the example of drwmutex to make the pool per-CPU instead of per-P so we don't have to call into the runtime?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants