Skip to content
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

Fix API asymmetries with Watch variants #36

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

joamaki
Copy link
Contributor

@joamaki joamaki commented Jul 3, 2024

Add *Watch variants to LowerBound, Prefix and All to make them work the same way as List and Get.

@joamaki joamaki requested a review from pippolo84 July 3, 2024 14:28
Add *Watch variants to LowerBound, Prefix and All to
make them work the same way as List and Get.

Signed-off-by: Jussi Maki <[email protected]>
@joamaki joamaki force-pushed the pr/joamaki/fix-api-unsymmetries branch from a932936 to 5059996 Compare July 3, 2024 14:30
Copy link

github-actions bot commented Jul 3, 2024

$ make test
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading golang.org/x/term v0.16.0
go: downloading github.com/spf13/cast v1.6.0
go: downloading golang.org/x/sys v0.17.0
go: downloading github.com/fsnotify/fsnotify v1.7.0
go: downloading github.com/sagikazarmark/slog-shim v0.1.0
go: downloading github.com/spf13/afero v1.11.0
go: downloading github.com/subosito/gotenv v1.6.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/magiconair/properties v1.8.7
go: downloading github.com/pelletier/go-toml/v2 v2.1.0
go: downloading golang.org/x/text v0.14.0
	github.com/cilium/statedb/reconciler/benchmark		coverage: 0.0% of statements
	github.com/cilium/statedb/reconciler/example		coverage: 0.0% of statements
