开发者

CanCan Authorization: Performance Issue

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