Optimize RBAC System Resource Usage
Corteza access control, from version 2024.9 forth, allows system administrators to control system resource usage.
Prior versions, to provide best performance possible, pulled the entire access control model to memory which proved to be ineffective for a subset of use-cases.
Refer to the Server configuration for details on available configuration options.
|
Refer to the Most Common Scenarios section to determine if this makes sense for you. |
How it Works
The original implementation held the entire security context in an in-memory index. The index is now split up into the following components:
-
The in-memory indexwhich holds a portion (or the entire) security context in-memory. -
The counterwhich holds some metadata regarding system access and what resources make the most sense to keep in memory. -
The servicewhich ties all the new pieces together, combining the in-memory and database-stored security context. -
Service performance loggerwhich stores some metadata regarding system access, index hits, index misses, and timings.
|
To avoid preserving previously held resources which are no longer used, the counter applies a decay factor. |
Whenever the service determines the in memory state needs to re-evaluate, it looks up the counters' state to determine what is used the most.
Monitoring
To monitor your system, we recommend inspecting both system resource utilization along with inspecting the /system/stats/ endpoint.
/system/stats/ endpoint reports the following parameters:-
cacheHitsreports the total number of access evaluation requests pulled from the index. -
cacheMissesreports the total number of access evaluation requests pulled from the database. -
cacheUpdatesreports the total number of cache updates. -
avgDbTimingreports the average cache miss timing in nanoseconds (includes both preparing the query and parsing results). -
minDbTimingreports the minimum cache miss timing in nanoseconds (includes both preparing the query and parsing results). -
maxDbTimingreports the maximum cache miss timing in nanoseconds (includes both preparing the query and parsing results). -
avgIndexTimingreports the average cache hit timing in nanoseconds. -
minIndexTimingreports the minimum cache hit timing in nanoseconds. -
maxIndexTimingreports the maximum cache hit timing in nanoseconds. -
indexSizereports the current index size. -
lastHitsreports the last 500 index hits. -
lastMissesreports the last 500 index misses. -
lastDbTimingsreports the last 500 cache miss timings. -
lastIndexTimingsreports the last 500 cache hit timings. -
countersreports the current counter states.
Most Common Scenarios
Low-Power Server
In case you’re running Corteza on a server with heavily limited resources (primarily focusing on RAM), consider limiting the index size or turning in memory indexing all together.
|
To disable in memory indexing, set |
Large Number of RBAC Rules
In case you’re not doing role composition or you’re implementing role hierarchy/access on a more granular approach, your system might programmatically assigning roles and rules to all or most Corteza Low Code. If that’s the case, you might want to limit the in memory index size based on your system.