Skip to main content

Benchmarks

The overhead of policy enforcement has been benchmarked in model_b_test.go. The testbed configuration is as follows:

Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz, 2601 Mhz, 4 Core(s), 8 Logical Processor(s)

Following are the benchmarking results obtained by running go test -bench=. -benchmem (op = an Enforce() call, ms = millisecond, KB = kilobytes):

Test caseRule sizeTime overhead (ms/op)Memory overhead (KB)
ACL2 rules (2 users)0.0154935.649
RBAC5 rules (2 users, 1 role)0.0217387.522
RBAC (small)1100 rules (1000 users, 100 roles)0.16430980.620
RBAC (medium)11000 rules (10000 users, 1000 roles)2.258262765.152
RBAC (large)110000 rules (100000 users, 10000 roles)23.9167767,606
RBAC with resource roles6 rules (2 users, 2 roles)0.0211467.906
RBAC with domains/tenants6 rules (2 users, 1 role, 2 domains)0.03269610.755
ABAC0 rule (0 user)0.0075102.328
RESTful5 rules (3 users)0.04539891.774
Deny-override6 rules (2 users, 1 role)0.0232818.370
Priority9 rules (2 users, 2 roles)0.0163895.313

Benchmark monitoring

In the embedded web page below, you can see the performance changes of Casbin for each commit.

You can also directly browse it at: https://v1.casbin.org/casbin/benchmark-monitoring