跳转至主要内容

Benchmarks

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

英特尔 酷睿 i7-6700HQ CPU @ 2.60GHz, 2601 Mhz, 4 核, 8 处理器

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

测试用例规则大小时间开销 (ms/op)内存开销 (KB)
ACL2 规则 (2用户)0.0154935.649
RBAC5条规则 (2用户,1个角色)0.0217387.522
RBAC (小型)1100条规则 (1000用户,100个角色)0.16430980.620
RBAC (中型)11000条规则 (10000用户,1000个角色)2.258262765.152
RBAC (大型)110000条规则 (100000用户,10000个角色)23.9167767606
具有资源角色的RBAC6条规则 (2用户,2个角色)0.0211467.906
带有域/租户的RBAC6 条规则 (2个用户,1个角色,2个域)0.03269610.755
ABAC0 规则 (0用户)0.0075102.328
RESTful5 规则 (3用户)0.04539891.774
拒绝改写6条规则 (2用户,1个角色)0.0232818.370
优先级9条规则 (2用户,2个角色)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