开发者

CanCan Authorization: Performance Issue

开发者 https://www.devze.com 2023-03-28 18:57 出处:网络
Forgetting the definition of abilities for a second and just focusing on the \"checking\" of abilities (using \"authorize!\"), I see about 400 ms added by CanCan for simply checking if the user has a

Forgetting the definition of abilities for a second and just focusing on the "checking" of abilities (using "authorize! "), I see about 400 ms added by CanCan for simply checking if the user has a certain ability on a particular subject/model.

Is this expected (I am开发者_C百科 assuming not)? Or, is it possible I am doing something not quite right?

I've used both CURL and Benchmark.measure{} from within the Rails Console to verify this and I am reasonably positive (based on various tests) that the additional overhead is CanCan-specific.

Thoughts?


I guess this could happen when you have a huge ability file.

Consider splitting it following instructions here: https://github.com/ryanb/cancan/wiki/Admin-Namespace


I've had this issue as well. I've tried caching for now but I'm going to look at just adding booleans to the User model for permissions.

0

精彩评论

暂无评论...
验证码 换一张
取 消