ok  	github.com/cilium/statedb	5.407s	coverage: 89.0% of statements
ok  	github.com/cilium/statedb/index	0.004s	coverage: 25.5% of statements
ok  	github.com/cilium/statedb/internal	0.014s	coverage: 93.3% of statements
ok  	github.com/cilium/statedb/part	1.900s	coverage: 81.9% of statements
ok  	github.com/cilium/statedb/reconciler	2.293s	coverage: 80.8% of statements
-----
$ make bench
go test ./... -bench . -benchmem -test.run xxx
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb
cpu: AMD EPYC 7763 64-Core Processor                
BenchmarkDB_WriteTxn_1-4                    	  475099	      2497 ns/op	    400423 objects/sec	    2720 B/op	      32 allocs/op
BenchmarkDB_WriteTxn_10-4                   	 1249758	       959.9 ns/op	   1041780 objects/sec	     715 B/op	      10 allocs/op
BenchmarkDB_WriteTxn_100-4                  	 1580583	       757.9 ns/op	   1319429 objects/sec	     584 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_1000-4                 	 1514061	       840.0 ns/op	   1190477 objects/sec	     531 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_10000-4                	 1245349	      1031 ns/op	    970327 objects/sec	     554 B/op	       7 allocs/op
BenchmarkDB_WriteTxn_100_SecondaryIndex-4   	  518604	      2259 ns/op	    442633 objects/sec	    1672 B/op	      30 allocs/op
BenchmarkDB_RandomInsert-4                  	    2440	    483108 ns/op	   2069932 objects/sec	  385862 B/op	    7097 allocs/op
BenchmarkDB_RandomReplace-4                 	     433	   2781318 ns/op	    359542 objects/sec	 1846405 B/op	   30566 allocs/op
BenchmarkDB_SequentialInsert-4              	    1550	    789985 ns/op	   1265847 objects/sec	  534136 B/op	    7288 allocs/op
BenchmarkDB_Changes_Baseline-4              	    1256	    942577 ns/op	   1060922 objects/sec	  536275 B/op	   10246 allocs/op
BenchmarkDB_Changes-4                       	     696	   1721266 ns/op	    580968 objects/sec	  964458 B/op	   14539 allocs/op
BenchmarkDB_RandomLookup-4                  	   20806	     55581 ns/op	  17991929 objects/sec	     144 B/op	       1 allocs/op
BenchmarkDB_SequentialLookup-4              	   26208	     45711 ns/op	  21876514 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_FullIteration_All-4             	     794	   1648429 ns/op	  60663954 objects/sec	     360 B/op	       7 allocs/op
BenchmarkDB_FullIteration_Get-4             	     208	   5653215 ns/op	  17689089 objects/sec	       0 B/op	       0 allocs/op
BenchmarkDB_PropagationDelay-4              	  505299	      2231 ns/op	        19.00 50th_µs	        22.00 90th_µs	        86.00 99th_µs	    1514 B/op	      24 allocs/op
PASS
ok  	github.com/cilium/statedb	26.318s
PASS
ok  	github.com/cilium/statedb/index	0.004s
PASS
ok  	github.com/cilium/statedb/internal	0.003s
goos: linux
goarch: amd64
pkg: github.com/cilium/statedb/part
cpu: AMD EPYC 7763 64-Core Processor                
Benchmark_Insert_RootOnlyWatch-4    	    9214	    133232 ns/op	   7505712 objects/sec	  104124 B/op	    2041 allocs/op
Benchmark_Insert-4                  	    6459	    178334 ns/op	   5607470 objects/sec	  202675 B/op	    3064 allocs/op
Benchmark_Replace-4                 	29501481	        41.16 ns/op	  24295557 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Replace_RootOnlyWatch-4   	29184690	        41.24 ns/op	  24248542 objects/sec	       0 B/op	       0 allocs/op
Benchmark_txn_1-4                   	 2986898	       401.7 ns/op	   2489422 objects/sec	     432 B/op	       7 allocs/op
Benchmark_txn_10-4                  	 7407723	       159.0 ns/op	   6287664 objects/sec	     152 B/op	       2 allocs/op
Benchmark_txn_100-4                 	 7381794	       171.4 ns/op	   5832763 objects/sec	     223 B/op	       2 allocs/op
Benchmark_txn_1000-4                	 7460496	       162.0 ns/op	   6174438 objects/sec	     215 B/op	       2 allocs/op
Benchmark_txn_10000-4               	 4539885	       238.3 ns/op	   4196608 objects/sec	     238 B/op	       2 allocs/op
Benchmark_txn_100000-4              	 3960884	       293.9 ns/op	   3403000 objects/sec	     340 B/op	       2 allocs/op
Benchmark_txn_delete_1-4            	 3279792	       367.3 ns/op	   2722620 objects/sec	     840 B/op	       6 allocs/op
Benchmark_txn_delete_10-4           	 8710177	       137.5 ns/op	   7271267 objects/sec	     131 B/op	       1 allocs/op
Benchmark_txn_delete_100-4          	10446565	       117.0 ns/op	   8544764 objects/sec	      60 B/op	       1 allocs/op
Benchmark_txn_delete_1000-4         	11291892	       107.0 ns/op	   9344211 objects/sec	      26 B/op	       1 allocs/op
Benchmark_txn_delete_10000-4        	 9413884	       124.5 ns/op	   8033940 objects/sec	      25 B/op	       1 allocs/op
Benchmark_txn_delete_100000-4       	 7979077	       136.8 ns/op	   7312081 objects/sec	      26 B/op	       1 allocs/op
Benchmark_Get-4                     	   38326	     32180 ns/op	  31075315 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Iterate-4                 	  169270	      7364 ns/op	 135786863 objects/sec	      80 B/op	       3 allocs/op
Benchmark_Hashmap_Insert-4          	   15594	     76869 ns/op	  13009219 objects/sec	   86554 B/op	      64 allocs/op
Benchmark_Hashmap_Get_Uint64-4      	  147024	      8057 ns/op	 124110885 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Hashmap_Get_Bytes-4       	  147630	      8060 ns/op	 124062391 objects/sec	       0 B/op	       0 allocs/op
Benchmark_Uint64Map_Random-4        	    1305	    920307 ns/op	   1086595 items/sec	 2685400 B/op	    9034 allocs/op
Benchmark_Uint64Map_Sequential-4    	    1394	    863628 ns/op	   1157907 items/sec	 2476394 B/op	    9749 allocs/op
PASS
ok  	github.com/cilium/statedb/part	32.635s
PASS
ok  	github.com/cilium/statedb/reconciler	0.005s
?   	github.com/cilium/statedb/reconciler/benchmark	[no test files]
?   	github.com/cilium/statedb/reconciler/example	[no test files]
go run ./reconciler/benchmark -quiet
1000000 objects reconciled in 2.74 seconds (batch size 1000)
Throughput 365148.31 objects per second
Allocated 6011410 objects, 393446kB bytes, 546576kB bytes still in use

@joamaki joamaki merged commit 53bb7bc into main Jul 4, 2024
1 check passed
@joamaki joamaki deleted the pr/joamaki/fix-api-unsymmetries branch July 4, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants