php-casbin/yii-permission

Question about large casbin rules.

pigochu opened this issue · 5 comments

I cut the db query from yii2 debug .

image

Yii-permission will query all data from casbin_rule every request.
If I have 50000 users , 10 domains , and set every user to some domain.
The query results will be very very large .
How to optimze it ?

You should only load all policy data at initial time. Enforce with the policy data in memory for each request.

You should only load all policy data at initial time. Enforce with the policy data in memory for each request.

I did not use swoole . How data save in memory ?
If I have many users and domain , It also uses a lot of memory right ?

@techoner @yk17310320725

@pigochu yii-permission does not implement FilteredAdapter, you can refer to the implementation in other languages: https://casbin.org/docs/en/policy-subset-loading

@yk17310320725

similar issue to: php-casbin/php-casbin#56