Tomaž Jerman
Tomaž Jerman
Next up, this looks like a sizeable chunk  ```json {"special":"delimiter run line","ts":"2024-02-15T12:47:03.370Z"} {"scenario":"x100: basic build physical","operation":"unmaker","numbers":{"100-10000":{"min":3236,"max":4508,"avg":3600.3,"total":72006,"runs":[3937,3902,3569,3386,3644,3497,3539,3328,3449,4508,3491,3507,3347,3647,3236,3290,3612,3389,4372,3356]}},"meta":{}} {"scenario":"x100: basic build regular","operation":"unmaker","numbers":{"100-10000":{"min":3192,"max":4522,"avg":3608.7,"total":72174,"runs":[3915,3952,3579,3396,3651,3496,3549,3282,3488,4522,3502,3523,3356,3659,3192,3283,3664,3398,4388,3379]}},"meta":{}} {"scenario":"x100: basic CRUD regular","operation":"crud-create","numbers":{"100-10000":{"min":10,"max":48,"avg":13.83,"total":1383,"runs":[19,13,11,11,16,14,48,15,34,12,11,13,16,14,11,13,13,11,11,14,15,13,12,14,13,13,14,13,12,13,19,16,13,12,13,12,11,13,12,13,13,14,13,13,13,15,13,12,42,18,13,15,14,12,15,13,16,14,12,12,13,11,17,12,13,12,12,13,12,13,11,13,12,10,12,12,12,13,11,12,13,12,13,14,12,12,15,11,13,13,11,11,12,13,12,12,13,11,14,12]}},"meta":{}} {"scenario":"x100: basic CRUD regular","operation":"crud-lookup","numbers":{"100-10000":{"min":8,"max":37,"avg":10.14,"total":1014,"runs":[16,10,9,11,37,22,14,10,11,10,8,9,10,10,9,9,10,9,10,12,8,8,9,10,9,8,10,8,11,10,10,10,8,10,9,9,10,10,9,9,11,11,10,9,9,9,8,10,17,11,11,11,10,10,11,20,13,9,10,8,9,9,11,8,10,9,10,9,9,9,9,9,9,9,9,8,9,9,9,9,9,10,11,10,8,10,10,9,9,8,10,8,10,9,10,9,9,8,8,8]}},"meta":{}} {"scenario":"x100:...
Caching namespaces/modules (other top level resources) seems to bring the biggest performance increase so far
Next up might be worth checking contextual role bits?
I just removed RBAC and we get to this  ```json {"special":"delimiter run line","ts":"2024-02-15T14:58:18.933Z"} {"scenario":"x100: basic build regular","operation":"unmaker","numbers":{"100-10000":{"min":1856,"max":3040,"avg":2084.75,"total":41695,"runs":[3040,2090,2421,1976,1862,1863,2249,1856,1942,1969,1995,1997,2120,2163,1897,1947,2120,1904,2075,2209]}},"meta":{}} {"scenario":"x100: basic build physical","operation":"unmaker","numbers":{"100-10000":{"min":1859,"max":3046,"avg":2087.75,"total":41755,"runs":[3046,2104,2435,1982,1871,1874,2262,1859,1951,1980,2015,1956,2108,2152,1888,1937,2108,1898,2068,2261]}},"meta":{}} {"scenario":"x100: basic CRUD regular","operation":"crud-create","numbers":{"100-10000":{"min":8,"max":31,"avg":9.84,"total":984,"runs":[12,10,11,9,10,9,8,10,9,11,11,11,10,9,10,9,9,9,10,13,9,13,9,9,9,9,11,21,13,10,11,8,10,10,9,9,9,9,9,9,10,9,8,10,10,9,9,8,9,8,9,9,12,9,8,12,9,12,14,9,9,9,9,9,9,9,9,9,9,10,31,8,8,8,8,9,8,8,8,8,8,8,9,8,8,10,11,11,12,13,12,9,9,9,8,10,10,9,8,8]}},"meta":{}} {"scenario":"x100: basic CRUD regular","operation":"crud-lookup","numbers":{"100-10000":{"min":4,"max":15,"avg":6.23,"total":623,"runs":[8,7,6,6,6,6,10,6,7,6,8,7,6,6,6,6,7,7,6,6,6,7,6,6,7,7,7,10,7,7,6,6,6,5,6,6,6,6,6,6,5,5,5,6,6,7,6,7,6,5,6,8,15,7,5,5,6,7,7,6,5,6,5,6,5,7,6,6,5,6,7,6,6,5,6,5,6,5,5,5,5,5,5,7,5,6,7,8,8,6,7,5,5,6,5,6,6,7,4,5]}},"meta":{}}...
If we campare this to the original numbers:  This would then reduce the memory footprint by ~30GB for this scenario. From ~39GB to ~9GB which is ~9.3 times better...
# TL;DR The most impactful bits are: ## Caching RBAC resource keys We're working a bunch with strings when working with any resource. In tight loops, all these strings rack...
# Caching top-level resources Improving this, memory consumption goes down for about ~4GB. A bunch but might opt-in to ignore it for now (in favour to a proper cache layer).
Caching top-level resources would be quite a bit of an improvement but...
# Caching RBAC resources Before: ``` 4533682 253.2 ns/op 204 B/op 9 allocs/op ``` After: ``` 26023652 46.57 ns/op 0 B/op 0 allocs/op ``` Comparing the numbers: ``` time 253.2/46.57...
Coming back to reality; cleaning up a stable working version; we get to this:  ```json {"special":"delimiter run line","ts":"2024-03-04T11:46:17.124Z"} {"scenario":"x100: basic build regular","operation":"unmaker","numbers":{"100-10000":{"min":3051,"max":6254,"avg":3530.25,"total":70605,"runs":[3207,3277,3192,3051,3178,3156,3745,3376,3276,3285,3103,3099,3182,4701,3561,3504,6254,3685,3348,3425]}},"meta":{}} {"scenario":"x100: basic build physical","operation":"unmaker","numbers":{"100-10000":{"min":3073,"max":6290,"avg":3552.15,"total":71043,"runs":[3224,3295,3204,3073,3192,3184,3754,3391,3291,3301,3123,3114,3206,4737,3598,3548,6290,3710,3367,3441]}},"meta":{}} {"scenario":"x100: basic CRUD...