Benchmarks
- Go
- Python
- C++
- Lua (JIT)
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, 2601Mhz, 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):
テストケース | ルールのサイズ | オーバーヘッド時間 (ms/op) | Memory overhead (KB) |
---|---|---|---|
ACL | 2つのルール(2ユーザー) | 0.015493 | 5.649 |
RBAC | 5つのルール(2ユーザー、1ロール) | 0.021738 | 7.522 |
RBAC (小) | 1100 ルール (1000 ユーザー、100 ロール) | 0.164309 | 80.620 |
RBAC (medium) | 11000ルール(10000ユーザー、1000ロール) | 2.258262 | 765.152 |
RBAC (大) | 110000ルール(100000ユーザー、10000ロール) | 23.916776 | 7,606 |
RBAC with resource roles | 6つのルール(2人のユーザー、2つのロール) | 0.021146 | 7.906 |
ドメイン/テナントとRBAC | 6 ルール (2 ユーザー, 1 ロール, 2 ドメイン) | 0.032696 | 10.755 |
ABAC | 0 ルール (0 ユーザー) | 0.007510 | 2.328 |
RESTful | 5 ルール (3 ユーザー) | 0.045398 | 91.774 |
無効にする | 6つのルール(2ユーザー、1ロール) | 0.023281 | 8.370 |
優先度 | 9 ルール (2 ユーザー、2 ロール) | 0.016389 | 5.313 |
The overhead of policy enforcement in Pycasbin has been benchmarked in the tests/benchmarks
directory. The testbed configuration is as follows:
Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz (Runned by Github actions)
platform linux -- Python 3.11.4, pytest-7.0.1, pluggy-1.2.0
Here are the benchmarking results obtained from executing casbin_benchmark
(op = an enforce()
call, ms = millisecond):
テストケース | ルールのサイズ | オーバーヘッド時間 (ms/op) |
---|---|---|
ACL | 2つのルール(2ユーザー) | 0.067691 |
RBAC | 5つのルール(2ユーザー、1ロール) | 0.080045 |
RBAC (小) | 1100 ルール (1000 ユーザー、100 ロール) | 0.853590 |
RBAC (medium) | 11000ルール(10000ユーザー、1000ロール) | 6.986668 |
RBAC (大) | 110000ルール(100000ユーザー、10000ロール) | 77.922851 |
RBAC with resource roles | 6つのルール(2人のユーザー、2つのロール) | 0.106090 |
ドメイン/テナントとRBAC | 6 ルール (2 ユーザー, 1 ロール, 2 ドメイン) | 0.103628 |
ABAC | 0 ルール (0 ユーザー) | 0.053213 |
RESTful | 5 ルール (3 ユーザー) | NA |
無効にする | 6つのルール(2ユーザー、1ロール) | NA |
優先度 | 9 ルール (2 ユーザー、2 ロール) | 0.084684 |
The overhead of policy enforcement in Casbin CPP has been benchmarked in the tests/benchmarks
directory using Google's benchmarking tool. The testbed configuration is as follows:
Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz, 4 コア, 4 スレッド
Here are the benchmarking results obtained from executing the casbin_benchmark
target built in the Release
configuration (op = an enforce()
call, ms = millisecond):
テストケース | ルールのサイズ | オーバーヘッド時間 (ms/op) |
---|---|---|
ACL | 2つのルール(2ユーザー) | 0.0195 |
RBAC | 5つのルール(2ユーザー、1ロール) | 0.0288 |
RBAC (小) | 1100 ルール (1000 ユーザー、100 ロール) | 0.300 |
RBAC (medium) | 11000ルール(10000ユーザー、1000ロール) | 2.113 |
RBAC (大) | 110000ルール(100000ユーザー、10000ロール) | 21.450 |
RBAC with resource roles | 6つのルール(2人のユーザー、2つのロール) | 0.03 |
ドメイン/テナントとRBAC | 6 ルール (2 ユーザー, 1 ロール, 2 ドメイン) | 0.041 |
ABAC | 0 ルール (0 ユーザー) | NA |
RESTful | 5 ルール (3 ユーザー) | NA |
無効にする | 6つのルール(2ユーザー、1ロール) | 0.0246 |
優先度 | 9 ルール (2 ユーザー、2 ロール) | 0.035 |
The overhead of policy enforcement in Lua Casbin has been benchmarked in bench.lua. The testbed configuration is as follows:
AMD Ryzen(TM) 5 4600H CPU @ 3.0GHz, 6 コア, 12 スレッド
Here are the benchmarking results obtained by running luajit bench.lua
(op = an enforce()
call, ms = millisecond):
Test case | Rule size | Time overhead (ms/op) |
---|---|---|
ACL | 2 rules (2 users) | 0.0533 |
RBAC | 5 rules (2 users, 1 role) | 0.0972 |
RBAC (small) | 1100 rules (1000 users, 100 roles) | 0.8598 |
RBAC (medium) | 11000 rules (10000 users, 1000 roles) | 8.6848 |
RBAC (large) | 110000 rules (100000 users, 10000 roles) | 90.3217 |
RBAC with resource roles | 6 rules (2 users, 2 roles) | 0.1124 |
RBAC with domains/tenants | 6 rules (2 users, 1 role, 2 domains) | 0.1978 |
ABAC | 0 rule (0 user) | 0.0305 |
RESTful | 5 rules (3 users) | 0.1085 |
Deny-override | 6 rules (2 users, 1 role) | 0.1934 |
Priority | 9 rules (2 users, 2 roles) | 0.1437 |
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