Yii2 RBAC Queries

Hello and thanks to everyone that’s providing support to Yii2. I’ve just implemented an RBAC system, and it works really good, but I’m worried about all the queries the DbManager makes. There are as many as 15 queries sometimes … and although the debuggers show they are really fast, should I be worried? How will this work when there will be like 100 users accesing the website?


There is no easy way to answer that because (obviously) it depends on how much actual use those 100 users make, how fast the hardware is, where the database is compared to the web server etc.

There is some minor caching of these responses within the same request, so if you ask Yii::$app->user-can(‘updatePost’) 10 times in one request, it will only call the database once but it might still become slow over time.

There is a plugin to use memcache for rbac: https://github.com/letyii/yii2-rbac-cached Never used it so I don’t know how good it is.